mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-16 14:09:02 +07:00
metadata member for every type
This commit is contained in:
@@ -204,6 +204,7 @@ namespace meta_hpp
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
using argument_list = std::vector<argument>;
|
using argument_list = std::vector<argument>;
|
||||||
|
using metadata_map = std::map<std::string, uvalue, std::less<>>;
|
||||||
|
|
||||||
using class_set = std::set<class_type, std::less<>>;
|
using class_set = std::set<class_type, std::less<>>;
|
||||||
using class_map = std::map<std::string, class_type, std::less<>>;
|
using class_map = std::map<std::string, class_type, std::less<>>;
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] type_kind get_kind() const noexcept;
|
[[nodiscard]] type_kind get_kind() const noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
any_type(const array_type& other) noexcept;
|
any_type(const array_type& other) noexcept;
|
||||||
any_type(const class_type& other) noexcept;
|
any_type(const class_type& other) noexcept;
|
||||||
any_type(const constructor_type& other) noexcept;
|
any_type(const constructor_type& other) noexcept;
|
||||||
@@ -126,6 +128,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] array_bitflags get_flags() const noexcept;
|
[[nodiscard]] array_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] std::size_t get_extent() const noexcept;
|
[[nodiscard]] std::size_t get_extent() const noexcept;
|
||||||
[[nodiscard]] any_type get_data_type() const noexcept;
|
[[nodiscard]] any_type get_data_type() const noexcept;
|
||||||
@@ -144,6 +147,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] class_bitflags get_flags() const noexcept;
|
[[nodiscard]] class_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] std::size_t get_size() const noexcept;
|
[[nodiscard]] std::size_t get_size() const noexcept;
|
||||||
|
|
||||||
@@ -216,6 +220,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] constructor_bitflags get_flags() const noexcept;
|
[[nodiscard]] constructor_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_class_type() const noexcept;
|
[[nodiscard]] any_type get_class_type() const noexcept;
|
||||||
@@ -236,6 +241,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] destructor_bitflags get_flags() const noexcept;
|
[[nodiscard]] destructor_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] any_type get_class_type() const noexcept;
|
[[nodiscard]] any_type get_class_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
@@ -253,6 +259,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] enum_bitflags get_flags() const noexcept;
|
[[nodiscard]] enum_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] number_type get_underlying_type() const noexcept;
|
[[nodiscard]] number_type get_underlying_type() const noexcept;
|
||||||
|
|
||||||
@@ -278,6 +285,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] function_bitflags get_flags() const noexcept;
|
[[nodiscard]] function_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_return_type() const noexcept;
|
[[nodiscard]] any_type get_return_type() const noexcept;
|
||||||
@@ -298,6 +306,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] member_bitflags get_flags() const noexcept;
|
[[nodiscard]] member_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] class_type get_owner_type() const noexcept;
|
[[nodiscard]] class_type get_owner_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_value_type() const noexcept;
|
[[nodiscard]] any_type get_value_type() const noexcept;
|
||||||
@@ -316,6 +325,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] method_bitflags get_flags() const noexcept;
|
[[nodiscard]] method_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] class_type get_owner_type() const noexcept;
|
[[nodiscard]] class_type get_owner_type() const noexcept;
|
||||||
@@ -336,6 +346,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] explicit operator bool() const noexcept;
|
[[nodiscard]] explicit operator bool() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::nullptr_type_data_ptr data_;
|
detail::nullptr_type_data_ptr data_;
|
||||||
friend auto detail::type_access<nullptr_type>(const nullptr_type&);
|
friend auto detail::type_access<nullptr_type>(const nullptr_type&);
|
||||||
@@ -351,6 +362,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] number_bitflags get_flags() const noexcept;
|
[[nodiscard]] number_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] std::size_t get_size() const noexcept;
|
[[nodiscard]] std::size_t get_size() const noexcept;
|
||||||
private:
|
private:
|
||||||
@@ -368,6 +380,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] pointer_bitflags get_flags() const noexcept;
|
[[nodiscard]] pointer_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] any_type get_data_type() const noexcept;
|
[[nodiscard]] any_type get_data_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
@@ -385,6 +398,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
[[nodiscard]] reference_bitflags get_flags() const noexcept;
|
[[nodiscard]] reference_bitflags get_flags() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] any_type get_data_type() const noexcept;
|
[[nodiscard]] any_type get_data_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
@@ -401,6 +415,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] explicit operator bool() const noexcept;
|
[[nodiscard]] explicit operator bool() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] type_id get_id() const noexcept;
|
[[nodiscard]] type_id get_id() const noexcept;
|
||||||
|
[[nodiscard]] const metadata_map& get_metadata() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::void_type_data_ptr data_;
|
detail::void_type_data_ptr data_;
|
||||||
friend auto detail::type_access<void_type>(const void_type&);
|
friend auto detail::type_access<void_type>(const void_type&);
|
||||||
@@ -447,6 +462,8 @@ namespace meta_hpp::detail
|
|||||||
const type_id id;
|
const type_id id;
|
||||||
const type_kind kind;
|
const type_kind kind;
|
||||||
|
|
||||||
|
metadata_map metadata;
|
||||||
|
|
||||||
explicit type_data_base(type_id id, type_kind kind)
|
explicit type_data_base(type_id id, type_kind kind)
|
||||||
: id{id}
|
: id{id}
|
||||||
, kind{kind} {}
|
, kind{kind} {}
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ namespace meta_hpp
|
|||||||
return data_->kind;
|
return data_->kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& any_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline any_type::any_type(const array_type& other) noexcept
|
inline any_type::any_type(const array_type& other) noexcept
|
||||||
: data_{detail::type_access(other)} {}
|
: data_{detail::type_access(other)} {}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& array_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::size_t array_type::get_extent() const noexcept {
|
inline std::size_t array_type::get_extent() const noexcept {
|
||||||
return data_->extent;
|
return data_->extent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& class_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::size_t class_type::get_size() const noexcept {
|
inline std::size_t class_type::get_size() const noexcept {
|
||||||
return data_->size;
|
return data_->size;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& constructor_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::size_t constructor_type::get_arity() const noexcept {
|
inline std::size_t constructor_type::get_arity() const noexcept {
|
||||||
return data_->argument_types.size();
|
return data_->argument_types.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& destructor_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline any_type destructor_type::get_class_type() const noexcept {
|
inline any_type destructor_type::get_class_type() const noexcept {
|
||||||
return data_->class_type;
|
return data_->class_type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& enum_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline number_type enum_type::get_underlying_type() const noexcept {
|
inline number_type enum_type::get_underlying_type() const noexcept {
|
||||||
return data_->underlying_type;
|
return data_->underlying_type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& function_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::size_t function_type::get_arity() const noexcept {
|
inline std::size_t function_type::get_arity() const noexcept {
|
||||||
return data_->argument_types.size();
|
return data_->argument_types.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& member_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline class_type member_type::get_owner_type() const noexcept {
|
inline class_type member_type::get_owner_type() const noexcept {
|
||||||
return data_->owner_type;
|
return data_->owner_type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& method_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::size_t method_type::get_arity() const noexcept {
|
inline std::size_t method_type::get_arity() const noexcept {
|
||||||
return data_->argument_types.size();
|
return data_->argument_types.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,4 +36,8 @@ namespace meta_hpp
|
|||||||
inline type_id nullptr_type::get_id() const noexcept {
|
inline type_id nullptr_type::get_id() const noexcept {
|
||||||
return data_->id;
|
return data_->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& nullptr_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& number_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::size_t number_type::get_size() const noexcept {
|
inline std::size_t number_type::get_size() const noexcept {
|
||||||
return data_->size;
|
return data_->size;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& pointer_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline any_type pointer_type::get_data_type() const noexcept {
|
inline any_type pointer_type::get_data_type() const noexcept {
|
||||||
return data_->data_type;
|
return data_->data_type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ namespace meta_hpp
|
|||||||
return data_->flags;
|
return data_->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& reference_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
inline any_type reference_type::get_data_type() const noexcept {
|
inline any_type reference_type::get_data_type() const noexcept {
|
||||||
return data_->data_type;
|
return data_->data_type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,4 +36,8 @@ namespace meta_hpp
|
|||||||
inline type_id void_type::get_id() const noexcept {
|
inline type_id void_type::get_id() const noexcept {
|
||||||
return data_->id;
|
return data_->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const metadata_map& void_type::get_metadata() const noexcept {
|
||||||
|
return data_->metadata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user