mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
foreach by info internals
This commit is contained in:
@@ -34,6 +34,48 @@ namespace meta_hpp
|
|||||||
return id_;
|
return id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_class(F&& f) const {
|
||||||
|
for ( auto [_, info] : classes_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_data(F&& f) const {
|
||||||
|
for ( auto [_, info] : datas_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_field(F&& f) const {
|
||||||
|
for ( auto [_, info] : fields_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_function(F&& f) const {
|
||||||
|
for ( auto [_, info] : functions_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_method(F&& f) const {
|
||||||
|
for ( auto [_, info] : methods_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_variable(F&& f) const {
|
||||||
|
for ( auto [_, info] : variables_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ namespace meta_hpp
|
|||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_data(F&& f) const {
|
||||||
|
for ( auto [_, info] : datas_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,13 @@ namespace meta_hpp
|
|||||||
return setter_(instance, std::forward<Value>(value));
|
return setter_(instance, std::forward<Value>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_data(F&& f) const {
|
||||||
|
for ( auto [_, info] : datas_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,13 @@ namespace meta_hpp
|
|||||||
return invoke_(vargs.data(), vargs.size());
|
return invoke_(vargs.data(), vargs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_data(F&& f) const {
|
||||||
|
for ( auto [_, info] : datas_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,13 @@ namespace meta_hpp
|
|||||||
return cinvoke_(instance, vargs.data(), vargs.size());
|
return cinvoke_(instance, vargs.data(), vargs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_data(F&& f) const {
|
||||||
|
for ( auto [_, info] : datas_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,42 @@ namespace meta_hpp
|
|||||||
const std::string& id() const noexcept {
|
const std::string& id() const noexcept {
|
||||||
return id_;
|
return id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_class(F&& f) const {
|
||||||
|
for ( auto [_, info] : classes_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_data(F&& f) const {
|
||||||
|
for ( auto [_, info] : datas_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_function(F&& f) const {
|
||||||
|
for ( auto [_, info] : functions_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_namespace(F&& f) const {
|
||||||
|
for ( auto [_, info] : namespaces_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_variable(F&& f) const {
|
||||||
|
for ( auto [_, info] : variables_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,13 @@ namespace meta_hpp
|
|||||||
return setter_(std::forward<Value>(value));
|
return setter_(std::forward<Value>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template < typename F >
|
||||||
|
void each_data(F&& f) const {
|
||||||
|
for ( auto [_, info] : datas_ ) {
|
||||||
|
std::invoke(f, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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