mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-14 11:40:35 +07:00
some new typedefs
This commit is contained in:
@@ -188,7 +188,9 @@ namespace meta_hpp
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
using any_type_list = std::vector<any_type>;
|
||||
using argument_list = std::vector<argument>;
|
||||
|
||||
using metadata_map = std::map<std::string, uvalue, std::less<>>;
|
||||
using typedef_map = std::map<std::string, any_type, std::less<>>;
|
||||
|
||||
|
||||
@@ -47,8 +47,10 @@ namespace meta_hpp
|
||||
metadata_map metadata{};
|
||||
};
|
||||
|
||||
using argument_opts_list = std::vector<argument_opts>;
|
||||
|
||||
struct constructor_opts final {
|
||||
std::vector<argument_opts> arguments{};
|
||||
argument_opts_list arguments{};
|
||||
metadata_map metadata{};
|
||||
};
|
||||
|
||||
@@ -61,7 +63,7 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
struct function_opts final {
|
||||
std::vector<argument_opts> arguments{};
|
||||
argument_opts_list arguments{};
|
||||
metadata_map metadata{};
|
||||
};
|
||||
|
||||
@@ -70,7 +72,7 @@ namespace meta_hpp
|
||||
};
|
||||
|
||||
struct method_opts final {
|
||||
std::vector<argument_opts> arguments{};
|
||||
argument_opts_list arguments{};
|
||||
metadata_map metadata{};
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace meta_hpp
|
||||
}
|
||||
|
||||
template < typename... Ts >
|
||||
[[nodiscard]] std::vector<any_type> resolve_types() {
|
||||
[[nodiscard]] any_type_list resolve_types() {
|
||||
return { resolve_type<Ts>()... };
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace meta_hpp
|
||||
}
|
||||
|
||||
template < typename... Ts >
|
||||
[[nodiscard]] std::vector<any_type> resolve_types(type_list<Ts...>) {
|
||||
[[nodiscard]] any_type_list resolve_types(type_list<Ts...>) {
|
||||
return { resolve_type<Ts>()... };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace meta_hpp
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::vector<any_type>& args = function.get_type().get_argument_types();
|
||||
const any_type_list& args = function.get_type().get_argument_types();
|
||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||
return function;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace meta_hpp
|
||||
|
||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
||||
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||
|
||||
[[nodiscard]] const class_set& get_bases() const noexcept;
|
||||
[[nodiscard]] const constructor_map& get_constructors() const noexcept;
|
||||
@@ -228,7 +228,7 @@ namespace meta_hpp
|
||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||
[[nodiscard]] any_type get_class_type() const noexcept;
|
||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
||||
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||
private:
|
||||
detail::constructor_type_data* data_{};
|
||||
friend auto detail::type_access<constructor_type>(const constructor_type&);
|
||||
@@ -293,7 +293,7 @@ namespace meta_hpp
|
||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||
[[nodiscard]] any_type get_return_type() const noexcept;
|
||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
||||
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||
private:
|
||||
detail::function_type_data* data_{};
|
||||
friend auto detail::type_access<function_type>(const function_type&);
|
||||
@@ -334,7 +334,7 @@ namespace meta_hpp
|
||||
[[nodiscard]] class_type get_owner_type() const noexcept;
|
||||
[[nodiscard]] any_type get_return_type() const noexcept;
|
||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
||||
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||
private:
|
||||
detail::method_type_data* data_{};
|
||||
friend auto detail::type_access<method_type>(const method_type&);
|
||||
@@ -496,7 +496,7 @@ namespace meta_hpp::detail
|
||||
const class_bitflags flags;
|
||||
const std::size_t size;
|
||||
const std::size_t align;
|
||||
const std::vector<any_type> argument_types;
|
||||
const any_type_list argument_types;
|
||||
|
||||
class_set bases;
|
||||
constructor_map constructors;
|
||||
@@ -522,7 +522,7 @@ namespace meta_hpp::detail
|
||||
struct constructor_type_data final : type_data_base {
|
||||
const constructor_bitflags flags;
|
||||
const any_type class_type;
|
||||
const std::vector<any_type> argument_types;
|
||||
const any_type_list argument_types;
|
||||
|
||||
template < class_kind Class, typename... Args >
|
||||
explicit constructor_type_data(type_list<Class>, type_list<Args...>);
|
||||
@@ -549,7 +549,7 @@ namespace meta_hpp::detail
|
||||
struct function_type_data final : type_data_base {
|
||||
const function_bitflags flags;
|
||||
const any_type return_type;
|
||||
const std::vector<any_type> argument_types;
|
||||
const any_type_list argument_types;
|
||||
|
||||
template < function_kind Function >
|
||||
explicit function_type_data(type_list<Function>);
|
||||
@@ -568,7 +568,7 @@ namespace meta_hpp::detail
|
||||
const method_bitflags flags;
|
||||
const class_type owner_type;
|
||||
const any_type return_type;
|
||||
const std::vector<any_type> argument_types;
|
||||
const any_type_list argument_types;
|
||||
|
||||
template < method_kind Method >
|
||||
explicit method_type_data(type_list<Method>);
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace meta_hpp
|
||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||
}
|
||||
|
||||
inline const std::vector<any_type>& class_type::get_argument_types() const noexcept {
|
||||
inline const any_type_list& class_type::get_argument_types() const noexcept {
|
||||
return data_->argument_types;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace meta_hpp
|
||||
template < typename Iter >
|
||||
constructor class_type::get_constructor_with(Iter first, Iter last) const noexcept {
|
||||
for ( auto&& [index, ctor] : data_->constructors ) {
|
||||
const std::vector<any_type>& args = ctor.get_type().get_argument_types();
|
||||
const any_type_list& args = ctor.get_type().get_argument_types();
|
||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||
return ctor;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ namespace meta_hpp
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::vector<any_type>& args = function.get_type().get_argument_types();
|
||||
const any_type_list& args = function.get_type().get_argument_types();
|
||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||
return function;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ namespace meta_hpp
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::vector<any_type>& args = method.get_type().get_argument_types();
|
||||
const any_type_list& args = method.get_type().get_argument_types();
|
||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||
return method;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace meta_hpp
|
||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||
}
|
||||
|
||||
inline const std::vector<any_type>& constructor_type::get_argument_types() const noexcept {
|
||||
inline const any_type_list& constructor_type::get_argument_types() const noexcept {
|
||||
return data_->argument_types;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace meta_hpp
|
||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||
}
|
||||
|
||||
inline const std::vector<any_type>& function_type::get_argument_types() const noexcept {
|
||||
inline const any_type_list& function_type::get_argument_types() const noexcept {
|
||||
return data_->argument_types;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace meta_hpp
|
||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||
}
|
||||
|
||||
inline const std::vector<any_type>& method_type::get_argument_types() const noexcept {
|
||||
inline const any_type_list& method_type::get_argument_types() const noexcept {
|
||||
return data_->argument_types;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user