File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ namespace fs {
3131 */
3232
3333class Path {
34+ Path () = default ;
3435public:
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
Original file line number Diff line number Diff line change 1212namespace var {
1313
1414template <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
3934private:
4035};
Original file line number Diff line number Diff 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;
You can’t perform that action at this time.
0 commit comments