CPP-TOOLBOX
Loading...
Searching...
No Matches
meta_utils Namespace Reference

Classes

struct  CustomTypeExtractionSettings
 
class  MetaAttribute
 
class  MetaClass
 
class  MetaCodeCollection
 
class  MetaConstructor
 
class  MetaEnum
 
class  MetaFunction
 
class  MetaFunctionInvocation
 
class  MetaFunctionSignature
 
class  MetaInclude
 Represents an include directive for C++ source code, providing control over whether it is a system or local include. More...
 
class  MetaMethod
 
class  MetaParameter
 
class  MetaType
 
class  MetaTypes
 
class  MetaVariable
 
struct  StringInvokerGenerationSettingsForHeaderSource
 
struct  StringToTypeConversions
 

Concepts

concept  HasNameAndNamespace
 

Typedefs

using MetaTemplateParameter = std::variant<unsigned int, MetaType>
 

Enumerations

enum class  AccessSpecifier { Public , Protected , Private }
 
enum class  FilterMode { None , Whitelist , Blacklist }
 

Functions

std::string create_local_include (const std::string &path)
 
std::vector< float > parse_vector_of_type (const std::string &input)
 
std::string create_string_to_vector_of_type_func (MetaType type_parameter)
 
std::string create_vector_of_type_to_string_func (MetaType type_parameter)
 
std::string create_vector_of_type_serialize_func (MetaType type_parameter)
 
std::string create_vector_of_type_serialized_size_func (MetaType type_parameter)
 
std::string create_vector_of_type_deserialize_func (MetaType type_parameter)
 
std::string create_string_to_array_of_type_func (MetaType type_parameter, unsigned int size)
 
std::string create_array_of_type_to_string_func (MetaType type_parameter, unsigned int size)
 
std::string create_array_of_type_serialize_func (MetaType type_parameter, unsigned int size)
 
std::string create_array_of_type_serialized_size_func (MetaType type_parameter, unsigned int size)
 
std::string create_array_of_type_deserialize_func (MetaType type_parameter, unsigned int size)
 
std::string create_string_to_unordered_map_func (MetaType key_type, MetaType value_type)
 
std::string create_unordered_map_to_string_func (MetaType key_type, MetaType value_type)
 
std::string create_unordered_map_serialize_func (MetaType key_type, MetaType value_type)
 
std::string create_unordered_map_serialized_size_func (MetaType key_type, MetaType value_type)
 
std::string create_unordered_map_deserialize_func (MetaType key_type, MetaType value_type)
 
MetaType resolve_meta_type (const std::string &type_str, const MetaTypes &types)
 
MetaClass create_meta_class_or_struct_from_source (const std::string &source, cpp_parsing::CharParserPtr def_parser, const std::string &unnamed_fallback, const std::string &kind)
 
meta_utils::MetaClass create_meta_class_from_source (const std::string &source)
 
meta_utils::MetaClass create_meta_struct_from_source (const std::string &source)
 
meta_utils::MetaType create_meta_type_from_using (const std::string &source, const meta_utils::MetaTypes &types)
 
meta_utils::MetaEnum create_meta_enum_from_source (const std::string &source)
 
std::string to_string_function_name (const std::string &type)
 
std::string from_string_function_name (const std::string &type)
 
std::string serialize_function_name (const std::string &type)
 
std::string size_when_serialized_function_name (const std::string &type)
 
std::string deserialize_function_name (const std::string &type)
 
MetaType construct_class_metatype (const MetaClass &cls, const MetaTypes &types)
 
MetaType construct_enum_metatype (const MetaEnum &enu, const MetaTypes &types)
 
std::vector< std::string > split_template_args (const std::string &s)
 
std::string trim (const std::string &s)
 
std::vector< std::string > split_args (const std::string &args_str)
 
std::string simplify_parameter (const std::string &param_str)
 
std::string generate_regex_to_match_valid_invocation_of_func (const std::string &signature)
 
std::optional< MetaTypeparse_meta_type_from_string (const std::string &type_str)
 
std::string clean_type_string (const std::string &raw_type)
 
std::string generate_string_invoker_for_function_with_string_return_type (const MetaFunctionSignature &sig)
 
StringToTypeConversions get_code_to_generate_invocation (const std::vector< MetaParameter > &params)
 
std::string generate_string_invoker_for_function (const MetaFunctionSignature &sig, const std ::string &func_postfix="_string_invoker")
 Generate an invoker function from it's meta function signature.
 
std::string generate_deferred_string_invoker_for_function (const MetaFunctionSignature &sig, const std ::string &func_postfix="_deferred_string_invoker")
 Generate a deferred invoker function from it's meta function signature.
 
std::string join (const std::vector< std::string > &v, const std::string &sep)
 
std::vector< MetaFunctiongenerate_string_invokers_to_string (std::vector< MetaFunction > mfs)
 
std::vector< MetaFunctiongenerate_string_invokers_to_string (std::vector< MetaFunctionSignature > mfss)
 
std::vector< MetaVariablegenerate_meta_function_signature_variables (std::vector< MetaFunction > meta_functions)
 
std::vector< MetaVariablegenerate_meta_function_signature_variables (std::vector< MetaFunctionSignature > mfss)
 
std::vector< MetaFunctiongenerate_string_invokers (std::vector< MetaFunction > mfs)
 
std::vector< MetaFunctiongenerate_string_invokers (std::vector< MetaFunctionSignature > mfss)
 
std::vector< std::string > generate_type_grouped_invokers (const std::vector< meta_utils::MetaFunctionSignature > &mfss, bool create_top_level_invoker)
 
std::string sanitize_type (const std::string &type_str)
 
std::string generate_string_invoker_for_function_collection_that_has_same_return_type (std::vector< MetaFunctionSignature > mfss_with_same_return_type, std::string return_type, std::string func_postfix)
 
MetaFunction create_list_all_available_functions (std::vector< MetaCodeCollection > &generated_mcc_for_each_header_source_pair)
 
MetaFunction create_interactive_invoker (std::vector< MetaCodeCollection > &generated_mcc_for_each_header_source_pair)
 
std::string generate_deferred_string_invoker_for_function_collection_that_has_same_return_type (std::vector< MetaFunctionSignature > mfss_with_same_return_type, std::string return_type, std::string func_postfix)
 
std::string lambda_to_function (const std::string &lambda_str, const std::string &func_name, const std::string &return_type)
 
void register_custom_types_into_meta_types (const std::vector< CustomTypeExtractionSettings > &settings_list)
 
void register_custom_types_into_meta_types (const CustomTypeExtractionSettings &custom_type_extraction_settings)
 
void generate_string_invokers_program_wide (std::vector< StringInvokerGenerationSettingsForHeaderSource > settings, const std::vector< MetaType > &all_types)
 generates the meta program
 
MetaCodeCollection generate_string_invokers_from_header_and_source (const StringInvokerGenerationSettingsForHeaderSource &sigsfhs)
 
MetaCodeCollection generate_string_invokers_from_header_and_source (const std::string &input_header_path, const std::string &input_source_path, bool create_top_level_invoker, bool create_type_grouped_invokers, const std::vector< std::string > &string_signatures_to_filter_on, FilterMode mode)
 
bool is_system_header (const std::string &line)
 
bool is_local_header (const std::string &line)
 
std::vector< std::string > get_system_headers (const std::vector< std::string > &headers)
 
MetaFunction generate_interactive_invoker ()
 
std::string create_to_string_lambda (std::string type)
 
MetaType construct_vector_metatype (MetaType generic_type)
 
MetaType construct_array_metatype (MetaType generic_type, unsigned int size)
 
MetaType construct_unordered_map_metatype (MetaType key_type, MetaType value_type)
 
std::unordered_map< std::string, MetaTypecreate_type_name_to_meta_type_map (std::vector< MetaType > meta_types)
 
template<HasNameAndNamespace T>
std::string get_fully_qualified_name (const T &obj)
 
std::string to_string (AccessSpecifier access)
 

Variables

std::unordered_map< char, char > replacement_map = {{':', '_'}, {' ', '_'}}
 
MetaType UNSIGNED_INT
 
MetaType UINT8_T
 
MetaType UINT32_T
 
MetaType SIZE_T
 
MetaType CHAR
 
MetaType INT
 
MetaType SHORT
 
MetaType LONG
 
MetaType FLOAT
 
MetaType DOUBLE
 
MetaType STRING
 
MetaType FILESYSTEM_PATH
 
MetaType REGEX
 
MetaType BOOL
 
meta_utils::MetaType meta_type_type ("meta_utils::MetaType", "[](){}", "[](){ return \"\";}", "[](){}", "[](const meta_utils::MetaType &v) { return sizeof(meta_utils::MetaType); }", "[](){}", "MetaType")
 
std::vector< MetaTypeconcrete_types
 
std::unordered_map< std::string, std::function< MetaType(std::vector< MetaTemplateParameter >)> > generic_type_to_metatype_constructor
 
std::string vector_include = "#include <vector>"
 
std::string string_include = "#include <string>"
 
std::string optional_include = "#include <optional>"
 
std::string regex_include = "#include <regex>"
 
MetaTypes meta_types
 

Typedef Documentation

◆ MetaTemplateParameter

typedef std::variant< unsigned int, MetaType > meta_utils::MetaTemplateParameter = std::variant<unsigned int, MetaType>

Enumeration Type Documentation

◆ AccessSpecifier

enum class meta_utils::AccessSpecifier
strong
Enumerator
Public 
Protected 
Private 

◆ FilterMode

enum class meta_utils::FilterMode
strong
Enumerator
None 
Whitelist 
Blacklist 

Function Documentation

◆ clean_type_string()

std::string meta_utils::clean_type_string ( const std::string & raw_type)

◆ construct_array_metatype()

MetaType meta_utils::construct_array_metatype ( MetaType generic_type,
unsigned int size )
inline

◆ construct_class_metatype()

meta_utils::MetaType meta_utils::construct_class_metatype ( const MetaClass & cls,
const MetaTypes & types )

◆ construct_enum_metatype()

MetaType meta_utils::construct_enum_metatype ( const MetaEnum & enu,
const MetaTypes & types )

◆ construct_unordered_map_metatype()

MetaType meta_utils::construct_unordered_map_metatype ( MetaType key_type,
MetaType value_type )
inline

◆ construct_vector_metatype()

MetaType meta_utils::construct_vector_metatype ( MetaType generic_type)
inline

◆ create_array_of_type_deserialize_func()

std::string meta_utils::create_array_of_type_deserialize_func ( MetaType type_parameter,
unsigned int size )

◆ create_array_of_type_serialize_func()

std::string meta_utils::create_array_of_type_serialize_func ( MetaType type_parameter,
unsigned int size )

◆ create_array_of_type_serialized_size_func()

std::string meta_utils::create_array_of_type_serialized_size_func ( MetaType type_parameter,
unsigned int size )

◆ create_array_of_type_to_string_func()

std::string meta_utils::create_array_of_type_to_string_func ( MetaType type_parameter,
unsigned int size )

◆ create_interactive_invoker()

MetaFunction meta_utils::create_interactive_invoker ( std::vector< MetaCodeCollection > & generated_mcc_for_each_header_source_pair)

◆ create_list_all_available_functions()

MetaFunction meta_utils::create_list_all_available_functions ( std::vector< MetaCodeCollection > & generated_mcc_for_each_header_source_pair)

◆ create_local_include()

std::string meta_utils::create_local_include ( const std::string & path)

◆ create_meta_class_from_source()

meta_utils::MetaClass meta_utils::create_meta_class_from_source ( const std::string & source)

◆ create_meta_class_or_struct_from_source()

MetaClass meta_utils::create_meta_class_or_struct_from_source ( const std::string & source,
cpp_parsing::CharParserPtr def_parser,
const std::string & unnamed_fallback,
const std::string & kind )

◆ create_meta_enum_from_source()

meta_utils::MetaEnum meta_utils::create_meta_enum_from_source ( const std::string & source)

◆ create_meta_struct_from_source()

meta_utils::MetaClass meta_utils::create_meta_struct_from_source ( const std::string & source)

◆ create_meta_type_from_using()

meta_utils::MetaType meta_utils::create_meta_type_from_using ( const std::string & source,
const meta_utils::MetaTypes & types )

◆ create_string_to_array_of_type_func()

std::string meta_utils::create_string_to_array_of_type_func ( MetaType type_parameter,
unsigned int size )

◆ create_string_to_unordered_map_func()

std::string meta_utils::create_string_to_unordered_map_func ( MetaType key_type,
MetaType value_type )

◆ create_string_to_vector_of_type_func()

std::string meta_utils::create_string_to_vector_of_type_func ( MetaType type_parameter)

◆ create_to_string_lambda()

std::string meta_utils::create_to_string_lambda ( std::string type)
inline

◆ create_type_name_to_meta_type_map()

std::unordered_map< std::string, MetaType > meta_utils::create_type_name_to_meta_type_map ( std::vector< MetaType > meta_types)
inline

◆ create_unordered_map_deserialize_func()

std::string meta_utils::create_unordered_map_deserialize_func ( MetaType key_type,
MetaType value_type )

◆ create_unordered_map_serialize_func()

std::string meta_utils::create_unordered_map_serialize_func ( MetaType key_type,
MetaType value_type )

◆ create_unordered_map_serialized_size_func()

std::string meta_utils::create_unordered_map_serialized_size_func ( MetaType key_type,
MetaType value_type )

◆ create_unordered_map_to_string_func()

std::string meta_utils::create_unordered_map_to_string_func ( MetaType key_type,
MetaType value_type )

◆ create_vector_of_type_deserialize_func()

std::string meta_utils::create_vector_of_type_deserialize_func ( MetaType type_parameter)

◆ create_vector_of_type_serialize_func()

std::string meta_utils::create_vector_of_type_serialize_func ( MetaType type_parameter)

◆ create_vector_of_type_serialized_size_func()

std::string meta_utils::create_vector_of_type_serialized_size_func ( MetaType type_parameter)

◆ create_vector_of_type_to_string_func()

std::string meta_utils::create_vector_of_type_to_string_func ( MetaType type_parameter)

◆ deserialize_function_name()

std::string meta_utils::deserialize_function_name ( const std::string & type)

◆ from_string_function_name()

std::string meta_utils::from_string_function_name ( const std::string & type)

◆ generate_deferred_string_invoker_for_function()

std::string meta_utils::generate_deferred_string_invoker_for_function ( const MetaFunctionSignature & sig,
const std ::string & func_postfix = "_deferred_string_invoker" )

Generate a deferred invoker function from it's meta function signature.

This function creates a new function in string form that takes in a string that's supposed to be an invocation of the passed in function and if it is a valid invocation it will pass back a function that's preloaded to do the requested function call, the point of this is so that we ddon't always have to call a function immediately rather than calling it the moment we get the string for it.

◆ generate_deferred_string_invoker_for_function_collection_that_has_same_return_type()

std::string meta_utils::generate_deferred_string_invoker_for_function_collection_that_has_same_return_type ( std::vector< MetaFunctionSignature > mfss_with_same_return_type,
std::string return_type,
std::string func_postfix )

◆ generate_interactive_invoker()

MetaFunction meta_utils::generate_interactive_invoker ( )

◆ generate_meta_function_signature_variables() [1/2]

std::vector< MetaVariable > meta_utils::generate_meta_function_signature_variables ( std::vector< MetaFunction > meta_functions)

◆ generate_meta_function_signature_variables() [2/2]

std::vector< MetaVariable > meta_utils::generate_meta_function_signature_variables ( std::vector< MetaFunctionSignature > mfss)

◆ generate_regex_to_match_valid_invocation_of_func()

std::string meta_utils::generate_regex_to_match_valid_invocation_of_func ( const std::string & signature)

◆ generate_string_invoker_for_function()

std::string meta_utils::generate_string_invoker_for_function ( const MetaFunctionSignature & sig,
const std ::string & func_postfix = "_string_invoker" )

Generate an invoker function from it's meta function signature.

This function creates a new function in string form that takes in a string that's supposed to be an invocation of the passed in function and if it is a valid invocation it will call the real internal function

◆ generate_string_invoker_for_function_collection_that_has_same_return_type()

std::string meta_utils::generate_string_invoker_for_function_collection_that_has_same_return_type ( std::vector< MetaFunctionSignature > mfss_with_same_return_type,
std::string return_type,
std::string func_postfix )

◆ generate_string_invoker_for_function_with_string_return_type()

std::string meta_utils::generate_string_invoker_for_function_with_string_return_type ( const MetaFunctionSignature & sig)

◆ generate_string_invokers() [1/2]

std::vector< MetaFunction > meta_utils::generate_string_invokers ( std::vector< MetaFunction > mfs)

◆ generate_string_invokers() [2/2]

std::vector< MetaFunction > meta_utils::generate_string_invokers ( std::vector< MetaFunctionSignature > mfss)

◆ generate_string_invokers_from_header_and_source() [1/2]

MetaCodeCollection meta_utils::generate_string_invokers_from_header_and_source ( const std::string & input_header_path,
const std::string & input_source_path,
bool create_top_level_invoker,
bool create_type_grouped_invokers,
const std::vector< std::string > & string_signatures_to_filter_on,
FilterMode mode )

◆ generate_string_invokers_from_header_and_source() [2/2]

MetaCodeCollection meta_utils::generate_string_invokers_from_header_and_source ( const StringInvokerGenerationSettingsForHeaderSource & sigsfhs)

◆ generate_string_invokers_program_wide()

void meta_utils::generate_string_invokers_program_wide ( std::vector< StringInvokerGenerationSettingsForHeaderSource > settings,
const std::vector< MetaType > & all_types )

generates the meta program

◆ generate_string_invokers_to_string() [1/2]

std::vector< MetaFunction > meta_utils::generate_string_invokers_to_string ( std::vector< MetaFunction > mfs)

◆ generate_string_invokers_to_string() [2/2]

std::vector< MetaFunction > meta_utils::generate_string_invokers_to_string ( std::vector< MetaFunctionSignature > mfss)

◆ generate_type_grouped_invokers()

std::vector< std::string > meta_utils::generate_type_grouped_invokers ( const std::vector< meta_utils::MetaFunctionSignature > & mfss,
bool create_top_level_invoker )

◆ get_code_to_generate_invocation()

StringToTypeConversions meta_utils::get_code_to_generate_invocation ( const std::vector< MetaParameter > & params)

◆ get_fully_qualified_name()

template<HasNameAndNamespace T>
std::string meta_utils::get_fully_qualified_name ( const T & obj)

◆ get_system_headers()

std::vector< std::string > meta_utils::get_system_headers ( const std::vector< std::string > & headers)

◆ is_local_header()

bool meta_utils::is_local_header ( const std::string & line)

◆ is_system_header()

bool meta_utils::is_system_header ( const std::string & line)

◆ join()

std::string meta_utils::join ( const std::vector< std::string > & v,
const std::string & sep )

◆ lambda_to_function()

std::string meta_utils::lambda_to_function ( const std::string & lambda_str,
const std::string & func_name,
const std::string & return_type )

◆ parse_meta_type_from_string()

std::optional< MetaType > meta_utils::parse_meta_type_from_string ( const std::string & type_str)

◆ parse_vector_of_type()

std::vector< float > meta_utils::parse_vector_of_type ( const std::string & input)

◆ register_custom_types_into_meta_types() [1/2]

void meta_utils::register_custom_types_into_meta_types ( const CustomTypeExtractionSettings & custom_type_extraction_settings)

◆ register_custom_types_into_meta_types() [2/2]

void meta_utils::register_custom_types_into_meta_types ( const std::vector< CustomTypeExtractionSettings > & settings_list)

◆ resolve_meta_type()

MetaType meta_utils::resolve_meta_type ( const std::string & type_str,
const MetaTypes & types )

◆ sanitize_type()

std::string meta_utils::sanitize_type ( const std::string & type_str)

◆ serialize_function_name()

std::string meta_utils::serialize_function_name ( const std::string & type)

◆ simplify_parameter()

std::string meta_utils::simplify_parameter ( const std::string & param_str)

◆ size_when_serialized_function_name()

std::string meta_utils::size_when_serialized_function_name ( const std::string & type)

◆ split_args()

std::vector< std::string > meta_utils::split_args ( const std::string & args_str)

◆ split_template_args()

std::vector< std::string > meta_utils::split_template_args ( const std::string & s)

◆ to_string()

std::string meta_utils::to_string ( AccessSpecifier access)
inline

◆ to_string_function_name()

std::string meta_utils::to_string_function_name ( const std::string & type)

◆ trim()

std::string meta_utils::trim ( const std::string & s)

Variable Documentation

◆ BOOL

MetaType meta_utils::BOOL
inline
Initial value:
= MetaType("bool", "[](const std::string &s) { return s == \"true\"; }",
"[](const bool &v) { return v ? \"true\" : \"false\"; }",
"[](const bool &v) { "
" std::vector<uint8_t> buf(1); "
" buf[0] = v ? 1 : 0; "
" return buf; }",
"[](const bool &v) { return sizeof(uint8_t); }",
"[](const std::vector<uint8_t> &buf) { "
" return buf[0] != 0; }",
R"(true|false|1|0)")
Definition meta_utils.hpp:95

◆ CHAR

MetaType meta_utils::CHAR
inline
Initial value:
= MetaType("char", "[](const std::string &s) { return static_cast<char>(s.empty() ? 0 : s[0]); }",
"[](const char &v) { "
" std::vector<uint8_t> buf(sizeof(char)); "
" std::memcpy(buf.data(), &v, sizeof(char)); "
" return buf; }",
"[](const char &v) { return sizeof(char); }",
"[](const std::vector<uint8_t> &buf) { "
" char v; "
" std::memcpy(&v, buf.data(), sizeof(char)); "
" return v; }",
std::string create_to_string_lambda(std::string type)
Definition meta_utils.hpp:212
const std::string char_literal(R"('(?:[^'\\]|\\.)')")

◆ concrete_types

std::vector<MetaType> meta_utils::concrete_types
inline
Initial value:
MetaType UINT8_T
Definition meta_utils.hpp:233
MetaType FLOAT
Definition meta_utils.hpp:326
MetaType UINT32_T
Definition meta_utils.hpp:247
MetaType SHORT
Definition meta_utils.hpp:300
MetaType CHAR
Definition meta_utils.hpp:274
MetaType BOOL
Definition meta_utils.hpp:439
MetaType INT
Definition meta_utils.hpp:287
MetaType SIZE_T
Definition meta_utils.hpp:261
MetaType FILESYSTEM_PATH
Definition meta_utils.hpp:375
MetaType STRING
Definition meta_utils.hpp:352
MetaType DOUBLE
Definition meta_utils.hpp:339
meta_utils::MetaType meta_type_type("meta_utils::MetaType", "[](){}", "[](){ return \"\";}", "[](){}", "[](const meta_utils::MetaType &v) { return sizeof(meta_utils::MetaType); }", "[](){}", "MetaType")
MetaType LONG
Definition meta_utils.hpp:313
MetaType UNSIGNED_INT
Definition meta_utils.hpp:219

◆ DOUBLE

MetaType meta_utils::DOUBLE
inline
Initial value:
=
MetaType("double", "[](const std::string &s) { return std::stod(s); }", create_to_string_lambda("double"),
"[](const double &v) { "
" std::vector<uint8_t> buf(sizeof(double)); "
" std::memcpy(buf.data(), &v, sizeof(double)); "
" return buf; }",
"[](const double &v) { return sizeof(double); }",
"[](const std::vector<uint8_t> &buf) { "
" double v; "
" std::memcpy(&v, buf.data(), sizeof(double)); "
" return v; }",
const std::string float_regex
Definition regex_utils.hpp:79

◆ FILESYSTEM_PATH

MetaType meta_utils::FILESYSTEM_PATH
inline
Initial value:
"std::filesystem::path",
"[](const std::string &s) { "
" if (s.size() >= 2 && s.front() == '\"' && s.back() == '\"') "
" return std::filesystem::path(s.substr(1, s.size() - 2)); "
" return std::filesystem::path(s); }",
"[](const std::filesystem::path &p) { return p.string(); }",
"[](const std::filesystem::path &p) { "
" std::string s = p.string(); "
" std::vector<uint8_t> buf; "
" size_t len = s.size(); "
" buf.resize(sizeof(size_t) + len); "
" std::memcpy(buf.data(), &len, sizeof(size_t)); "
" std::memcpy(buf.data() + sizeof(size_t), s.data(), len); "
" return buf; }",
"[](const std::filesystem::path &p) { "
" std::string s = p.string(); "
" return sizeof(size_t) + s.size(); }",
"[](const std::vector<uint8_t> &buf) { "
" if (buf.size() < sizeof(size_t)) return std::filesystem::path(); "
" size_t len; "
" std::memcpy(&len, buf.data(), sizeof(size_t)); "
" if (buf.size() < sizeof(size_t) + len) return std::filesystem::path(); "
" return std::filesystem::path(std::string(reinterpret_cast<const char*>(buf.data() + sizeof(size_t)), len)); }",
const std::string string_literal(R"("(?:[^"\\]|\\.)*")")

◆ FLOAT

MetaType meta_utils::FLOAT
inline
Initial value:
=
MetaType("float", "[](const std::string &s) { return std::stof(s); }", create_to_string_lambda("float"),
"[](const float &v) { "
" std::vector<uint8_t> buf(sizeof(float)); "
" std::memcpy(buf.data(), &v, sizeof(float)); "
" return buf; }",
"[](const float &v) { return sizeof(float); }",
"[](const std::vector<uint8_t> &buf) { "
" float v; "
" std::memcpy(&v, buf.data(), sizeof(float)); "
" return v; }",

◆ generic_type_to_metatype_constructor

std::unordered_map<std::string, std::function<MetaType(std::vector<MetaTemplateParameter>)> > meta_utils::generic_type_to_metatype_constructor
inline

◆ INT

MetaType meta_utils::INT
inline
Initial value:
=
MetaType("int", "[](const std::string &s) { return std::stoi(s); }", create_to_string_lambda("int"),
"[](const int &v) { "
" std::vector<uint8_t> buf(sizeof(int)); "
" std::memcpy(buf.data(), &v, sizeof(int)); "
" return buf; }",
"[](const int &v) { return sizeof(int); }",
"[](const std::vector<uint8_t> &buf) { "
" int v; "
" std::memcpy(&v, buf.data(), sizeof(int)); "
" return v; }",
const std::string int_regex
Definition regex_utils.hpp:77

◆ LONG

MetaType meta_utils::LONG
inline
Initial value:
=
MetaType("long", "[](const std::string &s) { return std::stol(s); }", create_to_string_lambda("long"),
"[](const long &v) { "
" std::vector<uint8_t> buf(sizeof(long)); "
" std::memcpy(buf.data(), &v, sizeof(long)); "
" return buf; }",
"[](const long &v) { return sizeof(long); }",
"[](const std::vector<uint8_t> &buf) { "
" long v; "
" std::memcpy(&v, buf.data(), sizeof(long)); "
" return v; }",

◆ meta_type_type

meta_utils::MetaType meta_utils::meta_type_type("meta_utils::MetaType", "[](){}", "[](){ return \"\";}", "[](){}", "[](const meta_utils::MetaType &v) { return sizeof(meta_utils::MetaType); }", "[](){}", "MetaType") ( "meta_utils::MetaType" ,
"(){}" [],
"(){ return \"\";}" [],
"(){}" [],
"(const meta_utils::MetaType &v) { return sizeof(meta_utils::MetaType); }" [],
"(){}" [],
"MetaType"  )
inline

◆ meta_types

MetaTypes meta_utils::meta_types
inline

◆ optional_include

std::string meta_utils::optional_include = "#include <optional>"
inline

◆ REGEX

MetaType meta_utils::REGEX
inline
Initial value:
=
MetaType("std::regex",
"[](const std::string &s) { "
" if (s.size() >= 2 && s.front() == '\"' && s.back() == '\"') "
" return std::regex(s.substr(1, s.size() - 2)); "
" return std::regex(s); }",
"[](const std::regex &r) { return r.pattern(); }",
"[](const std::regex &r) { "
" std::string pattern = r.pattern(); "
" std::vector<uint8_t> buf; "
" size_t len = pattern.size(); "
" buf.resize(sizeof(size_t) + len); "
" std::memcpy(buf.data(), &len, sizeof(size_t)); "
" std::memcpy(buf.data() + sizeof(size_t), pattern.data(), len); "
" return buf; }",
"[](const std::regex &r) { "
" std::string pattern = r.pattern(); "
" return sizeof(size_t) + pattern.size(); }",
"[](const std::vector<uint8_t> &buf) { "
" if (buf.size() < sizeof(size_t)) return std::regex(); "
" size_t len; "
" std::memcpy(&len, buf.data(), sizeof(size_t)); "
" if (buf.size() < sizeof(size_t) + len) return std::regex(); "
" return std::regex(std::string(reinterpret_cast<const char*>(buf.data() + sizeof(size_t)), len)); }",

◆ regex_include

std::string meta_utils::regex_include = "#include <regex>"
inline

◆ replacement_map

std::unordered_map<char, char> meta_utils::replacement_map = {{':', '_'}, {' ', '_'}}

◆ SHORT

MetaType meta_utils::SHORT
inline
Initial value:
= MetaType("short", "[](const std::string &s) { return static_cast<short>(std::stoi(s)); }",
"[](const short &v) { "
" std::vector<uint8_t> buf(sizeof(short)); "
" std::memcpy(buf.data(), &v, sizeof(short)); "
" return buf; }",
"[](const short &v) { return sizeof(short); }",
"[](const std::vector<uint8_t> &buf) { "
" short v; "
" std::memcpy(&v, buf.data(), sizeof(short)); "
" return v; }",

◆ SIZE_T

MetaType meta_utils::SIZE_T
inline
Initial value:
= MetaType("size_t", "[](const std::string &s) { return static_cast<size_t>(std::stoull(s)); }",
"[](const size_t &v) { "
" std::vector<uint8_t> buf(sizeof(size_t)); "
" std::memcpy(buf.data(), &v, sizeof(size_t)); "
" return buf; }",
"[](const size_t &v) { return sizeof(size_t); }",
"[](const std::vector<uint8_t> &buf) { "
" size_t v; "
" std::memcpy(&v, buf.data(), sizeof(size_t)); "
" return v; }",
const std::string unsigned_int_regex
Definition regex_utils.hpp:78

◆ STRING

MetaType meta_utils::STRING
inline
Initial value:
=
MetaType("std::string",
"[](const std::string &s) { "
" if (s.size() >= 2 && s.front() == '\"' && s.back() == '\"') "
" return s.substr(1, s.size() - 2); "
" return s; }",
"[](const std::string &s) { return s; }",
"[](const std::string &v) { "
" std::vector<uint8_t> buf; "
" size_t len = v.size(); "
" buf.resize(sizeof(size_t) + len); "
" std::memcpy(buf.data(), &len, sizeof(size_t)); "
" std::memcpy(buf.data() + sizeof(size_t), v.data(), len); "
" return buf; }",
"[](const std::string &v) { return sizeof(size_t) + v.size(); }",
"[](const std::vector<uint8_t> &buf) { "
" if (buf.size() < sizeof(size_t)) return std::string(); "
" size_t len; "
" std::memcpy(&len, buf.data(), sizeof(size_t)); "
" if (buf.size() < sizeof(size_t) + len) return std::string(); "
" return std::string(reinterpret_cast<const char*>(buf.data() + sizeof(size_t)), len); }",

◆ string_include

std::string meta_utils::string_include = "#include <string>"
inline

◆ UINT32_T

MetaType meta_utils::UINT32_T
inline
Initial value:
=
MetaType("uint32_t", "[](const std::string &s) { return static_cast<uint32_t>(std::stoul(s)); }",
"[](const uint32_t &v) { "
" std::vector<uint8_t> buf(sizeof(uint32_t)); "
" std::memcpy(buf.data(), &v, sizeof(uint32_t)); "
" return buf; }",
"[](const uint32_t &v) { return sizeof(uint32_t); }",
"[](const std::vector<uint8_t> &buf) { "
" uint32_t v; "
" std::memcpy(&v, buf.data(), sizeof(uint32_t)); "
" return v; }",

◆ UINT8_T

MetaType meta_utils::UINT8_T
inline
Initial value:
=
MetaType("uint8_t", "[](const std::string &s) { return static_cast<uint8_t>(std::stoul(s)); }",
"[](const uint8_t &v) { "
" std::vector<uint8_t> buf(sizeof(uint8_t)); "
" std::memcpy(buf.data(), &v, sizeof(uint8_t)); "
" return buf; }",
"[](const uint8_t &v) { return sizeof(uint8_t); }",
"[](const std::vector<uint8_t> &buf) { "
" uint8_t v; "
" std::memcpy(&v, buf.data(), sizeof(uint8_t)); "
" return v; }",

◆ UNSIGNED_INT

MetaType meta_utils::UNSIGNED_INT
inline
Initial value:
=
MetaType("unsigned int", "[](const std::string &s) { return static_cast<unsigned int>(std::stoul(s)); }",
create_to_string_lambda("unsigned int"),
"[](const unsigned int &v) { "
" std::vector<uint8_t> buf(sizeof(unsigned int)); "
" std::memcpy(buf.data(), &v, sizeof(unsigned int)); "
" return buf; }",
"[](const unsigned int &v) { return sizeof(unsigned int); }",
"[](const std::vector<uint8_t> &buf) { "
" unsigned int v; "
" std::memcpy(&v, buf.data(), sizeof(unsigned int)); "
" return v; }",

◆ vector_include

std::string meta_utils::vector_include = "#include <vector>"
inline