Skip to content

Commit 005efc5

Browse files
committed
porting to cmsdk v2.0
1 parent f378b6b commit 005efc5

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- Updated CMake files to use CMakeSDK v2.0 or greater
88
- Add `magic_enum` to `VarAPI` to convert `enum class` to/from string and to iterate all values
99

10+
## Bug Fixes
11+
12+
- Remove unused member from `fs::Path`
13+
- Make `fs::Path` a `static` only class (cannot be constructed)
1014

1115
# Version 1.4.0
1216

libraries/FsAPI/include/fs/Path.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace fs {
3131
*/
3232

3333
class Path {
34+
Path() = default;
3435
public:
3536
API_NO_DISCARD static var::StringView suffix(var::StringView path);
3637
API_NO_DISCARD static var::StringView name(var::StringView path);
@@ -49,9 +50,6 @@ class Path {
4950
*
5051
*/
5152
API_NO_DISCARD static bool is_hidden(var::StringView path);
52-
53-
private:
54-
var::StringView m_path;
5553
};
5654
} // namespace fs
5755

libraries/VarAPI/include/var/MagicEnum.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace var {
1313

1414
template <class Type> class MagicEnum {
15-
public:
1615
MagicEnum() = default;
1716

17+
public:
1818
static StringView to_string_view(Type value) {
1919
return StringView{magic_enum::enum_name(value)};
2020
}
@@ -24,17 +24,12 @@ template <class Type> class MagicEnum {
2424
}
2525

2626
static auto from_string_view(var::StringView name) {
27-
return magic_enum::enum_cast<Type>(std::string{name.to_std_string_view()});
27+
return magic_enum::enum_cast<Type>(name.to_std_string_view());
2828
}
2929

30-
static size_t count(){
31-
return magic_enum::enum_count<Type>();
32-
}
33-
34-
static constexpr auto list(){
35-
return magic_enum::enum_values<Type>();
36-
}
30+
static size_t count() { return magic_enum::enum_count<Type>(); }
3731

32+
static constexpr auto list() { return magic_enum::enum_values<Type>(); }
3833

3934
private:
4035
};

tests/VarAPI/src/UnitTest.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,16 @@ class UnitTest : public test::Test {
142142
TEST_ASSERT(MagicX::from_cstring("x5").value() == X::x5);
143143
TEST_ASSERT(!MagicX::from_cstring("x6").has_value());
144144

145+
TEST_ASSERT(MagicX::from_string_view("x0").value() == X::x0);
146+
TEST_ASSERT(MagicX::from_string_view("x1").value() == X::x1);
147+
TEST_ASSERT(MagicX::from_string_view("x2").value() == X::x2);
148+
TEST_ASSERT(MagicX::from_string_view("x3").value() == X::x3);
149+
TEST_ASSERT(MagicX::from_string_view("x4").value() == X::x4);
150+
TEST_ASSERT(MagicX::from_string_view("x5").value() == X::x5);
151+
TEST_ASSERT(!MagicX::from_string_view("x6").has_value());
152+
145153
int count = 0;
146-
for (const auto &value : MagicX::list()) {
154+
for (const auto value : MagicX::list()) {
147155
const auto sv = MagicX::to_string_view(value);
148156
printer().key(NumberString(count), sv);
149157
++count;

0 commit comments

Comments
 (0)