mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 11:52:08 +07:00
public info merge functions
This commit is contained in:
@@ -39,27 +39,27 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const class_info& info) {
|
void add_(const class_info& info) {
|
||||||
detail::merge_with(info_.classes_, info.id(), info, &class_info::merge_with_);
|
detail::merge_with(info_.classes_, info.id(), info, &class_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const data_info& info) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const field_info& info) {
|
void add_(const field_info& info) {
|
||||||
detail::merge_with(info_.fields_, info.id(), info, &field_info::merge_with_);
|
detail::merge_with(info_.fields_, info.id(), info, &field_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const function_info& info) {
|
void add_(const function_info& info) {
|
||||||
detail::merge_with(info_.functions_, info.id(), info, &function_info::merge_with_);
|
detail::merge_with(info_.functions_, info.id(), info, &function_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const method_info& info) {
|
void add_(const method_info& info) {
|
||||||
detail::merge_with(info_.methods_, info.id(), info, &method_info::merge_with_);
|
detail::merge_with(info_.methods_, info.id(), info, &method_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const variable_info& info) {
|
void add_(const variable_info& info) {
|
||||||
detail::merge_with(info_.variables_, info.id(), info, &variable_info::merge_with_);
|
detail::merge_with(info_.variables_, info.id(), info, &variable_info::merge);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
class_info info_;
|
class_info info_;
|
||||||
|
|||||||
@@ -104,23 +104,21 @@ namespace meta_hpp
|
|||||||
std::optional<variable_info> get_variable(std::string_view id) const {
|
std::optional<variable_info> get_variable(std::string_view id) const {
|
||||||
return detail::find_opt(variables_, id);
|
return detail::find_opt(variables_, id);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
friend class namespace_info;
|
|
||||||
|
|
||||||
template < typename Class > friend class class_;
|
void merge(const class_info& other) {
|
||||||
friend class namespace_;
|
|
||||||
private:
|
|
||||||
void merge_with_(const class_info& other) {
|
|
||||||
if ( fid() != other.fid() ) {
|
if ( fid() != other.fid() ) {
|
||||||
throw std::logic_error("class_info::merge failed");
|
throw std::logic_error("class_info::merge failed");
|
||||||
}
|
}
|
||||||
detail::merge_with(classes_, other.classes_, &class_info::merge_with_);
|
detail::merge_with(classes_, other.classes_, &class_info::merge);
|
||||||
detail::merge_with(datas_, other.datas_, &data_info::merge_with_);
|
detail::merge_with(datas_, other.datas_, &data_info::merge);
|
||||||
detail::merge_with(fields_, other.fields_, &field_info::merge_with_);
|
detail::merge_with(fields_, other.fields_, &field_info::merge);
|
||||||
detail::merge_with(functions_, other.functions_, &function_info::merge_with_);
|
detail::merge_with(functions_, other.functions_, &function_info::merge);
|
||||||
detail::merge_with(methods_, other.methods_, &method_info::merge_with_);
|
detail::merge_with(methods_, other.methods_, &method_info::merge);
|
||||||
detail::merge_with(variables_, other.variables_, &variable_info::merge_with_);
|
detail::merge_with(variables_, other.variables_, &variable_info::merge);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
template < typename Class >
|
||||||
|
friend class class_;
|
||||||
private:
|
private:
|
||||||
family_id fid_;
|
family_id fid_;
|
||||||
std::string id_;
|
std::string id_;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_info& info) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
data_info info_;
|
data_info info_;
|
||||||
|
|||||||
@@ -43,27 +43,13 @@ namespace meta_hpp
|
|||||||
std::optional<data_info> get_data(std::string_view id) const {
|
std::optional<data_info> get_data(std::string_view id) const {
|
||||||
return detail::find_opt(datas_, id);
|
return detail::find_opt(datas_, id);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
friend class class_info;
|
|
||||||
friend class field_info;
|
|
||||||
friend class function_info;
|
|
||||||
friend class method_info;
|
|
||||||
friend class namespace_info;
|
|
||||||
friend class variable_info;
|
|
||||||
|
|
||||||
template < typename Class > friend class class_;
|
void merge(const data_info& other) {
|
||||||
template < auto Field > friend class field_;
|
|
||||||
template < auto Function > friend class function_;
|
|
||||||
template < auto Method > friend class method_;
|
|
||||||
friend class namespace_;
|
|
||||||
template < auto Variable > friend class variable_;
|
|
||||||
|
|
||||||
friend class data_;
|
|
||||||
private:
|
|
||||||
void merge_with_(const data_info& other) {
|
|
||||||
value_ = other.value_;
|
value_ = other.value_;
|
||||||
detail::merge_with(datas_, other.datas_, &data_info::merge_with_);
|
detail::merge_with(datas_, other.datas_, &data_info::merge);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
friend class data_;
|
||||||
private:
|
private:
|
||||||
std::string id_;
|
std::string id_;
|
||||||
value value_;
|
value value_;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_info& info) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
field_info info_;
|
field_info info_;
|
||||||
|
|||||||
@@ -98,18 +98,16 @@ namespace meta_hpp
|
|||||||
std::optional<data_info> get_data(std::string_view id) const {
|
std::optional<data_info> get_data(std::string_view id) const {
|
||||||
return detail::find_opt(datas_, id);
|
return detail::find_opt(datas_, id);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
friend class class_info;
|
|
||||||
|
|
||||||
template < typename Class > friend class class_;
|
void merge(const field_info& other) {
|
||||||
template < auto Field > friend class field_;
|
|
||||||
private:
|
|
||||||
void merge_with_(const field_info& other) {
|
|
||||||
if ( fid() != other.fid() ) {
|
if ( fid() != other.fid() ) {
|
||||||
throw std::logic_error("field_info::merge failed");
|
throw std::logic_error("field_info::merge failed");
|
||||||
}
|
}
|
||||||
detail::merge_with(datas_, other.datas_, &data_info::merge_with_);
|
detail::merge_with(datas_, other.datas_, &data_info::merge);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
template < auto Field >
|
||||||
|
friend class field_;
|
||||||
private:
|
private:
|
||||||
family_id fid_;
|
family_id fid_;
|
||||||
std::string id_;
|
std::string id_;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_info& info) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
function_info info_;
|
function_info info_;
|
||||||
|
|||||||
@@ -103,21 +103,16 @@ namespace meta_hpp
|
|||||||
std::optional<data_info> get_data(std::string_view id) const {
|
std::optional<data_info> get_data(std::string_view id) const {
|
||||||
return detail::find_opt(datas_, id);
|
return detail::find_opt(datas_, id);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
friend class class_info;
|
|
||||||
friend class namespace_info;
|
|
||||||
|
|
||||||
template < typename Class > friend class class_;
|
void merge(const function_info& other) {
|
||||||
friend class namespace_;
|
|
||||||
|
|
||||||
template < auto Function > friend class function_;
|
|
||||||
private:
|
|
||||||
void merge_with_(const function_info& other) {
|
|
||||||
if ( fid() != other.fid() ) {
|
if ( fid() != other.fid() ) {
|
||||||
throw std::logic_error("function_info::merge failed");
|
throw std::logic_error("function_info::merge failed");
|
||||||
}
|
}
|
||||||
detail::merge_with(datas_, other.datas_, &data_info::merge_with_);
|
detail::merge_with(datas_, other.datas_, &data_info::merge);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
template < auto Function >
|
||||||
|
friend class function_;
|
||||||
private:
|
private:
|
||||||
family_id fid_;
|
family_id fid_;
|
||||||
std::string id_;
|
std::string id_;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_info& info) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
method_info info_;
|
method_info info_;
|
||||||
|
|||||||
@@ -165,17 +165,16 @@ namespace meta_hpp
|
|||||||
std::optional<data_info> get_data(std::string_view id) const {
|
std::optional<data_info> get_data(std::string_view id) const {
|
||||||
return detail::find_opt(datas_, id);
|
return detail::find_opt(datas_, id);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
friend class class_info;
|
void merge(const method_info& other) {
|
||||||
template < typename Class > friend class class_;
|
|
||||||
template < auto Method > friend class method_;
|
|
||||||
private:
|
|
||||||
void merge_with_(const method_info& other) {
|
|
||||||
if ( fid() != other.fid() ) {
|
if ( fid() != other.fid() ) {
|
||||||
throw std::logic_error("method_info::merge failed");
|
throw std::logic_error("method_info::merge failed");
|
||||||
}
|
}
|
||||||
detail::merge_with(datas_, other.datas_, &data_info::merge_with_);
|
detail::merge_with(datas_, other.datas_, &data_info::merge);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
template < auto Method >
|
||||||
|
friend class method_;
|
||||||
private:
|
private:
|
||||||
family_id fid_;
|
family_id fid_;
|
||||||
std::string id_;
|
std::string id_;
|
||||||
|
|||||||
@@ -37,23 +37,23 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const class_info& info) {
|
void add_(const class_info& info) {
|
||||||
detail::merge_with(info_.classes_, info.id(), info, &class_info::merge_with_);
|
detail::merge_with(info_.classes_, info.id(), info, &class_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const data_info& info) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const function_info& info) {
|
void add_(const function_info& info) {
|
||||||
detail::merge_with(info_.functions_, info.id(), info, &function_info::merge_with_);
|
detail::merge_with(info_.functions_, info.id(), info, &function_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const namespace_info& info) {
|
void add_(const namespace_info& info) {
|
||||||
detail::merge_with(info_.namespaces_, info.id(), info, &namespace_info::merge_with_);
|
detail::merge_with(info_.namespaces_, info.id(), info, &namespace_info::merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_(const variable_info& info) {
|
void add_(const variable_info& info) {
|
||||||
detail::merge_with(info_.variables_, info.id(), info, &variable_info::merge_with_);
|
detail::merge_with(info_.variables_, info.id(), info, &variable_info::merge);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
namespace_info info_;
|
namespace_info info_;
|
||||||
|
|||||||
@@ -87,16 +87,16 @@ namespace meta_hpp
|
|||||||
std::optional<variable_info> get_variable(std::string_view id) const {
|
std::optional<variable_info> get_variable(std::string_view id) const {
|
||||||
return detail::find_opt(variables_, id);
|
return detail::find_opt(variables_, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void merge(const namespace_info& other) {
|
||||||
|
detail::merge_with(classes_, other.classes_, &class_info::merge);
|
||||||
|
detail::merge_with(datas_, other.datas_, &data_info::merge);
|
||||||
|
detail::merge_with(functions_, other.functions_, &function_info::merge);
|
||||||
|
detail::merge_with(namespaces_, other.namespaces_, &namespace_info::merge);
|
||||||
|
detail::merge_with(variables_, other.variables_, &variable_info::merge);
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
friend class namespace_;
|
friend class namespace_;
|
||||||
private:
|
|
||||||
void merge_with_(const namespace_info& other) {
|
|
||||||
detail::merge_with(classes_, other.classes_, &class_info::merge_with_);
|
|
||||||
detail::merge_with(datas_, other.datas_, &data_info::merge_with_);
|
|
||||||
detail::merge_with(functions_, other.functions_, &function_info::merge_with_);
|
|
||||||
detail::merge_with(namespaces_, other.namespaces_, &namespace_info::merge_with_);
|
|
||||||
detail::merge_with(variables_, other.variables_, &variable_info::merge_with_);
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
std::string id_;
|
std::string id_;
|
||||||
std::map<std::string, class_info, std::less<>> classes_;
|
std::map<std::string, class_info, std::less<>> classes_;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void add_(const data_info& info) {
|
void add_(const data_info& info) {
|
||||||
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge_with_);
|
detail::merge_with(info_.datas_, info.id(), info, &data_info::merge);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
variable_info info_;
|
variable_info info_;
|
||||||
|
|||||||
@@ -93,21 +93,16 @@ namespace meta_hpp
|
|||||||
std::optional<data_info> get_data(std::string_view id) const {
|
std::optional<data_info> get_data(std::string_view id) const {
|
||||||
return detail::find_opt(datas_, id);
|
return detail::find_opt(datas_, id);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
friend class class_info;
|
|
||||||
friend class namespace_info;
|
|
||||||
|
|
||||||
template < typename Class > friend class class_;
|
void merge(const variable_info& other) {
|
||||||
friend class namespace_;
|
|
||||||
|
|
||||||
template < auto Variable > friend class variable_;
|
|
||||||
private:
|
|
||||||
void merge_with_(const variable_info& other) {
|
|
||||||
if ( fid() != other.fid() ) {
|
if ( fid() != other.fid() ) {
|
||||||
throw std::logic_error("variable_info::merge failed");
|
throw std::logic_error("variable_info::merge failed");
|
||||||
}
|
}
|
||||||
detail::merge_with(datas_, other.datas_, &data_info::merge_with_);
|
detail::merge_with(datas_, other.datas_, &data_info::merge);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
template < auto Variable >
|
||||||
|
friend class variable_;
|
||||||
private:
|
private:
|
||||||
family_id fid_;
|
family_id fid_;
|
||||||
std::string id_;
|
std::string id_;
|
||||||
|
|||||||
Reference in New Issue
Block a user