cleanup examples

This commit is contained in:
BlackMATov
2024-02-08 08:43:42 +07:00
parent 4b30a1d832
commit db52c66b5b
12 changed files with 35 additions and 51 deletions

View File

@@ -46,20 +46,6 @@ target_link_libraries(your_project_target PUBLIC meta.hpp::meta.hpp)
Or just use the single-header version of the library, which you can find [here](develop/singles/headers/meta.hpp/meta_all.hpp).
## Manuals
- [class](develop/manuals/meta_manuals/class_manual.cpp)
- [enum](develop/manuals/meta_manuals/enum_manual.cpp)
- [function](develop/manuals/meta_manuals/function_manual.cpp)
- [inplace](develop/manuals/meta_manuals/inplace_manual.cpp)
- [member](develop/manuals/meta_manuals/member_manual.cpp)
- [metadata](develop/manuals/meta_manuals/metadata_manual.cpp)
- [method](develop/manuals/meta_manuals/method_manual.cpp)
- [scopes](develop/manuals/meta_manuals/scopes_manual.cpp)
- [ucast](develop/manuals/meta_manuals/ucast_manual.cpp)
- [uvalue](develop/manuals/meta_manuals/uvalue_manual.cpp)
- [variable](develop/manuals/meta_manuals/variable_manual.cpp)
## Features
- can reflect:
@@ -85,15 +71,21 @@ Or just use the single-header version of the library, which you can find [here](
## Documentation
- [API Reference](./manuals/api.md#api-reference)
- [Basics](./manuals/api/basics.md)
- [Binds](./manuals/api/binds.md)
- [Indices](./manuals/api/indices.md)
- [Invoke](./manuals/api/invoke.md)
- [Policies](./manuals/api/policies.md)
- [Registry](./manuals/api/registry.md)
- [States](./manuals/api/states.md)
- [Types](./manuals/api/types.md)
- [API Reference](./manuals/api.md)
### Examples
- [class](develop/manuals/meta_examples/class_example.cpp)
- [enum](develop/manuals/meta_examples/enum_example.cpp)
- [function](develop/manuals/meta_examples/function_example.cpp)
- [inplace](develop/manuals/meta_examples/inplace_example.cpp)
- [member](develop/manuals/meta_examples/member_example.cpp)
- [metadata](develop/manuals/meta_examples/metadata_example.cpp)
- [method](develop/manuals/meta_examples/method_example.cpp)
- [scopes](develop/manuals/meta_examples/scopes_example.cpp)
- [ucast](develop/manuals/meta_examples/ucast_example.cpp)
- [uvalue](develop/manuals/meta_examples/uvalue_example.cpp)
- [variable](develop/manuals/meta_examples/variable_example.cpp)
## Alternatives

View File

@@ -14,10 +14,6 @@ namespace
class shape {
META_HPP_ENABLE_POLY_INFO()
public:
shape() = default;
shape(const shape&) = default;
virtual ~shape() = default;
virtual int get_area() const = 0;
};
@@ -45,7 +41,7 @@ namespace
};
}
TEST_CASE("meta/meta_manuals/class/type") {
TEST_CASE("meta/meta_examples/class/type") {
namespace meta = meta_hpp;
// 'shape' class type registration
@@ -75,7 +71,7 @@ TEST_CASE("meta/meta_manuals/class/type") {
// + get_width/0
}
TEST_CASE("meta/meta_manuals/class/usage") {
TEST_CASE("meta/meta_examples/class/usage") {
namespace meta = meta_hpp;
// resolves a class type by static class type

View File

@@ -18,7 +18,7 @@ namespace
};
}
TEST_CASE("meta/meta_manuals/enum/type") {
TEST_CASE("meta/meta_examples/enum/type") {
namespace meta = meta_hpp;
// 'align' enumeration type registration
@@ -51,7 +51,7 @@ TEST_CASE("meta/meta_manuals/enum/type") {
// - right/1
}
TEST_CASE("meta/meta_manuals/enum/usage") {
TEST_CASE("meta/meta_examples/enum/usage") {
namespace meta = meta_hpp;
const align e = align::center;

View File

@@ -20,7 +20,7 @@ namespace
}
}
TEST_CASE("meta/meta_manuals/function/type") {
TEST_CASE("meta/meta_examples/function/type") {
namespace meta = meta_hpp;
// resolves a function type by reference
@@ -40,7 +40,7 @@ TEST_CASE("meta/meta_manuals/function/type") {
CHECK(add_function_type.get_argument_type(1) == meta::resolve_type<int>());
}
TEST_CASE("meta/meta_manuals/function/usage") {
TEST_CASE("meta/meta_examples/function/usage") {
namespace meta = meta_hpp;
// 'math' local scope declaration

View File

@@ -24,7 +24,7 @@ namespace
};
}
TEST_CASE("meta/meta_manuals/inplace") {
TEST_CASE("meta/meta_examples/inplace") {
namespace meta = meta_hpp;
// 'ivec2' class type registration

View File

@@ -17,7 +17,7 @@ namespace
};
}
TEST_CASE("meta/meta_manuals/member/type") {
TEST_CASE("meta/meta_examples/member/type") {
namespace meta = meta_hpp;
// 'ivec2' class type registration
@@ -38,7 +38,7 @@ TEST_CASE("meta/meta_manuals/member/type") {
CHECK(x_member_type.get_value_type() == meta::resolve_type<int>());
}
TEST_CASE("meta/meta_manuals/member/usage") {
TEST_CASE("meta/meta_examples/member/usage") {
namespace meta = meta_hpp;
ivec2 v{42, 21};

View File

@@ -25,7 +25,7 @@ namespace
}
}
TEST_CASE("meta/meta_manuals/metadata") {
TEST_CASE("meta/meta_examples/metadata") {
namespace meta = meta_hpp;
using namespace std::literals;

View File

@@ -27,7 +27,7 @@ namespace
};
}
TEST_CASE("meta/meta_manuals/method/type") {
TEST_CASE("meta/meta_examples/method/type") {
namespace meta = meta_hpp;
// 'ivec2' class type registration
@@ -53,7 +53,7 @@ TEST_CASE("meta/meta_manuals/method/type") {
CHECK(add_method_type.get_argument_type(0) == meta::resolve_type<const ivec2&>());
}
TEST_CASE("meta/meta_manuals/method/usage") {
TEST_CASE("meta/meta_examples/method/usage") {
namespace meta = meta_hpp;
ivec2 v{20, 10};

View File

@@ -45,7 +45,7 @@ namespace
}
}
TEST_CASE("meta/meta_manuals/scopes/local") {
TEST_CASE("meta/meta_examples/scopes/local") {
namespace meta = meta_hpp;
// creates new local scope
@@ -85,18 +85,18 @@ TEST_CASE("meta/meta_manuals/scopes/local") {
CHECK(dot3_function(unit3_variable.get(), unit3_variable.get()).as<int>() == 3);
}
TEST_CASE("meta/meta_manuals/scopes/global") {
TEST_CASE("meta/meta_examples/scopes/global") {
namespace meta = meta_hpp;
// also, we can create global scopes
meta::static_scope_("meta/meta_manuals/scopes/global/math")
meta::static_scope_("meta/meta_examples/scopes/global/math")
.function_("dot2", &dot2)
.function_("dot3", &dot3)
.variable_("unit2", &unit2)
.variable_("unit3", &unit3);
// finds our global scope by name
const meta::scope math_scope = meta::resolve_scope("meta/meta_manuals/scopes/global/math");
const meta::scope math_scope = meta::resolve_scope("meta/meta_examples/scopes/global/math");
// and uses it in the same way
const meta::function dot2_function = math_scope.get_function("dot2");

View File

@@ -32,7 +32,7 @@ namespace
};
}
TEST_CASE("meta/meta_manuals/ucast") {
TEST_CASE("meta/meta_examples/ucast") {
namespace meta = meta_hpp;
C c{};

View File

@@ -14,10 +14,6 @@ namespace
class shape {
META_HPP_ENABLE_POLY_INFO()
public:
shape() = default;
shape(const shape&) = default;
virtual ~shape() = default;
virtual int get_area() const = 0;
};
@@ -45,7 +41,7 @@ namespace
};
}
TEST_CASE("meta/meta_manuals/uvalue") {
TEST_CASE("meta/meta_examples/uvalue/bind") {
namespace meta = meta_hpp;
// 'shape' class type registration
@@ -59,7 +55,7 @@ TEST_CASE("meta/meta_manuals/uvalue") {
.method_("get_height", &rectangle::get_height);
}
TEST_CASE("meta/meta_manuals/uvalue/usage") {
TEST_CASE("meta/meta_examples/uvalue/usage") {
namespace meta = meta_hpp;
// the 'uvalue' class allows to store any typed value inside

View File

@@ -15,7 +15,7 @@ namespace
const double sqrt2_v{1.4142135624};
}
TEST_CASE("meta/meta_manuals/variable/usage") {
TEST_CASE("meta/meta_examples/variable/usage") {
namespace meta = meta_hpp;
// 'constants' local scope declaration