Functions defined in Types.h facilitate the (de)serialization of enum labels, here refered to as types. This is useful, e.g., when reading/writing the type of an object to a file. More...
Functions | |
template<class T > | |
std::string | nuklei::catTypeNames () |
Cats all type names into a string. More... | |
template<class T > | |
std::vector< std::string > | nuklei::listTypeNames () |
Fills a std::vector with all type names. | |
template<class T > | |
std::string | nuklei::defaultTypeName () |
Returns the default type name. | |
template<class T > | |
T::Type | nuklei::defaultType () |
Returns the default type. | |
template<class T > | |
std::string | nuklei::nameFromType (int t) |
Returns the name of type t . | |
template<class T > | |
T::Type | nuklei::typeFromName (std::string s) |
Returns the type whose name is s . | |
Functions defined in Types.h facilitate the (de)serialization of enum labels, here refered to as types. This is useful, e.g., when reading/writing the type of an object to a file.
In order to afford the functions defined above, a class MyClass
needs to define the following members:
Then, an expression such as
will return the string "type1"
.
Examples of classes implementing this interface: nuklei::kernel::base, nuklei::Observation, nuklei::Color.
std::string nuklei::catTypeNames | ( | ) |
Cats all type names into a string.
Names are separated by a bar. The default name is followed by a star.
Definition at line 28 of file Types.h.
References nuklei::defaultType().