mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-14 11:40:35 +07:00
top binds without type_opts
This commit is contained in:
2
TODO.md
2
TODO.md
@@ -13,3 +13,5 @@
|
|||||||
- (?) move-only value type support
|
- (?) move-only value type support
|
||||||
- (?) type names
|
- (?) type names
|
||||||
- (?) properties
|
- (?) properties
|
||||||
|
|
||||||
|
(???) Why does local scope have a name?
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ namespace meta_hpp::detail
|
|||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
struct type_opts final {
|
|
||||||
metadata_map metadata{};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct argument_opts final {
|
struct argument_opts final {
|
||||||
std::string name{};
|
std::string name{};
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
@@ -75,10 +71,6 @@ namespace meta_hpp
|
|||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct scope_opts final {
|
|
||||||
metadata_map metadata{};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct variable_opts final {
|
struct variable_opts final {
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
@@ -89,7 +81,7 @@ namespace meta_hpp
|
|||||||
template < detail::array_kind Array >
|
template < detail::array_kind Array >
|
||||||
class array_bind final {
|
class array_bind final {
|
||||||
public:
|
public:
|
||||||
explicit array_bind(type_opts opts);
|
explicit array_bind(metadata_map metadata);
|
||||||
operator array_type() const noexcept;
|
operator array_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::array_type_data_ptr data_;
|
detail::array_type_data_ptr data_;
|
||||||
@@ -101,7 +93,7 @@ namespace meta_hpp
|
|||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
class class_bind final {
|
class class_bind final {
|
||||||
public:
|
public:
|
||||||
explicit class_bind(type_opts opts);
|
explicit class_bind(metadata_map metadata);
|
||||||
operator class_type() const noexcept;
|
operator class_type() const noexcept;
|
||||||
|
|
||||||
// constructor_
|
// constructor_
|
||||||
@@ -228,7 +220,7 @@ namespace meta_hpp
|
|||||||
template < detail::enum_kind Enum >
|
template < detail::enum_kind Enum >
|
||||||
class enum_bind final {
|
class enum_bind final {
|
||||||
public:
|
public:
|
||||||
explicit enum_bind(type_opts opts);
|
explicit enum_bind(metadata_map metadata);
|
||||||
operator enum_type() const noexcept;
|
operator enum_type() const noexcept;
|
||||||
|
|
||||||
enum_bind& evalue_(std::string name, Enum value);
|
enum_bind& evalue_(std::string name, Enum value);
|
||||||
@@ -243,7 +235,7 @@ namespace meta_hpp
|
|||||||
template < detail::function_kind Function >
|
template < detail::function_kind Function >
|
||||||
class function_bind final {
|
class function_bind final {
|
||||||
public:
|
public:
|
||||||
explicit function_bind(type_opts opts);
|
explicit function_bind(metadata_map metadata);
|
||||||
operator function_type() const noexcept;
|
operator function_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::function_type_data_ptr data_;
|
detail::function_type_data_ptr data_;
|
||||||
@@ -255,7 +247,7 @@ namespace meta_hpp
|
|||||||
template < detail::member_kind Member >
|
template < detail::member_kind Member >
|
||||||
class member_bind final {
|
class member_bind final {
|
||||||
public:
|
public:
|
||||||
explicit member_bind(type_opts opts);
|
explicit member_bind(metadata_map metadata);
|
||||||
operator member_type() const noexcept;
|
operator member_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::member_type_data_ptr data_;
|
detail::member_type_data_ptr data_;
|
||||||
@@ -267,7 +259,7 @@ namespace meta_hpp
|
|||||||
template < detail::method_kind Method >
|
template < detail::method_kind Method >
|
||||||
class method_bind final {
|
class method_bind final {
|
||||||
public:
|
public:
|
||||||
explicit method_bind(type_opts opts);
|
explicit method_bind(metadata_map metadata);
|
||||||
operator method_type() const noexcept;
|
operator method_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::method_type_data_ptr data_;
|
detail::method_type_data_ptr data_;
|
||||||
@@ -279,7 +271,7 @@ namespace meta_hpp
|
|||||||
template < detail::nullptr_kind Nullptr >
|
template < detail::nullptr_kind Nullptr >
|
||||||
class nullptr_bind final {
|
class nullptr_bind final {
|
||||||
public:
|
public:
|
||||||
explicit nullptr_bind(type_opts opts);
|
explicit nullptr_bind(metadata_map metadata);
|
||||||
operator nullptr_type() const noexcept;
|
operator nullptr_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::nullptr_type_data_ptr data_;
|
detail::nullptr_type_data_ptr data_;
|
||||||
@@ -291,7 +283,7 @@ namespace meta_hpp
|
|||||||
template < detail::number_kind Number >
|
template < detail::number_kind Number >
|
||||||
class number_bind final {
|
class number_bind final {
|
||||||
public:
|
public:
|
||||||
explicit number_bind(type_opts opts);
|
explicit number_bind(metadata_map metadata);
|
||||||
operator number_type() const noexcept;
|
operator number_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::number_type_data_ptr data_;
|
detail::number_type_data_ptr data_;
|
||||||
@@ -303,7 +295,7 @@ namespace meta_hpp
|
|||||||
template < detail::pointer_kind Pointer >
|
template < detail::pointer_kind Pointer >
|
||||||
class pointer_bind final {
|
class pointer_bind final {
|
||||||
public:
|
public:
|
||||||
explicit pointer_bind(type_opts opts);
|
explicit pointer_bind(metadata_map metadata);
|
||||||
operator pointer_type() const noexcept;
|
operator pointer_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::pointer_type_data_ptr data_;
|
detail::pointer_type_data_ptr data_;
|
||||||
@@ -315,7 +307,7 @@ namespace meta_hpp
|
|||||||
template < detail::reference_kind Reference >
|
template < detail::reference_kind Reference >
|
||||||
class reference_bind final {
|
class reference_bind final {
|
||||||
public:
|
public:
|
||||||
explicit reference_bind(type_opts opts);
|
explicit reference_bind(metadata_map metadata);
|
||||||
operator reference_type() const noexcept;
|
operator reference_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::reference_type_data_ptr data_;
|
detail::reference_type_data_ptr data_;
|
||||||
@@ -327,7 +319,7 @@ namespace meta_hpp
|
|||||||
template < detail::void_kind Void >
|
template < detail::void_kind Void >
|
||||||
class void_bind final {
|
class void_bind final {
|
||||||
public:
|
public:
|
||||||
explicit void_bind(type_opts opts);
|
explicit void_bind(metadata_map metadata);
|
||||||
operator void_type() const noexcept;
|
operator void_type() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::void_type_data_ptr data_;
|
detail::void_type_data_ptr data_;
|
||||||
@@ -341,8 +333,8 @@ namespace meta_hpp
|
|||||||
struct local_tag {};
|
struct local_tag {};
|
||||||
struct static_tag {};
|
struct static_tag {};
|
||||||
|
|
||||||
explicit scope_bind(std::string name, scope_opts opts, local_tag);
|
explicit scope_bind(std::string name, metadata_map metadata, local_tag);
|
||||||
explicit scope_bind(std::string_view name, scope_opts opts, static_tag);
|
explicit scope_bind(std::string_view name, metadata_map metadata, static_tag);
|
||||||
operator scope() const noexcept;
|
operator scope() const noexcept;
|
||||||
|
|
||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
@@ -400,68 +392,68 @@ namespace meta_hpp
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::array_kind Array >
|
template < detail::array_kind Array >
|
||||||
array_bind<Array> array_(type_opts opts = {}) {
|
array_bind<Array> array_(metadata_map metadata = {}) {
|
||||||
return array_bind<Array>{std::move(opts)};
|
return array_bind<Array>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
class_bind<Class> class_(type_opts opts = {}) {
|
class_bind<Class> class_(metadata_map metadata = {}) {
|
||||||
return class_bind<Class>{std::move(opts)};
|
return class_bind<Class>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::enum_kind Enum >
|
template < detail::enum_kind Enum >
|
||||||
enum_bind<Enum> enum_(type_opts opts = {}) {
|
enum_bind<Enum> enum_(metadata_map metadata = {}) {
|
||||||
return enum_bind<Enum>{std::move(opts)};
|
return enum_bind<Enum>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::function_kind Function >
|
template < detail::function_kind Function >
|
||||||
function_bind<Function> function_(type_opts opts = {}) {
|
function_bind<Function> function_(metadata_map metadata = {}) {
|
||||||
return function_bind<Function>{std::move(opts)};
|
return function_bind<Function>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::member_kind Member >
|
template < detail::member_kind Member >
|
||||||
member_bind<Member> member_(type_opts opts = {}) {
|
member_bind<Member> member_(metadata_map metadata = {}) {
|
||||||
return member_bind<Member>{std::move(opts)};
|
return member_bind<Member>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::method_kind Method >
|
template < detail::method_kind Method >
|
||||||
method_bind<Method> method_(type_opts opts = {}) {
|
method_bind<Method> method_(metadata_map metadata = {}) {
|
||||||
return method_bind<Method>{std::move(opts)};
|
return method_bind<Method>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::nullptr_kind Nullptr >
|
template < detail::nullptr_kind Nullptr >
|
||||||
nullptr_bind<Nullptr> nullptr_(type_opts opts = {}) {
|
nullptr_bind<Nullptr> nullptr_(metadata_map metadata = {}) {
|
||||||
return nullptr_bind<Nullptr>{std::move(opts)};
|
return nullptr_bind<Nullptr>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::number_kind Number >
|
template < detail::number_kind Number >
|
||||||
number_bind<Number> number_(type_opts opts = {}) {
|
number_bind<Number> number_(metadata_map metadata = {}) {
|
||||||
return number_bind<Number>{std::move(opts)};
|
return number_bind<Number>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::pointer_kind Pointer >
|
template < detail::pointer_kind Pointer >
|
||||||
pointer_bind<Pointer> pointer_(type_opts opts = {}) {
|
pointer_bind<Pointer> pointer_(metadata_map metadata = {}) {
|
||||||
return pointer_bind<Pointer>{std::move(opts)};
|
return pointer_bind<Pointer>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::reference_kind Reference >
|
template < detail::reference_kind Reference >
|
||||||
reference_bind<Reference> reference_(type_opts opts = {}) {
|
reference_bind<Reference> reference_(metadata_map metadata = {}) {
|
||||||
return reference_bind<Reference>{std::move(opts)};
|
return reference_bind<Reference>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::void_kind Void >
|
template < detail::void_kind Void >
|
||||||
void_bind<Void> void_(type_opts opts = {}) {
|
void_bind<Void> void_(metadata_map metadata = {}) {
|
||||||
return void_bind<Void>{std::move(opts)};
|
return void_bind<Void>{std::move(metadata)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
inline scope_bind local_scope_(std::string name, scope_opts opts = {}) {
|
inline scope_bind local_scope_(std::string name, metadata_map metadata = {}) {
|
||||||
return scope_bind{std::move(name), std::move(opts), scope_bind::local_tag()};
|
return scope_bind{std::move(name), std::move(metadata), scope_bind::local_tag()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline scope_bind static_scope_(std::string_view name, scope_opts opts = {}) {
|
inline scope_bind static_scope_(std::string_view name, metadata_map metadata = {}) {
|
||||||
return scope_bind{name, std::move(opts), scope_bind::static_tag()};
|
return scope_bind{name, std::move(metadata), scope_bind::static_tag()};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::array_kind Array >
|
template < detail::array_kind Array >
|
||||||
array_bind<Array>::array_bind(type_opts opts)
|
array_bind<Array>::array_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Array>())} {
|
: data_{detail::type_access(detail::resolve_type<Array>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::array_kind Array >
|
template < detail::array_kind Array >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
class_bind<Class>::class_bind(type_opts opts)
|
class_bind<Class>::class_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Class>())} {
|
: data_{detail::type_access(detail::resolve_type<Class>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::class_kind Class >
|
template < detail::class_kind Class >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::enum_kind Enum >
|
template < detail::enum_kind Enum >
|
||||||
enum_bind<Enum>::enum_bind(type_opts opts)
|
enum_bind<Enum>::enum_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Enum>())} {
|
: data_{detail::type_access(detail::resolve_type<Enum>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::enum_kind Enum >
|
template < detail::enum_kind Enum >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::function_kind Function >
|
template < detail::function_kind Function >
|
||||||
function_bind<Function>::function_bind(type_opts opts)
|
function_bind<Function>::function_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Function>())} {
|
: data_{detail::type_access(detail::resolve_type<Function>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::function_kind Function >
|
template < detail::function_kind Function >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::member_kind Member >
|
template < detail::member_kind Member >
|
||||||
member_bind<Member>::member_bind(type_opts opts)
|
member_bind<Member>::member_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Member>())} {
|
: data_{detail::type_access(detail::resolve_type<Member>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::member_kind Member >
|
template < detail::member_kind Member >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::method_kind Method >
|
template < detail::method_kind Method >
|
||||||
method_bind<Method>::method_bind(type_opts opts)
|
method_bind<Method>::method_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Method>())} {
|
: data_{detail::type_access(detail::resolve_type<Method>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::method_kind Method >
|
template < detail::method_kind Method >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::nullptr_kind Nullptr >
|
template < detail::nullptr_kind Nullptr >
|
||||||
nullptr_bind<Nullptr>::nullptr_bind(type_opts opts)
|
nullptr_bind<Nullptr>::nullptr_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Nullptr>())} {
|
: data_{detail::type_access(detail::resolve_type<Nullptr>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::nullptr_kind Nullptr >
|
template < detail::nullptr_kind Nullptr >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::number_kind Number >
|
template < detail::number_kind Number >
|
||||||
number_bind<Number>::number_bind(type_opts opts)
|
number_bind<Number>::number_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Number>())} {
|
: data_{detail::type_access(detail::resolve_type<Number>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::number_kind Number >
|
template < detail::number_kind Number >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::pointer_kind Pointer >
|
template < detail::pointer_kind Pointer >
|
||||||
pointer_bind<Pointer>::pointer_bind(type_opts opts)
|
pointer_bind<Pointer>::pointer_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Pointer>())} {
|
: data_{detail::type_access(detail::resolve_type<Pointer>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::pointer_kind Pointer >
|
template < detail::pointer_kind Pointer >
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::reference_kind Reference >
|
template < detail::reference_kind Reference >
|
||||||
reference_bind<Reference>::reference_bind(type_opts opts)
|
reference_bind<Reference>::reference_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<Reference>())} {
|
: data_{detail::type_access(detail::resolve_type<Reference>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::reference_kind Reference >
|
template < detail::reference_kind Reference >
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
// NOLINTNEXTLINE(readability-named-parameter)
|
// NOLINTNEXTLINE(readability-named-parameter)
|
||||||
inline scope_bind::scope_bind(std::string name, scope_opts opts, local_tag)
|
inline scope_bind::scope_bind(std::string name, metadata_map metadata, local_tag)
|
||||||
: state_{detail::scope_state::make(std::move(name), std::move(opts.metadata))} {}
|
: state_{detail::scope_state::make(std::move(name), std::move(metadata))} {}
|
||||||
|
|
||||||
// NOLINTNEXTLINE(readability-named-parameter)
|
// NOLINTNEXTLINE(readability-named-parameter)
|
||||||
inline scope_bind::scope_bind(std::string_view name, scope_opts opts, static_tag)
|
inline scope_bind::scope_bind(std::string_view name, metadata_map metadata, static_tag)
|
||||||
: state_{detail::state_access(detail::resolve_scope(name))} {
|
: state_{detail::state_access(detail::resolve_scope(name))} {
|
||||||
state_->metadata.swap(opts.metadata);
|
state_->metadata.swap(metadata);
|
||||||
state_->metadata.merge(opts.metadata);
|
state_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline scope_bind::operator scope() const noexcept {
|
inline scope_bind::operator scope() const noexcept {
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < detail::void_kind Void >
|
template < detail::void_kind Void >
|
||||||
void_bind<Void>::void_bind(type_opts opts)
|
void_bind<Void>::void_bind(metadata_map metadata)
|
||||||
: data_{detail::type_access(detail::resolve_type<void>())} {
|
: data_{detail::type_access(detail::resolve_type<void>())} {
|
||||||
data_->metadata.swap(opts.metadata);
|
data_->metadata.swap(metadata);
|
||||||
data_->metadata.merge(opts.metadata);
|
data_->metadata.merge(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < detail::void_kind Void >
|
template < detail::void_kind Void >
|
||||||
|
|||||||
@@ -38,10 +38,8 @@ TEST_CASE("meta/meta_states/metadata/enum") {
|
|||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
meta::enum_<color>({
|
meta::enum_<color>({
|
||||||
.metadata{
|
{"desc1", meta::uvalue{"enum-desc1"s}},
|
||||||
{"desc1", meta::uvalue{"enum-desc1"s}},
|
{"desc2", meta::uvalue{"enum-desc2"s}},
|
||||||
{"desc2", meta::uvalue{"enum-desc2"s}},
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.evalue_("red", color::red, {
|
.evalue_("red", color::red, {
|
||||||
.metadata{{"desc1", meta::uvalue{"red-color"s}}}
|
.metadata{{"desc1", meta::uvalue{"red-color"s}}}
|
||||||
@@ -56,10 +54,8 @@ TEST_CASE("meta/meta_states/metadata/enum") {
|
|||||||
// metadata override
|
// metadata override
|
||||||
|
|
||||||
meta::enum_<color>({
|
meta::enum_<color>({
|
||||||
.metadata{
|
{"desc2", meta::uvalue{"new-enum-desc2"s}},
|
||||||
{"desc2", meta::uvalue{"new-enum-desc2"s}},
|
{"desc3", meta::uvalue{"new-enum-desc3"s}},
|
||||||
{"desc3", meta::uvalue{"new-enum-desc3"s}},
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
meta::enum_<color>()
|
meta::enum_<color>()
|
||||||
@@ -93,10 +89,8 @@ TEST_CASE("meta/meta_states/metadata/class") {
|
|||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
meta::class_<ivec2>({
|
meta::class_<ivec2>({
|
||||||
.metadata{
|
{"desc1", meta::uvalue{"class-desc1"s}},
|
||||||
{"desc1", meta::uvalue{"class-desc1"s}},
|
{"desc2", meta::uvalue{"class-desc2"s}},
|
||||||
{"desc2", meta::uvalue{"class-desc2"s}},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.constructor_<int>({
|
.constructor_<int>({
|
||||||
.arguments{{
|
.arguments{{
|
||||||
@@ -142,10 +136,8 @@ TEST_CASE("meta/meta_states/metadata/class") {
|
|||||||
// metadata override
|
// metadata override
|
||||||
|
|
||||||
meta::class_<ivec2>({
|
meta::class_<ivec2>({
|
||||||
.metadata{
|
{"desc2", meta::uvalue{"new-class-desc2"s}},
|
||||||
{"desc2", meta::uvalue{"new-class-desc2"s}},
|
{"desc3", meta::uvalue{"new-class-desc3"s}},
|
||||||
{"desc3", meta::uvalue{"new-class-desc3"s}},
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -245,87 +237,88 @@ TEST_CASE("meta/meta_states/metadata/class") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("meta/meta_states/metadata/scope") {
|
||||||
|
namespace meta = meta_hpp;
|
||||||
|
using namespace std::string_literals;
|
||||||
|
|
||||||
|
SUBCASE("local_scope") {
|
||||||
|
const meta::scope lscope = meta::local_scope_("local-scope", {
|
||||||
|
{"desc", meta::uvalue{"scope-desc"s}}
|
||||||
|
});
|
||||||
|
CHECK(lscope.get_metadata().at("desc") == "scope-desc"s);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("static_scope") {
|
||||||
|
meta::static_scope_("meta/meta_states/metadata/scope/static-scope", {
|
||||||
|
{"desc", meta::uvalue{"scope-desc"s}}
|
||||||
|
});
|
||||||
|
CHECK(meta::resolve_scope("meta/meta_states/metadata/scope/static-scope").get_metadata().at("desc") == "scope-desc"s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("meta/meta_states/metadata/other") {
|
TEST_CASE("meta/meta_states/metadata/other") {
|
||||||
namespace meta = meta_hpp;
|
namespace meta = meta_hpp;
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
SUBCASE("array") {
|
SUBCASE("array") {
|
||||||
meta::array_<int[]>({
|
meta::array_<int[]>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"int[]-type"s}}
|
||||||
{"desc", meta::uvalue{"int[]-type"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<int[]>().get_metadata().at("desc") == "int[]-type"s);
|
CHECK(meta::resolve_type<int[]>().get_metadata().at("desc") == "int[]-type"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("function") {
|
SUBCASE("function") {
|
||||||
meta::function_<int(*)(int)>({
|
meta::function_<int(*)(int)>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"int->int"s}}
|
||||||
{"desc", meta::uvalue{"int->int"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<int(*)(int)>().get_metadata().at("desc") == "int->int"s);
|
CHECK(meta::resolve_type<int(*)(int)>().get_metadata().at("desc") == "int->int"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("member") {
|
SUBCASE("member") {
|
||||||
meta::member_<int ivec2::*>({
|
meta::member_<int ivec2::*>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"ivec2::int"s}}
|
||||||
{"desc", meta::uvalue{"ivec2::int"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<int ivec2::*>().get_metadata().at("desc") == "ivec2::int"s);
|
CHECK(meta::resolve_type<int ivec2::*>().get_metadata().at("desc") == "ivec2::int"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("method") {
|
SUBCASE("method") {
|
||||||
meta::method_<int (ivec2::*)(int)>({
|
meta::method_<int (ivec2::*)(int)>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"ivec2(int -> int)"s}}
|
||||||
{"desc", meta::uvalue{"ivec2(int -> int)"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<int (ivec2::*)(int)>().get_metadata().at("desc") == "ivec2(int -> int)"s);
|
CHECK(meta::resolve_type<int (ivec2::*)(int)>().get_metadata().at("desc") == "ivec2(int -> int)"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("nullptr") {
|
SUBCASE("nullptr") {
|
||||||
meta::nullptr_<std::nullptr_t>({
|
meta::nullptr_<std::nullptr_t>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"nullptr_t"s}}
|
||||||
{"desc", meta::uvalue{"nullptr_t"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<std::nullptr_t>().get_metadata().at("desc") == "nullptr_t"s);
|
CHECK(meta::resolve_type<std::nullptr_t>().get_metadata().at("desc") == "nullptr_t"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("number") {
|
SUBCASE("number") {
|
||||||
meta::number_<int>({
|
meta::number_<int>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"int-type"s}}
|
||||||
{"desc", meta::uvalue{"int-type"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<int>().get_metadata().at("desc") == "int-type"s);
|
CHECK(meta::resolve_type<int>().get_metadata().at("desc") == "int-type"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("pointer") {
|
SUBCASE("pointer") {
|
||||||
meta::pointer_<int*>({
|
meta::pointer_<int*>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"int*-type"s}}
|
||||||
{"desc", meta::uvalue{"int*-type"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<int*>().get_metadata().at("desc") == "int*-type"s);
|
CHECK(meta::resolve_type<int*>().get_metadata().at("desc") == "int*-type"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("reference") {
|
SUBCASE("reference") {
|
||||||
meta::reference_<int&>({
|
meta::reference_<int&>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"int&-type"s}}
|
||||||
{"desc", meta::uvalue{"int&-type"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<int&>().get_metadata().at("desc") == "int&-type"s);
|
CHECK(meta::resolve_type<int&>().get_metadata().at("desc") == "int&-type"s);
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("void") {
|
SUBCASE("void") {
|
||||||
meta::void_<void>({
|
meta::void_<void>({
|
||||||
.metadata{
|
{"desc", meta::uvalue{"void-type"s}}
|
||||||
{"desc", meta::uvalue{"void-type"s}}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
CHECK(meta::resolve_type<void>().get_metadata().at("desc") == "void-type"s);
|
CHECK(meta::resolve_type<void>().get_metadata().at("desc") == "void-type"s);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user