mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 11:52:08 +07:00
metadata for every state
This commit is contained in:
@@ -101,14 +101,18 @@ namespace meta_hpp
|
||||
class argument final {
|
||||
public:
|
||||
explicit argument() = default;
|
||||
explicit argument(detail::argument_state_ptr state);
|
||||
explicit argument(detail::argument_state_ptr state) noexcept;
|
||||
argument& operator=(detail::argument_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const argument_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const any_type& get_type() const noexcept;
|
||||
[[nodiscard]] std::size_t get_position() const noexcept;
|
||||
|
||||
[[nodiscard]] const std::string& get_name() const noexcept;
|
||||
private:
|
||||
detail::argument_state_ptr state_;
|
||||
@@ -118,12 +122,15 @@ namespace meta_hpp
|
||||
class constructor final {
|
||||
public:
|
||||
explicit constructor() = default;
|
||||
explicit constructor(detail::constructor_state_ptr state);
|
||||
explicit constructor(detail::constructor_state_ptr state) noexcept;
|
||||
constructor& operator=(detail::constructor_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const constructor_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const constructor_type& get_type() const noexcept;
|
||||
|
||||
template < typename... Args >
|
||||
@@ -148,12 +155,15 @@ namespace meta_hpp
|
||||
class destructor final {
|
||||
public:
|
||||
explicit destructor() = default;
|
||||
explicit destructor(detail::destructor_state_ptr state);
|
||||
explicit destructor(detail::destructor_state_ptr state) noexcept;
|
||||
destructor& operator=(detail::destructor_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const destructor_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const destructor_type& get_type() const noexcept;
|
||||
|
||||
template < typename Arg >
|
||||
@@ -175,12 +185,15 @@ namespace meta_hpp
|
||||
class evalue final {
|
||||
public:
|
||||
explicit evalue() = default;
|
||||
explicit evalue(detail::evalue_state_ptr state);
|
||||
explicit evalue(detail::evalue_state_ptr state) noexcept;
|
||||
evalue& operator=(detail::evalue_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const evalue_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const enum_type& get_type() const noexcept;
|
||||
[[nodiscard]] const std::string& get_name() const noexcept;
|
||||
|
||||
@@ -194,12 +207,15 @@ namespace meta_hpp
|
||||
class function final {
|
||||
public:
|
||||
explicit function() = default;
|
||||
explicit function(detail::function_state_ptr state);
|
||||
explicit function(detail::function_state_ptr state) noexcept;
|
||||
function& operator=(detail::function_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const function_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const function_type& get_type() const noexcept;
|
||||
[[nodiscard]] const std::string& get_name() const noexcept;
|
||||
|
||||
@@ -225,12 +241,15 @@ namespace meta_hpp
|
||||
class member final {
|
||||
public:
|
||||
explicit member() = default;
|
||||
explicit member(detail::member_state_ptr state);
|
||||
explicit member(detail::member_state_ptr state) noexcept;
|
||||
member& operator=(detail::member_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const member_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const member_type& get_type() const noexcept;
|
||||
[[nodiscard]] const std::string& get_name() const noexcept;
|
||||
|
||||
@@ -265,12 +284,15 @@ namespace meta_hpp
|
||||
class method final {
|
||||
public:
|
||||
explicit method() = default;
|
||||
explicit method(detail::method_state_ptr state);
|
||||
explicit method(detail::method_state_ptr state) noexcept;
|
||||
method& operator=(detail::method_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const method_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const method_type& get_type() const noexcept;
|
||||
[[nodiscard]] const std::string& get_name() const noexcept;
|
||||
|
||||
@@ -296,12 +318,15 @@ namespace meta_hpp
|
||||
class scope final {
|
||||
public:
|
||||
explicit scope() = default;
|
||||
explicit scope(detail::scope_state_ptr state);
|
||||
explicit scope(detail::scope_state_ptr state) noexcept;
|
||||
scope& operator=(detail::scope_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const scope_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const std::string& get_name() const noexcept;
|
||||
|
||||
[[nodiscard]] const class_map& get_classes() const noexcept;
|
||||
@@ -328,12 +353,15 @@ namespace meta_hpp
|
||||
class variable final {
|
||||
public:
|
||||
explicit variable() = default;
|
||||
explicit variable(detail::variable_state_ptr state);
|
||||
explicit variable(detail::variable_state_ptr state) noexcept;
|
||||
variable& operator=(detail::variable_state_ptr state) noexcept;
|
||||
|
||||
[[nodiscard]] bool is_valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
|
||||
[[nodiscard]] const variable_index& get_index() const noexcept;
|
||||
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||
|
||||
[[nodiscard]] const pointer_type& get_type() const noexcept;
|
||||
[[nodiscard]] const std::string& get_name() const noexcept;
|
||||
|
||||
@@ -394,18 +422,30 @@ namespace meta_hpp
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
struct argument_state final {
|
||||
argument_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
std::string name{};
|
||||
|
||||
template < typename Argument >
|
||||
[[nodiscard]] static argument_state_ptr make(std::size_t position, metadata_map metadata);
|
||||
};
|
||||
|
||||
struct constructor_state final {
|
||||
using invoke_impl = fixed_function<uvalue(std::span<const uarg>)>;
|
||||
using is_invocable_with_impl = fixed_function<bool(std::span<const uarg_base>)>;
|
||||
|
||||
constructor_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
invoke_impl invoke;
|
||||
is_invocable_with_impl is_invocable_with;
|
||||
|
||||
argument_list arguments;
|
||||
|
||||
template < constructor_policy_kind Policy, class_kind Class, typename... Args >
|
||||
[[nodiscard]] static constructor_state_ptr make();
|
||||
[[nodiscard]] static constructor_state_ptr make(metadata_map metadata);
|
||||
};
|
||||
|
||||
struct destructor_state final {
|
||||
@@ -413,20 +453,24 @@ namespace meta_hpp::detail
|
||||
using is_invocable_with_impl = fixed_function<bool(const uarg_base&)>;
|
||||
|
||||
destructor_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
invoke_impl invoke;
|
||||
is_invocable_with_impl is_invocable_with;
|
||||
|
||||
template < class_kind Class >
|
||||
[[nodiscard]] static destructor_state_ptr make();
|
||||
[[nodiscard]] static destructor_state_ptr make(metadata_map metadata);
|
||||
};
|
||||
|
||||
struct evalue_state final {
|
||||
evalue_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
uvalue enum_value;
|
||||
uvalue underlying_value;
|
||||
|
||||
template < enum_kind Enum >
|
||||
[[nodiscard]] static evalue_state_ptr make(std::string name, Enum evalue);
|
||||
[[nodiscard]] static evalue_state_ptr make(std::string name, Enum evalue, metadata_map metadata);
|
||||
};
|
||||
|
||||
struct function_state final {
|
||||
@@ -434,13 +478,15 @@ namespace meta_hpp::detail
|
||||
using is_invocable_with_impl = fixed_function<bool(std::span<const uarg_base>)>;
|
||||
|
||||
function_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
invoke_impl invoke;
|
||||
is_invocable_with_impl is_invocable_with;
|
||||
|
||||
argument_list arguments;
|
||||
|
||||
template < function_policy_kind Policy, function_kind Function >
|
||||
[[nodiscard]] static function_state_ptr make(std::string name, Function function);
|
||||
[[nodiscard]] static function_state_ptr make(std::string name, Function function, metadata_map metadata);
|
||||
};
|
||||
|
||||
struct member_state final {
|
||||
@@ -451,13 +497,16 @@ namespace meta_hpp::detail
|
||||
using is_settable_with_impl = fixed_function<bool(const uinst_base&, const uarg_base&)>;
|
||||
|
||||
member_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
getter_impl getter;
|
||||
setter_impl setter;
|
||||
is_gettable_with_impl is_gettable_with;
|
||||
is_settable_with_impl is_settable_with;
|
||||
|
||||
|
||||
template < member_policy_kind Policy, member_kind Member >
|
||||
[[nodiscard]] static member_state_ptr make(std::string name, Member member);
|
||||
[[nodiscard]] static member_state_ptr make(std::string name, Member member, metadata_map metadata);
|
||||
};
|
||||
|
||||
struct method_state final {
|
||||
@@ -465,33 +514,27 @@ namespace meta_hpp::detail
|
||||
using is_invocable_with_impl = fixed_function<bool(const uinst_base&, std::span<const uarg_base>)>;
|
||||
|
||||
method_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
invoke_impl invoke;
|
||||
is_invocable_with_impl is_invocable_with;
|
||||
|
||||
argument_list arguments;
|
||||
|
||||
template < method_policy_kind Policy, method_kind Method >
|
||||
[[nodiscard]] static method_state_ptr make(std::string name, Method method);
|
||||
};
|
||||
|
||||
struct argument_state final {
|
||||
argument_index index;
|
||||
|
||||
std::string name{};
|
||||
|
||||
template < typename Argument >
|
||||
[[nodiscard]] static argument_state_ptr make(std::size_t position);
|
||||
[[nodiscard]] static method_state_ptr make(std::string name, Method method, metadata_map metadata);
|
||||
};
|
||||
|
||||
struct scope_state final {
|
||||
scope_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
class_map classes{};
|
||||
enum_map enums{};
|
||||
function_map functions{};
|
||||
variable_map variables{};
|
||||
|
||||
[[nodiscard]] static scope_state_ptr make(std::string name);
|
||||
[[nodiscard]] static scope_state_ptr make(std::string name, metadata_map metadata);
|
||||
};
|
||||
|
||||
struct variable_state final {
|
||||
@@ -500,11 +543,13 @@ namespace meta_hpp::detail
|
||||
using is_settable_with_impl = fixed_function<bool(const uarg_base&)>;
|
||||
|
||||
variable_index index;
|
||||
metadata_map metadata;
|
||||
|
||||
getter_impl getter;
|
||||
setter_impl setter;
|
||||
is_settable_with_impl is_settable_with;
|
||||
|
||||
template < variable_policy_kind Policy, pointer_kind Pointer >
|
||||
[[nodiscard]] static variable_state_ptr make(std::string name, Pointer pointer);
|
||||
[[nodiscard]] static variable_state_ptr make(std::string name, Pointer pointer, metadata_map metadata);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < typename Argument >
|
||||
inline argument_state_ptr argument_state::make(std::size_t position) {
|
||||
inline argument_state_ptr argument_state::make(std::size_t position, metadata_map metadata) {
|
||||
return std::make_shared<argument_state>(argument_state{
|
||||
.index{argument_index::make<Argument>(position)},
|
||||
.metadata{std::move(metadata)},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -22,9 +23,14 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp
|
||||
{
|
||||
|
||||
inline argument::argument(detail::argument_state_ptr state)
|
||||
inline argument::argument(detail::argument_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline argument& argument::operator=(detail::argument_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool argument::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -37,6 +43,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& argument::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const any_type& argument::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace meta_hpp::detail
|
||||
[&arguments]<std::size_t... Is>(std::index_sequence<Is...>) mutable {
|
||||
(arguments.push_back([]<std::size_t I>(){
|
||||
using P = detail::type_list_at_t<I, typename ct::argument_types>;
|
||||
return argument{detail::argument_state::make<P>(I)};
|
||||
return argument{detail::argument_state::make<P>(I, metadata_map{})};
|
||||
}.template operator()<Is>()), ...);
|
||||
}(std::make_index_sequence<ct::arity>());
|
||||
|
||||
@@ -111,9 +111,10 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < constructor_policy_kind Policy, class_kind Class, typename... Args >
|
||||
constructor_state_ptr constructor_state::make() {
|
||||
constructor_state_ptr constructor_state::make(metadata_map metadata) {
|
||||
return std::make_shared<constructor_state>(constructor_state{
|
||||
.index{constructor_index::make<Class, Args...>()},
|
||||
.metadata{std::move(metadata)},
|
||||
.invoke{make_constructor_invoke<Policy, Class, Args...>()},
|
||||
.is_invocable_with{make_constructor_is_invocable_with<Class, Args...>()},
|
||||
.arguments{make_constructor_arguments<Class, Args...>()},
|
||||
@@ -123,9 +124,14 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline constructor::constructor(detail::constructor_state_ptr state)
|
||||
inline constructor::constructor(detail::constructor_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline constructor& constructor::operator=(detail::constructor_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool constructor::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -138,6 +144,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& constructor::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const constructor_type& constructor::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
@@ -54,9 +54,10 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < class_kind Class >
|
||||
destructor_state_ptr destructor_state::make() {
|
||||
destructor_state_ptr destructor_state::make(metadata_map metadata) {
|
||||
return std::make_shared<destructor_state>(destructor_state{
|
||||
.index{destructor_index::make<Class>()},
|
||||
.metadata{std::move(metadata)},
|
||||
.invoke{make_destructor_invoke<Class>()},
|
||||
.is_invocable_with{make_destructor_is_invocable_with<Class>()},
|
||||
});
|
||||
@@ -65,9 +66,14 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline destructor::destructor(detail::destructor_state_ptr state)
|
||||
inline destructor::destructor(detail::destructor_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline destructor& destructor::operator=(detail::destructor_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool destructor::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -80,6 +86,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& destructor::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const destructor_type& destructor::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < enum_kind Enum >
|
||||
evalue_state_ptr evalue_state::make(std::string name, Enum evalue) {
|
||||
evalue_state_ptr evalue_state::make(std::string name, Enum evalue, metadata_map metadata) {
|
||||
return std::make_shared<evalue_state>(evalue_state{
|
||||
.index{evalue_index::make<Enum>(std::move(name))},
|
||||
.metadata{std::move(metadata)},
|
||||
.enum_value{uvalue{evalue}},
|
||||
.underlying_value{uvalue{stdex::to_underlying(evalue)}},
|
||||
});
|
||||
@@ -25,9 +26,14 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline evalue::evalue(detail::evalue_state_ptr state)
|
||||
inline evalue::evalue(detail::evalue_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline evalue& evalue::operator=(detail::evalue_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool evalue::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -40,6 +46,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& evalue::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const enum_type& evalue::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace meta_hpp::detail
|
||||
[&arguments]<std::size_t... Is>(std::index_sequence<Is...>) mutable {
|
||||
(arguments.push_back([]<std::size_t I>(){
|
||||
using P = detail::type_list_at_t<I, typename ft::argument_types>;
|
||||
return argument{detail::argument_state::make<P>(I)};
|
||||
return argument{detail::argument_state::make<P>(I, metadata_map{})};
|
||||
}.template operator()<Is>()), ...);
|
||||
}(std::make_index_sequence<ft::arity>());
|
||||
|
||||
@@ -117,9 +117,10 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < function_policy_kind Policy, function_kind Function >
|
||||
function_state_ptr function_state::make(std::string name, Function function) {
|
||||
function_state_ptr function_state::make(std::string name, Function function, metadata_map metadata) {
|
||||
return std::make_shared<function_state>(function_state{
|
||||
.index{function_index::make<Function>(std::move(name))},
|
||||
.metadata{std::move(metadata)},
|
||||
.invoke{make_function_invoke<Policy>(std::move(function))},
|
||||
.is_invocable_with{make_function_is_invocable_with<Function>()},
|
||||
.arguments{make_function_arguments<Function>()},
|
||||
@@ -129,9 +130,14 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline function::function(detail::function_state_ptr state)
|
||||
inline function::function(detail::function_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline function& function::operator=(detail::function_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool function::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -144,6 +150,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& function::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const function_type& function::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
@@ -147,9 +147,10 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < member_policy_kind Policy, member_kind Member >
|
||||
member_state_ptr member_state::make(std::string name, Member member) {
|
||||
member_state_ptr member_state::make(std::string name, Member member, metadata_map metadata) {
|
||||
return std::make_shared<member_state>(member_state{
|
||||
.index{member_index::make<Member>(std::move(name))},
|
||||
.metadata{std::move(metadata)},
|
||||
.getter{make_member_getter<Policy>(member)},
|
||||
.setter{make_member_setter(member)},
|
||||
.is_gettable_with{make_member_is_gettable_with<Member>()},
|
||||
@@ -160,9 +161,14 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline member::member(detail::member_state_ptr state)
|
||||
inline member::member(detail::member_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline member& member::operator=(detail::member_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool member::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -175,6 +181,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& member::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const member_type& member::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace meta_hpp::detail
|
||||
[&arguments]<std::size_t... Is>(std::index_sequence<Is...>) mutable {
|
||||
(arguments.push_back([]<std::size_t I>(){
|
||||
using P = detail::type_list_at_t<I, typename mt::argument_types>;
|
||||
return argument{detail::argument_state::make<P>(I)};
|
||||
return argument{detail::argument_state::make<P>(I, metadata_map{})};
|
||||
}.template operator()<Is>()), ...);
|
||||
}(std::make_index_sequence<mt::arity>());
|
||||
|
||||
@@ -130,9 +130,10 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < method_policy_kind Policy, method_kind Method >
|
||||
method_state_ptr method_state::make(std::string name, Method method) {
|
||||
method_state_ptr method_state::make(std::string name, Method method, metadata_map metadata) {
|
||||
return std::make_shared<method_state>(method_state{
|
||||
.index{method_index::make<Method>(std::move(name))},
|
||||
.metadata{std::move(metadata)},
|
||||
.invoke{make_method_invoke<Policy>(std::move(method))},
|
||||
.is_invocable_with{make_method_is_invocable_with<Method>()},
|
||||
.arguments{make_method_arguments<Method>()},
|
||||
@@ -142,9 +143,14 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline method::method(detail::method_state_ptr state)
|
||||
inline method::method(detail::method_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline method& method::operator=(detail::method_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool method::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -157,6 +163,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& method::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const method_type& method::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
@@ -20,18 +20,24 @@
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
inline scope_state_ptr scope_state::make(std::string name) {
|
||||
inline scope_state_ptr scope_state::make(std::string name, metadata_map metadata) {
|
||||
return std::make_shared<scope_state>(scope_state{
|
||||
.index{scope_index::make(std::move(name))},
|
||||
.metadata{std::move(metadata)},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline scope::scope(detail::scope_state_ptr state)
|
||||
inline scope::scope(detail::scope_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline scope& scope::operator=(detail::scope_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool scope::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -44,6 +50,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& scope::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const std::string& scope::get_name() const noexcept {
|
||||
return state_->index.get_name();
|
||||
}
|
||||
|
||||
@@ -96,9 +96,10 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < variable_policy_kind Policy, pointer_kind Pointer >
|
||||
variable_state_ptr variable_state::make(std::string name, Pointer pointer) {
|
||||
variable_state_ptr variable_state::make(std::string name, Pointer pointer, metadata_map metadata) {
|
||||
return std::make_shared<variable_state>(variable_state{
|
||||
.index{variable_index::make<Pointer>(std::move(name))},
|
||||
.metadata{std::move(metadata)},
|
||||
.getter{make_variable_getter<Policy>(pointer)},
|
||||
.setter{make_variable_setter(pointer)},
|
||||
.is_settable_with{make_variable_is_settable_with<Pointer>()},
|
||||
@@ -108,9 +109,14 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline variable::variable(detail::variable_state_ptr state)
|
||||
inline variable::variable(detail::variable_state_ptr state) noexcept
|
||||
: state_{std::move(state)} {}
|
||||
|
||||
inline variable& variable::operator=(detail::variable_state_ptr state) noexcept {
|
||||
state_ = std::move(state);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool variable::is_valid() const noexcept {
|
||||
return !!state_;
|
||||
}
|
||||
@@ -123,6 +129,10 @@ namespace meta_hpp
|
||||
return state_->index;
|
||||
}
|
||||
|
||||
inline const metadata_map& variable::get_metadata() const noexcept {
|
||||
return state_->metadata;
|
||||
}
|
||||
|
||||
inline const pointer_type& variable::get_type() const noexcept {
|
||||
return state_->index.get_type();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user