mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
visit info function
This commit is contained in:
@@ -77,6 +77,16 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void visit(F&& f) const {
|
||||||
|
each_class(f);
|
||||||
|
each_data(f);
|
||||||
|
each_field(f);
|
||||||
|
each_function(f);
|
||||||
|
each_method(f);
|
||||||
|
each_variable(f);
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<class_info> get_class(std::string_view id) const {
|
std::optional<class_info> get_class(std::string_view id) const {
|
||||||
return detail::find_opt(classes_, id);
|
return detail::find_opt(classes_, id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void visit(F&& f) const {
|
||||||
|
each_data(f);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void visit(F&& f) const {
|
||||||
|
each_data(f);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,11 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void visit(F&& f) const {
|
||||||
|
each_data(f);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,17 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < typename... Ts >
|
||||||
|
struct overloaded : Ts... {
|
||||||
|
using Ts::operator()...;
|
||||||
|
};
|
||||||
|
|
||||||
|
template < typename... Ts >
|
||||||
|
overloaded(Ts...) -> overloaded<Ts...>;
|
||||||
|
}
|
||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
struct family_id {
|
struct family_id {
|
||||||
|
|||||||
@@ -159,6 +159,11 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void visit(F&& f) const {
|
||||||
|
each_data(f);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,15 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void visit(F&& f) const {
|
||||||
|
each_class(f);
|
||||||
|
each_data(f);
|
||||||
|
each_function(f);
|
||||||
|
each_namespace(f);
|
||||||
|
each_variable(f);
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<class_info> get_class(std::string_view id) const {
|
std::optional<class_info> get_class(std::string_view id) const {
|
||||||
return detail::find_opt(classes_, id);
|
return detail::find_opt(classes_, id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void visit(F&& f) const {
|
||||||
|
each_data(f);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user