Silence some warnings
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2025. MadVoxel AG
|
||||||
|
* All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -76,7 +81,7 @@ namespace OpenVulkano
|
|||||||
o.m_leadComponents = { 0, 0 };
|
o.m_leadComponents = { 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionDataExtended(VersionDataExtendedData&& data) :
|
[[maybe_unused]] VersionDataExtended(VersionDataExtendedData&& data) :
|
||||||
m_leadComponents({ UINT32_MAX, UINT32_MAX }), m_data(std::make_unique<VersionDataExtendedData>(std::move(data)))
|
m_leadComponents({ UINT32_MAX, UINT32_MAX }), m_data(std::make_unique<VersionDataExtendedData>(std::move(data)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -119,16 +124,16 @@ namespace OpenVulkano
|
|||||||
else compact = o.compact;
|
else compact = o.compact;
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionData(const VersionDataCompact& other) { new (&compact)VersionDataCompact(other); }
|
[[maybe_unused]] VersionData(const VersionDataCompact& other) { new (&compact)VersionDataCompact(other); }
|
||||||
|
|
||||||
VersionData(VersionDataCompact&& other) { new (&compact) VersionDataCompact(std::move(other)); }
|
VersionData(VersionDataCompact&& other) { new (&compact) VersionDataCompact(std::move(other)); }
|
||||||
|
|
||||||
VersionData(const VersionDataExtended& other)
|
[[maybe_unused]] VersionData(const VersionDataExtended& other)
|
||||||
{
|
{
|
||||||
new (&extended)VersionDataExtended(other);
|
new (&extended)VersionDataExtended(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionData(VersionDataExtended&& other) { new (&extended) VersionDataExtended(std::move(other)); }
|
[[maybe_unused]] VersionData(VersionDataExtended&& other) { new (&extended) VersionDataExtended(std::move(other)); }
|
||||||
|
|
||||||
~VersionData()
|
~VersionData()
|
||||||
{
|
{
|
||||||
@@ -252,12 +257,11 @@ namespace OpenVulkano
|
|||||||
|
|
||||||
//[[nodiscard]] bool IsPreRelease() const { return m_preRelease; }
|
//[[nodiscard]] bool IsPreRelease() const { return m_preRelease; }
|
||||||
|
|
||||||
[[nodiscard]] const std::vector<std::string>& GetTags() const
|
[[nodiscard]] std::span<const std::string> GetTags() const
|
||||||
{
|
{
|
||||||
static std::vector<std::string> fallbackTags;
|
|
||||||
if (IsExtendedData())
|
if (IsExtendedData())
|
||||||
return m_data.extended.m_data->m_tagComponents;
|
return m_data.extended.m_data->m_tagComponents;
|
||||||
return fallbackTags;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::span<const uint32_t> GetVersionComponents() const
|
[[nodiscard]] std::span<const uint32_t> GetVersionComponents() const
|
||||||
@@ -290,8 +294,10 @@ namespace OpenVulkano
|
|||||||
[[nodiscard]] int CompareComponents(const Version& other) const;
|
[[nodiscard]] int CompareComponents(const Version& other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Version operator""_v(const char* str) { return { str }; }
|
[[nodiscard]] [[maybe_unused]] static Version operator""_v(const char* str) { return { str }; }
|
||||||
static Version operator""_version(const char* str) { return { str }; }
|
[[nodiscard]] [[maybe_unused]] static Version operator""_v(const char* str, size_t c) { return { std::string_view(str, c) }; }
|
||||||
static Version operator""_v(const long double val) { return Version(static_cast<double>(val)); }
|
[[nodiscard]] [[maybe_unused]] static Version operator""_version(const char* str) { return { str }; }
|
||||||
static Version operator""_version(const long double val) { return Version(static_cast<double>(val)); }
|
[[nodiscard]] [[maybe_unused]] static Version operator""_version(const char* str, size_t c) { return { std::string_view(str, c) }; }
|
||||||
|
[[nodiscard]] [[maybe_unused]] static Version operator""_v(const long double val) { return Version(static_cast<double>(val)); }
|
||||||
|
[[nodiscard]] [[maybe_unused]] static Version operator""_version(const long double val) { return Version(static_cast<double>(val)); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2025. MadVoxel AG
|
||||||
|
* All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -550,6 +555,17 @@ TEST_CASE("testToString", "[Version]")
|
|||||||
REQUIRE_FALSE(VERSION_1_0 == static_cast<const std::string&>(version_1));
|
REQUIRE_FALSE(VERSION_1_0 == static_cast<const std::string&>(version_1));
|
||||||
REQUIRE_FALSE(VERSION_1_0 == static_cast<const std::string&>(version_1_2));
|
REQUIRE_FALSE(VERSION_1_0 == static_cast<const std::string&>(version_1_2));
|
||||||
REQUIRE_FALSE("2.0" == static_cast<const std::string&>(version_v2_0));
|
REQUIRE_FALSE("2.0" == static_cast<const std::string&>(version_v2_0));
|
||||||
|
REQUIRE("v2.0" == version_v2_0.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("testTags", "[Version]")
|
||||||
|
{
|
||||||
|
const Version taged("v1.2.3-ALPHA-B99");
|
||||||
|
REQUIRE(taged.Build() == 99);
|
||||||
|
REQUIRE(taged.GetTags().size() == 2);
|
||||||
|
REQUIRE(taged.GetTags()[0] == "ALPHA");
|
||||||
|
REQUIRE(taged.GetTags()[1] == "B99");
|
||||||
|
REQUIRE(Version("1.90").GetTags().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("testUnimportantVersionParts", "[Version]")
|
TEST_CASE("testUnimportantVersionParts", "[Version]")
|
||||||
@@ -603,3 +619,12 @@ TEST_CASE("testMoveConstructorAndAssignment", "[Version]")
|
|||||||
REQUIRE(extended3 != extended);
|
REQUIRE(extended3 != extended);
|
||||||
REQUIRE(extended3 != mvConstructedExtended);
|
REQUIRE(extended3 != mvConstructedExtended);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("testLiterals", "[Version]")
|
||||||
|
{
|
||||||
|
REQUIRE(version_1 == 1_v);
|
||||||
|
REQUIRE(version_1 == 1.0_v);
|
||||||
|
REQUIRE(version_1_2 == 1.2_v);
|
||||||
|
REQUIRE(version_1_2 == 1.2_version);
|
||||||
|
REQUIRE(Version(1, 2, 3) == "1.2.3"_version);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user