mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
dummy info registration
This commit is contained in:
@@ -9,3 +9,4 @@
|
||||
#include "meta_fwd.hpp"
|
||||
#include "meta_infos.hpp"
|
||||
#include "meta_registry.hpp"
|
||||
#include "meta_utilities.hpp"
|
||||
|
||||
@@ -52,3 +52,19 @@ namespace meta_hpp
|
||||
template < typename Method > class method_;
|
||||
class namespace_;
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename K, typename V >
|
||||
using info_map = std::map<K, V, std::less<>>;
|
||||
|
||||
using class_info_map = info_map<std::string, class_info>;
|
||||
using ctor_info_map = info_map<std::string, ctor_info>;
|
||||
using data_info_map = info_map<std::string, data_info>;
|
||||
using enum_info_map = info_map<std::string, enum_info>;
|
||||
using evalue_info_map = info_map<std::string, evalue_info>;
|
||||
using function_info_map = info_map<std::string, function_info>;
|
||||
using member_info_map = info_map<std::string, member_info>;
|
||||
using method_info_map = info_map<std::string, method_info>;
|
||||
using namespace_info_map = info_map<std::string, namespace_info>;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class class_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class ctor_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class data_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class enum_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class evalue_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class function_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class member_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class method_info final {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class namespace_info final {
|
||||
|
||||
@@ -33,5 +33,134 @@ namespace meta_hpp
|
||||
member_info get_member_by_name(std::string_view name) const noexcept;
|
||||
method_info get_method_by_name(std::string_view name) const noexcept;
|
||||
namespace_info get_namespace_by_name(std::string_view name) const noexcept;
|
||||
public:
|
||||
template < typename... Internals >
|
||||
registry& operator()(Internals&&... internals);
|
||||
private:
|
||||
template < typename Class >
|
||||
void add_(const std::string& prefix, const class_<Class>& internal);
|
||||
void add_(const std::string& prefix, const data_& internal);
|
||||
template < typename Enum >
|
||||
void add_(const std::string& prefix, const enum_<Enum>& internal);
|
||||
template < typename Function >
|
||||
void add_(const std::string& prefix, const function_<Function>& internal);
|
||||
template < typename Member >
|
||||
void add_(const std::string& prefix, const member_<Member>& internal);
|
||||
template < typename Method >
|
||||
void add_(const std::string& prefix, const method_<Method>& internal);
|
||||
void add_(const std::string& prefix, const namespace_& internal);
|
||||
void add_(const std::string& prefix, ...) = delete;
|
||||
private:
|
||||
void add_info_(const std::string& prefix, const class_info& info);
|
||||
void add_info_(const std::string& prefix, const ctor_info& info);
|
||||
void add_info_(const std::string& prefix, const data_info& info);
|
||||
void add_info_(const std::string& prefix, const enum_info& info);
|
||||
void add_info_(const std::string& prefix, const evalue_info& info);
|
||||
void add_info_(const std::string& prefix, const function_info& info);
|
||||
void add_info_(const std::string& prefix, const member_info& info);
|
||||
void add_info_(const std::string& prefix, const method_info& info);
|
||||
void add_info_(const std::string& prefix, const namespace_info& info);
|
||||
private:
|
||||
class_info_map classes_;
|
||||
data_info_map datas_;
|
||||
enum_info_map enums_;
|
||||
evalue_info_map evalues_;
|
||||
function_info_map functions_;
|
||||
member_info_map members_;
|
||||
method_info_map methods_;
|
||||
namespace_info_map namespaces_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename... Internals >
|
||||
inline registry& registry::operator()(Internals&&... internals) {
|
||||
(add_(std::string{}, std::forward<Internals>(internals)), ...);
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Class >
|
||||
inline void registry::add_(const std::string& prefix, const class_<Class>& internal) {
|
||||
add_info_(prefix, internal.make_info());
|
||||
}
|
||||
|
||||
inline void registry::add_(const std::string& prefix, const data_& internal) {
|
||||
add_info_(prefix, internal.make_info());
|
||||
}
|
||||
|
||||
template < typename Enum >
|
||||
inline void registry::add_(const std::string& prefix, const enum_<Enum>& internal) {
|
||||
add_info_(prefix, internal.make_info());
|
||||
}
|
||||
|
||||
template < typename Function >
|
||||
inline void registry::add_(const std::string& prefix, const function_<Function>& internal) {
|
||||
add_info_(prefix, internal.make_info());
|
||||
}
|
||||
|
||||
template < typename Member >
|
||||
inline void registry::add_(const std::string& prefix, const member_<Member>& internal) {
|
||||
add_info_(prefix, internal.make_info());
|
||||
}
|
||||
|
||||
template < typename Method >
|
||||
inline void registry::add_(const std::string& prefix, const method_<Method>& internal) {
|
||||
add_info_(prefix, internal.make_info());
|
||||
}
|
||||
|
||||
inline void registry::add_(const std::string& prefix, const namespace_& internal) {
|
||||
add_info_(prefix, internal.make_info());
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline void registry::add_info_(const std::string& prefix, const class_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const ctor_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const data_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const enum_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const evalue_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const function_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const member_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const method_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
|
||||
inline void registry::add_info_(const std::string& prefix, const namespace_info& info) {
|
||||
(void)prefix;
|
||||
(void)info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,32 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/class_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Class >
|
||||
class class_ final {
|
||||
public:
|
||||
explicit class_(std::string name);
|
||||
|
||||
class_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Class >
|
||||
inline class_<Class>::class_(std::string name)
|
||||
: name_{std::move(name)} {}
|
||||
|
||||
template < typename Class >
|
||||
inline class_info class_<Class>::make_info() const {
|
||||
return class_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/ctor_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename... Args >
|
||||
class ctor_ final {
|
||||
public:
|
||||
explicit ctor_() = default;
|
||||
|
||||
template < typename Class >
|
||||
ctor_info make_info() const;
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename... Args >
|
||||
template < typename Class >
|
||||
inline ctor_info ctor_<Args...>::make_info() const {
|
||||
return ctor_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/data_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class data_ final {
|
||||
public:
|
||||
explicit data_(std::string name, class value value);
|
||||
|
||||
data_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
class value value_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline data_::data_(std::string name, class value value)
|
||||
: name_{std::move(name)}
|
||||
, value_{std::move(value)} {}
|
||||
|
||||
inline data_info data_::make_info() const {
|
||||
return data_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,32 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/enum_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
class enum_ final {
|
||||
public:
|
||||
explicit enum_(std::string name);
|
||||
|
||||
enum_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline enum_<Enum>::enum_(std::string name)
|
||||
: name_{std::move(name)} {}
|
||||
|
||||
template < typename Enum >
|
||||
inline enum_info enum_<Enum>::make_info() const {
|
||||
return enum_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,34 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/evalue_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
class evalue_ final {
|
||||
public:
|
||||
explicit evalue_(std::string name, Enum value);
|
||||
|
||||
evalue_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
Enum value_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Enum >
|
||||
inline evalue_<Enum>::evalue_(std::string name, Enum value)
|
||||
: name_{std::move(name)}
|
||||
, value_{std::move(value)} {}
|
||||
|
||||
template < typename Enum >
|
||||
inline evalue_info evalue_<Enum>::make_info() const {
|
||||
return evalue_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,34 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/function_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Function >
|
||||
class function_ final {
|
||||
public:
|
||||
explicit function_(std::string name, Function instance);
|
||||
|
||||
function_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
Function instance_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Function >
|
||||
inline function_<Function>::function_(std::string name, Function instance)
|
||||
: name_{std::move(name)}
|
||||
, instance_{std::move(instance)} {}
|
||||
|
||||
template < typename Function >
|
||||
inline function_info function_<Function>::make_info() const {
|
||||
return function_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,34 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/member_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Member >
|
||||
class member_ final {
|
||||
public:
|
||||
explicit member_(std::string name, Member instance);
|
||||
|
||||
member_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
Member instance_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Member >
|
||||
inline member_<Member>::member_(std::string name, Member instance)
|
||||
: name_{std::move(name)}
|
||||
, instance_{std::move(instance)} {}
|
||||
|
||||
template < typename Member >
|
||||
inline member_info member_<Member>::make_info() const {
|
||||
return member_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,34 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/method_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Method >
|
||||
class method_ final {
|
||||
public:
|
||||
explicit method_(std::string name, Method instance);
|
||||
|
||||
method_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
Method instance_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < typename Method >
|
||||
inline method_<Method>::method_(std::string name, Method instance)
|
||||
: name_{std::move(name)}
|
||||
, instance_{std::move(instance)} {}
|
||||
|
||||
template < typename Method >
|
||||
inline method_info method_<Method>::make_info() const {
|
||||
return method_info{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
#include "../meta_utilities.hpp"
|
||||
|
||||
#include "../meta_infos/namespace_info.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class namespace_ final {
|
||||
public:
|
||||
explicit namespace_(std::string name);
|
||||
|
||||
namespace_info make_info() const;
|
||||
private:
|
||||
std::string name_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
inline namespace_::namespace_(std::string name)
|
||||
: name_{std::move(name)} {}
|
||||
|
||||
inline namespace_info namespace_::make_info() const {
|
||||
return namespace_info{};
|
||||
}
|
||||
}
|
||||
|
||||
11
headers/meta.hpp/meta_utilities.hpp
Normal file
11
headers/meta.hpp/meta_utilities.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/meta.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "meta_fwd.hpp"
|
||||
|
||||
#include "meta_utilities/value.hpp"
|
||||
23
headers/meta.hpp/meta_utilities/value.hpp
Normal file
23
headers/meta.hpp/meta_utilities/value.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/meta.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../meta_fwd.hpp"
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
class value final {
|
||||
public:
|
||||
value() = delete;
|
||||
|
||||
value(value&&) = default;
|
||||
value& operator=(value&&) = default;
|
||||
|
||||
value(const value&) = default;
|
||||
value& operator=(const value&) = default;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user