forward decalaration More...
#include <stringconvert.h>
Static Public Member Functions | |
| template<typename = T> requires ((concepts::reflection::attributes<T> && std::constructible_from<T>) || bbm::detail::has_constructor_args_t<T>) || concepts::reflection::enumerate<T> | |
| static T | fromString (const std::string &str) |
| convert a string to a type T | |
| template<typename = T> requires concepts::reflection::attributes<T> || concepts::reflection::enumerate<T> | |
| static std::string | toString (const T &obj) |
| convert an object to a type T | |
forward decalaration
Default converter class; should be specialized. Has a fall through for types with reflection; if not it will throw a compile error when trying to call the static to/fromString methods.
|
inlinestatic |
convert a string to a type T
If T has a constructor_args_t, then use this to convert from a string. Otherwise, if T supports reflection AND a trivial constructor, then use reflection to set the attributes. In both cases, if T meets concepts::named then the name must match the keyword. If T supports enumerate reflection, then use this.
Note: these cases are defined in the base case for string_converter such that they can be overwritten by type specific specializations.
|
inlinestatic |
convert an object to a type T
If T support reflection, then convert the attributes to a string. If T also meets concepts::named, then prefix the name.