mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
implicit get info from registry classes
This commit is contained in:
@@ -28,63 +28,38 @@ namespace meta_hpp
|
|||||||
return info_;
|
return info_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator const class_info&() const noexcept {
|
||||||
|
return info_;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename... Internals >
|
template < typename... Internals >
|
||||||
class_& operator()(Internals&&...internals) {
|
class_& operator()(Internals&&...internals) {
|
||||||
(add_(std::forward<Internals>(internals)), ...);
|
(add_(std::forward<Internals>(internals)), ...);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
template < typename InternalClass >
|
void add_(const class_info& info) {
|
||||||
void add_(const class_<InternalClass>& internal) {
|
detail::merge_with(info_.classes_, info.id(), info, &class_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.classes_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&class_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const data_& internal) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
||||||
info_.datas_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&data_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template < auto InternalField >
|
void add_(const field_info& info) {
|
||||||
void add_(const field_<InternalField>& internal) {
|
detail::merge_with(info_.fields_, info.id(), info, &field_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.fields_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&field_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template < auto InternalFunction >
|
void add_(const function_info& info) {
|
||||||
void add_(const function_<InternalFunction>& internal) {
|
detail::merge_with(info_.functions_, info.id(), info, &function_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.functions_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&function_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template < auto InternalMethod >
|
void add_(const method_info& info) {
|
||||||
void add_(const method_<InternalMethod>& internal) {
|
detail::merge_with(info_.methods_, info.id(), info, &method_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.methods_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&method_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template < auto InternalVariable >
|
void add_(const variable_info& info) {
|
||||||
void add_(const variable_<InternalVariable>& internal) {
|
detail::merge_with(info_.variables_, info.id(), info, &variable_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.variables_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&variable_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
class_info info_;
|
class_info info_;
|
||||||
|
|||||||
@@ -21,18 +21,18 @@ namespace meta_hpp
|
|||||||
return info_;
|
return info_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator const data_info&() const noexcept {
|
||||||
|
return info_;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename... Internals >
|
template < typename... Internals >
|
||||||
data_& operator()(Internals&&...internals) {
|
data_& operator()(Internals&&...internals) {
|
||||||
(add_(std::forward<Internals>(internals)), ...);
|
(add_(std::forward<Internals>(internals)), ...);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_& internal) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
||||||
info_.datas_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&data_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
data_info info_;
|
data_info info_;
|
||||||
|
|||||||
@@ -29,18 +29,18 @@ namespace meta_hpp
|
|||||||
return info_;
|
return info_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator const field_info&() const noexcept {
|
||||||
|
return info_;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename... Internals >
|
template < typename... Internals >
|
||||||
field_& operator()(Internals&&...internals) {
|
field_& operator()(Internals&&...internals) {
|
||||||
(add_(std::forward<Internals>(internals)), ...);
|
(add_(std::forward<Internals>(internals)), ...);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_& internal) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
||||||
info_.datas_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&data_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
field_info info_;
|
field_info info_;
|
||||||
|
|||||||
@@ -28,18 +28,18 @@ namespace meta_hpp
|
|||||||
return info_;
|
return info_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator const function_info&() const noexcept {
|
||||||
|
return info_;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename... Internals >
|
template < typename... Internals >
|
||||||
function_& operator()(Internals&&...internals) {
|
function_& operator()(Internals&&...internals) {
|
||||||
(add_(std::forward<Internals>(internals)), ...);
|
(add_(std::forward<Internals>(internals)), ...);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_& internal) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
||||||
info_.datas_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&data_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
function_info info_;
|
function_info info_;
|
||||||
|
|||||||
@@ -29,18 +29,18 @@ namespace meta_hpp
|
|||||||
return info_;
|
return info_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator const method_info&() const {
|
||||||
|
return info_;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename... Internals >
|
template < typename... Internals >
|
||||||
method_& operator()(Internals&&...internals) {
|
method_& operator()(Internals&&...internals) {
|
||||||
(add_(std::forward<Internals>(internals)), ...);
|
(add_(std::forward<Internals>(internals)), ...);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_& internal) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
||||||
info_.datas_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&data_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
method_info info_;
|
method_info info_;
|
||||||
|
|||||||
@@ -26,53 +26,34 @@ namespace meta_hpp
|
|||||||
return info_;
|
return info_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator const namespace_info&() const noexcept {
|
||||||
|
return info_;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename... Internals >
|
template < typename... Internals >
|
||||||
namespace_& operator()(Internals&&...internals) {
|
namespace_& operator()(Internals&&...internals) {
|
||||||
(add_(std::forward<Internals>(internals)), ...);
|
(add_(std::forward<Internals>(internals)), ...);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
template < typename InternalClass >
|
void add_(const class_info& info) {
|
||||||
void add_(const class_<InternalClass>& internal) {
|
detail::merge_with(info_.classes_, info.id(), info, &class_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.classes_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&class_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const data_& internal) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
||||||
info_.datas_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&data_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template < auto InternalFunction >
|
void add_(const function_info& info) {
|
||||||
void add_(const function_<InternalFunction>& internal) {
|
detail::merge_with(info_.functions_, info.id(), info, &function_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.functions_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&function_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const namespace_& internal) {
|
void add_(const namespace_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.namespaces_, info.id(), info, &namespace_info::merge_with_);
|
||||||
info_.namespaces_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&namespace_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template < auto InternalVariable >
|
void add_(const variable_info& info) {
|
||||||
void add_(const variable_<InternalVariable>& internal) {
|
detail::merge_with(info_.variables_, info.id(), info, &variable_info::merge_with_);
|
||||||
detail::merge_with(
|
|
||||||
info_.variables_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&variable_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
namespace_info info_;
|
namespace_info info_;
|
||||||
|
|||||||
@@ -27,18 +27,18 @@ namespace meta_hpp
|
|||||||
return info_;
|
return info_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator const variable_info&() const noexcept {
|
||||||
|
return info_;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename... Internals >
|
template < typename... Internals >
|
||||||
variable_& operator()(Internals&&...internals) {
|
variable_& operator()(Internals&&...internals) {
|
||||||
(add_(std::forward<Internals>(internals)), ...);
|
(add_(std::forward<Internals>(internals)), ...);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_& internal) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
||||||
info_.datas_,
|
|
||||||
internal.info().id(),
|
|
||||||
internal.info(),
|
|
||||||
&data_info::merge_with_);
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
variable_info info_;
|
variable_info info_;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ TEST_CASE("meta/class") {
|
|||||||
|
|
||||||
meta::class_<clazz> class_{"clazz"};
|
meta::class_<clazz> class_{"clazz"};
|
||||||
const meta::class_<clazz>& cclass_ = class_;
|
const meta::class_<clazz>& cclass_ = class_;
|
||||||
const meta::class_info& clazz_info = cclass_.info();
|
const meta::class_info& clazz_info = cclass_;
|
||||||
|
|
||||||
CHECK_FALSE(clazz_info.get_class("clazz2"));
|
CHECK_FALSE(clazz_info.get_class("clazz2"));
|
||||||
CHECK_FALSE(clazz_info.get_field("field"));
|
CHECK_FALSE(clazz_info.get_field("field"));
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ TEST_CASE("meta/data") {
|
|||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
meta::data_ data_("key"s, "value"s);
|
meta::data_ data_("key"s, "value"s);
|
||||||
const meta::data_info& data_info = data_.info();
|
const meta::data_info& data_info = data_;
|
||||||
|
|
||||||
CHECK(data_info.id() == "key");
|
CHECK(data_info.id() == "key");
|
||||||
CHECK(data_info.get().to_string() == "value");
|
CHECK(data_info.get().to_string() == "value");
|
||||||
@@ -74,7 +74,7 @@ TEST_CASE("meta/data/class") {
|
|||||||
|
|
||||||
const meta::class_info clazz_info = meta::class_<clazz>("clazz")(
|
const meta::class_info clazz_info = meta::class_<clazz>("clazz")(
|
||||||
meta::data_("hello"s, "world"s)
|
meta::data_("hello"s, "world"s)
|
||||||
).info();
|
);
|
||||||
|
|
||||||
CHECK(clazz_info.get_data("hello"));
|
CHECK(clazz_info.get_data("hello"));
|
||||||
CHECK(clazz_info.get_data("hello")->get().to_string() == "world");
|
CHECK(clazz_info.get_data("hello")->get().to_string() == "world");
|
||||||
@@ -88,7 +88,7 @@ TEST_CASE("meta/data/data") {
|
|||||||
meta::data_("hello"s, "world"s)(
|
meta::data_("hello"s, "world"s)(
|
||||||
meta::data_("hello2"s, "world2"s)
|
meta::data_("hello2"s, "world2"s)
|
||||||
)
|
)
|
||||||
).info();
|
);
|
||||||
|
|
||||||
CHECK(clazz_info.get_data("hello"));
|
CHECK(clazz_info.get_data("hello"));
|
||||||
CHECK(clazz_info.get_data("hello")->get_data("hello2"));
|
CHECK(clazz_info.get_data("hello")->get_data("hello2"));
|
||||||
@@ -103,7 +103,7 @@ TEST_CASE("meta/data/field") {
|
|||||||
meta::field_<&clazz::field>("field")(
|
meta::field_<&clazz::field>("field")(
|
||||||
meta::data_("hello"s, "world"s)
|
meta::data_("hello"s, "world"s)
|
||||||
)
|
)
|
||||||
).info();
|
);
|
||||||
|
|
||||||
CHECK(clazz_info.get_field("field"));
|
CHECK(clazz_info.get_field("field"));
|
||||||
CHECK(clazz_info.get_field("field")->get_data("hello"));
|
CHECK(clazz_info.get_field("field")->get_data("hello"));
|
||||||
@@ -118,7 +118,7 @@ TEST_CASE("meta/data/function") {
|
|||||||
meta::function_<&clazz::function>("function")(
|
meta::function_<&clazz::function>("function")(
|
||||||
meta::data_("hello"s, "world"s)
|
meta::data_("hello"s, "world"s)
|
||||||
)
|
)
|
||||||
).info();
|
);
|
||||||
|
|
||||||
CHECK(clazz_info.get_function("function"));
|
CHECK(clazz_info.get_function("function"));
|
||||||
CHECK(clazz_info.get_function("function")->get_data("hello"));
|
CHECK(clazz_info.get_function("function")->get_data("hello"));
|
||||||
@@ -133,7 +133,7 @@ TEST_CASE("meta/data/method") {
|
|||||||
meta::method_<&clazz::method>("method")(
|
meta::method_<&clazz::method>("method")(
|
||||||
meta::data_("hello"s, "world"s)
|
meta::data_("hello"s, "world"s)
|
||||||
)
|
)
|
||||||
).info();
|
);
|
||||||
|
|
||||||
CHECK(clazz_info.get_method("method"));
|
CHECK(clazz_info.get_method("method"));
|
||||||
CHECK(clazz_info.get_method("method")->get_data("hello"));
|
CHECK(clazz_info.get_method("method")->get_data("hello"));
|
||||||
@@ -146,7 +146,7 @@ TEST_CASE("meta/data/namespace") {
|
|||||||
|
|
||||||
const meta::namespace_info ns_info = meta::namespace_("ns")(
|
const meta::namespace_info ns_info = meta::namespace_("ns")(
|
||||||
meta::data_("hello"s, "world"s)
|
meta::data_("hello"s, "world"s)
|
||||||
).info();
|
);
|
||||||
|
|
||||||
CHECK(ns_info.get_data("hello"));
|
CHECK(ns_info.get_data("hello"));
|
||||||
CHECK(ns_info.get_data("hello")->get().to_string() == "world");
|
CHECK(ns_info.get_data("hello")->get().to_string() == "world");
|
||||||
@@ -160,7 +160,7 @@ TEST_CASE("meta/data/variable") {
|
|||||||
meta::variable_<&clazz::variable>("variable")(
|
meta::variable_<&clazz::variable>("variable")(
|
||||||
meta::data_("hello"s, "world"s)
|
meta::data_("hello"s, "world"s)
|
||||||
)
|
)
|
||||||
).info();
|
);
|
||||||
|
|
||||||
CHECK(clazz_info.get_variable("variable"));
|
CHECK(clazz_info.get_variable("variable"));
|
||||||
CHECK(clazz_info.get_variable("variable")->get_data("hello"));
|
CHECK(clazz_info.get_variable("variable")->get_data("hello"));
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ TEST_CASE("meta/examples/simple") {
|
|||||||
),
|
),
|
||||||
function_<select<ivec2(ivec2,ivec2)>(&add)>("iadd2"),
|
function_<select<ivec2(ivec2,ivec2)>(&add)>("iadd2"),
|
||||||
function_<select<ivec3(ivec3,ivec3)>(&add)>("iadd3")
|
function_<select<ivec3(ivec3,ivec3)>(&add)>("iadd3")
|
||||||
).info();
|
);
|
||||||
|
|
||||||
class_info ivec2_info = vmath_info.get_class("ivec2").value();
|
class_info ivec2_info = vmath_info.get_class("ivec2").value();
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ TEST_CASE("meta/field") {
|
|||||||
meta::field_<&clazz::field> field_{"field"};
|
meta::field_<&clazz::field> field_{"field"};
|
||||||
meta::field_<&clazz::cfield> cfield_{"cfield"};
|
meta::field_<&clazz::cfield> cfield_{"cfield"};
|
||||||
|
|
||||||
const meta::field_info& field_info = field_.info();
|
const meta::field_info& field_info = field_;
|
||||||
const meta::field_info& cfield_info = cfield_.info();
|
const meta::field_info& cfield_info = cfield_;
|
||||||
|
|
||||||
{
|
{
|
||||||
clazz instance;
|
clazz instance;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ TEST_CASE("meta/function") {
|
|||||||
meta::function_<&int_f_int> int_f_int_function_("int_f_int");
|
meta::function_<&int_f_int> int_f_int_function_("int_f_int");
|
||||||
meta::function_<&int_f_int2> int_f_int2_function_("int_f_int2");
|
meta::function_<&int_f_int2> int_f_int2_function_("int_f_int2");
|
||||||
|
|
||||||
const meta::function_info& void_f_void_info = void_f_void_function_.info();
|
const meta::function_info& void_f_void_info = void_f_void_function_;
|
||||||
const meta::function_info& void_f_int_info = void_f_int_function_.info();
|
const meta::function_info& void_f_int_info = void_f_int_function_;
|
||||||
const meta::function_info& void_f_int2_info = void_f_int2_function_.info();
|
const meta::function_info& void_f_int2_info = void_f_int2_function_;
|
||||||
|
|
||||||
const meta::function_info& int_f_void_info = int_f_void_function_.info();
|
const meta::function_info& int_f_void_info = int_f_void_function_;
|
||||||
const meta::function_info& int_f_int_info = int_f_int_function_.info();
|
const meta::function_info& int_f_int_info = int_f_int_function_;
|
||||||
const meta::function_info& int_f_int2_info = int_f_int2_function_.info();
|
const meta::function_info& int_f_int2_info = int_f_int2_function_;
|
||||||
|
|
||||||
SUBCASE("void_return") {
|
SUBCASE("void_return") {
|
||||||
CHECK_NOTHROW(void_f_void_info.invoke());
|
CHECK_NOTHROW(void_f_void_info.invoke());
|
||||||
|
|||||||
@@ -40,13 +40,13 @@ TEST_CASE("meta/non_const_method") {
|
|||||||
meta::method_<&clazz::int_f_int> int_f_int_method_("int_f_int");
|
meta::method_<&clazz::int_f_int> int_f_int_method_("int_f_int");
|
||||||
meta::method_<&clazz::int_f_int2> int_f_int2_method_("int_f_int2");
|
meta::method_<&clazz::int_f_int2> int_f_int2_method_("int_f_int2");
|
||||||
|
|
||||||
const meta::method_info& void_f_void_info = void_f_void_method_.info();
|
const meta::method_info& void_f_void_info = void_f_void_method_;
|
||||||
const meta::method_info& void_f_int_info = void_f_int_method_.info();
|
const meta::method_info& void_f_int_info = void_f_int_method_;
|
||||||
const meta::method_info& void_f_int2_info = void_f_int2_method_.info();
|
const meta::method_info& void_f_int2_info = void_f_int2_method_;
|
||||||
|
|
||||||
const meta::method_info& int_f_void_info = int_f_void_method_.info();
|
const meta::method_info& int_f_void_info = int_f_void_method_;
|
||||||
const meta::method_info& int_f_int_info = int_f_int_method_.info();
|
const meta::method_info& int_f_int_info = int_f_int_method_;
|
||||||
const meta::method_info& int_f_int2_info = int_f_int2_method_.info();
|
const meta::method_info& int_f_int2_info = int_f_int2_method_;
|
||||||
|
|
||||||
SUBCASE("void_return") {
|
SUBCASE("void_return") {
|
||||||
clazz instance;
|
clazz instance;
|
||||||
@@ -108,13 +108,13 @@ TEST_CASE("meta/const_method") {
|
|||||||
meta::method_<&clazz::const_int_f_int> int_f_int_method_("int_f_int");
|
meta::method_<&clazz::const_int_f_int> int_f_int_method_("int_f_int");
|
||||||
meta::method_<&clazz::const_int_f_int2> int_f_int2_method_("int_f_int2");
|
meta::method_<&clazz::const_int_f_int2> int_f_int2_method_("int_f_int2");
|
||||||
|
|
||||||
const meta::method_info& void_f_void_info = void_f_void_method_.info();
|
const meta::method_info& void_f_void_info = void_f_void_method_;
|
||||||
const meta::method_info& void_f_int_info = void_f_int_method_.info();
|
const meta::method_info& void_f_int_info = void_f_int_method_;
|
||||||
const meta::method_info& void_f_int2_info = void_f_int2_method_.info();
|
const meta::method_info& void_f_int2_info = void_f_int2_method_;
|
||||||
|
|
||||||
const meta::method_info& int_f_void_info = int_f_void_method_.info();
|
const meta::method_info& int_f_void_info = int_f_void_method_;
|
||||||
const meta::method_info& int_f_int_info = int_f_int_method_.info();
|
const meta::method_info& int_f_int_info = int_f_int_method_;
|
||||||
const meta::method_info& int_f_int2_info = int_f_int2_method_.info();
|
const meta::method_info& int_f_int2_info = int_f_int2_method_;
|
||||||
|
|
||||||
SUBCASE("void_return") {
|
SUBCASE("void_return") {
|
||||||
clazz instance;
|
clazz instance;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ TEST_CASE("meta/namespace") {
|
|||||||
|
|
||||||
meta::namespace_ namespace_{"ns"};
|
meta::namespace_ namespace_{"ns"};
|
||||||
const meta::namespace_& cnamespace_ = namespace_;
|
const meta::namespace_& cnamespace_ = namespace_;
|
||||||
const meta::namespace_info& ns_info = cnamespace_.info();
|
const meta::namespace_info& ns_info = cnamespace_;
|
||||||
|
|
||||||
CHECK_FALSE(ns_info.get_class("clazz"));
|
CHECK_FALSE(ns_info.get_class("clazz"));
|
||||||
CHECK_FALSE(ns_info.get_function("func"));
|
CHECK_FALSE(ns_info.get_function("func"));
|
||||||
@@ -75,6 +75,7 @@ TEST_CASE("meta/namespace/merge") {
|
|||||||
namespace meta = meta_hpp;
|
namespace meta = meta_hpp;
|
||||||
|
|
||||||
meta::namespace_ namespace_{"ns"};
|
meta::namespace_ namespace_{"ns"};
|
||||||
|
const meta::namespace_info& ns_info = namespace_;
|
||||||
|
|
||||||
namespace_(
|
namespace_(
|
||||||
meta::namespace_{"ns2"}(
|
meta::namespace_{"ns2"}(
|
||||||
@@ -96,7 +97,7 @@ TEST_CASE("meta/namespace/merge") {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const meta::namespace_info ns2_info = namespace_.info().get_namespace("ns2").value();
|
const meta::namespace_info ns2_info = ns_info.get_namespace("ns2").value();
|
||||||
const meta::namespace_info ns3_info = ns2_info.get_namespace("ns3").value();
|
const meta::namespace_info ns3_info = ns2_info.get_namespace("ns3").value();
|
||||||
|
|
||||||
CHECK(ns2_info.get_class("clazz"));
|
CHECK(ns2_info.get_class("clazz"));
|
||||||
|
|||||||
@@ -31,27 +31,27 @@ TEST_CASE("meta/type") {
|
|||||||
namespace meta = meta_hpp;
|
namespace meta = meta_hpp;
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
meta::type class_type = meta::class_<clazz>("clazz").info();
|
meta::type class_type = meta::class_<clazz>("clazz");
|
||||||
CHECK(class_type.is_class());
|
CHECK(class_type.is_class());
|
||||||
CHECK(class_type.get_class_info().id() == "clazz");
|
CHECK(class_type.get_class_info().id() == "clazz");
|
||||||
|
|
||||||
meta::type field_type = meta::field_<&clazz::field>("field").info();
|
meta::type field_type = meta::field_<&clazz::field>("field");
|
||||||
CHECK(field_type.is_field());
|
CHECK(field_type.is_field());
|
||||||
CHECK(field_type.get_field_info().id() == "field");
|
CHECK(field_type.get_field_info().id() == "field");
|
||||||
|
|
||||||
meta::type function_type = meta::function_<&clazz::function>("function").info();
|
meta::type function_type = meta::function_<&clazz::function>("function");
|
||||||
CHECK(function_type.is_function());
|
CHECK(function_type.is_function());
|
||||||
CHECK(function_type.get_function_info().id() == "function");
|
CHECK(function_type.get_function_info().id() == "function");
|
||||||
|
|
||||||
meta::type method_type = meta::method_<&clazz::method>("method").info();
|
meta::type method_type = meta::method_<&clazz::method>("method");
|
||||||
CHECK(method_type.is_method());
|
CHECK(method_type.is_method());
|
||||||
CHECK(method_type.get_method_info().id() == "method");
|
CHECK(method_type.get_method_info().id() == "method");
|
||||||
|
|
||||||
meta::type namespace_type = meta::namespace_("ns").info();
|
meta::type namespace_type = meta::namespace_("ns");
|
||||||
CHECK(namespace_type.is_namespace());
|
CHECK(namespace_type.is_namespace());
|
||||||
CHECK(namespace_type.get_namespace_info().id() == "ns");
|
CHECK(namespace_type.get_namespace_info().id() == "ns");
|
||||||
|
|
||||||
meta::type variable_type = meta::variable_<&clazz::variable>("variable").info();
|
meta::type variable_type = meta::variable_<&clazz::variable>("variable");
|
||||||
CHECK(variable_type.is_variable());
|
CHECK(variable_type.is_variable());
|
||||||
CHECK(variable_type.get_variable_info().id() == "variable");
|
CHECK(variable_type.get_variable_info().id() == "variable");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ TEST_CASE("meta/variable") {
|
|||||||
meta::variable_<&variable> variable_{"variable"};
|
meta::variable_<&variable> variable_{"variable"};
|
||||||
meta::variable_<&cvariable> cvariable_{"cvariable"};
|
meta::variable_<&cvariable> cvariable_{"cvariable"};
|
||||||
|
|
||||||
const meta::variable_info& variable_info = variable_.info();
|
const meta::variable_info& variable_info = variable_;
|
||||||
const meta::variable_info& cvariable_info = cvariable_.info();
|
const meta::variable_info& cvariable_info = cvariable_;
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK(variable == 1);
|
CHECK(variable == 1);
|
||||||
@@ -62,8 +62,8 @@ TEST_CASE("meta/variable") {
|
|||||||
meta::variable_<&clazz::variable> variable_{"variable"};
|
meta::variable_<&clazz::variable> variable_{"variable"};
|
||||||
meta::variable_<&clazz::cvariable> cvariable_{"cvariable"};
|
meta::variable_<&clazz::cvariable> cvariable_{"cvariable"};
|
||||||
|
|
||||||
const meta::variable_info& variable_info = variable_.info();
|
const meta::variable_info& variable_info = variable_;
|
||||||
const meta::variable_info& cvariable_info = cvariable_.info();
|
const meta::variable_info& cvariable_info = cvariable_;
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK(clazz::variable == 1);
|
CHECK(clazz::variable == 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user