|
Utilities related to std::type_info. More...
#include <Type.h>
Classes | |
struct | isEnum |
struct | typeSetter |
Public Member Functions | |
Type (const Type &t) | |
template<class T > | |
Type (const T &t) | |
template<class T > | |
void | setType () |
template<class T > | |
void | setType (const T &t) |
Set current type to t. More... | |
template<class T > | |
Type & | operator= (const T &t) |
operator const std::type_info & () const | |
operator char () const | |
operator std::string () const | |
const std::type_info & | getType () const |
Deprecated! Use cast (above) instead? | |
Static Public Member Functions | |
static const std::type_info & | getTypeInfo (char t) |
Returns the base type associated with a character key. More... | |
static char | getTypeChar (const std::type_info &t) |
template<class F , class T > | |
static T | call (const std::type_info &t) |
Calls a static function that has no parameters. More... | |
template<class F , class D , class S > | |
static D | call (const S &typeCode) |
New, preferred implementation: a single if-then structure once and for all. More... | |
template<class F , class S > | |
static F::value_t | call (const S &typeCode) |
A shorthand for functors with a fixed return type, hence D = F::value_t. More... | |
template<class F , class T > | |
static void | call (T &target, const std::type_info &t) |
Static function call without parameters on a single target of type T. More... | |
template<class F , class T , class T2 > | |
static void | call (T &target, const T2 &t) |
Static function call with a single parameter. More... | |
static const std::type_info & | getTypeInfo (const char *typeCode) |
Returns the type corresponding to a single-character string. More... | |
static const std::type_info & | getTypeInfo (const std::string &typeCode) |
Returns the type corresponding to a single-character string. More... | |
static const std::type_info & | getTypeInfo (const Type &t) |
Convenience. Purpose is to have a full set of getTypeInfo commands for templated constructs. | |
static std::ostream & | toStream (std::ostream &ostr, const Type &t) |
Given a string, check if it could be stored as int or double instead of std::string . More... | |
static std::ostream & | toStreamFull (std::ostream &ostr, const Type &t) |
Protected Attributes | |
const std::type_info * | currentType |
Utilities related to std::type_info.
|
inlinestatic |
New, preferred implementation: a single if-then structure once and for all.
F | - struct implementing: T callback<S>() |
D | - destination type |
S | - selector type (char, std::string, drain::Type) |
|
inlinestatic |
A shorthand for functors with a fixed return type, hence D = F::value_t.
Simpler template with two arguments
F | - struct implementing: T::callback<S>() AND value_t (replacing destination type S) |
S | - selector type (char, std::string, drain::Type) |
|
inlinestatic |
Calls a static function that has no parameters.
Maps std::type_info to the corresponding template, calling a desired modifier function.
F | - struct with static method T callback<type>(), where type is a basetype or std::string. |
T | - return type |
|
inlinestatic |
Static function call without parameters on a single target of type T.
Maps std::type_info to the corresponding template, calling a desired modifier function.
F | - struct that implements static void callback<type>(T & target), where <type> is basetype or std::string. |
T | - target object class |
Example struct F:
|
inlinestatic |
Static function call with a single parameter.
Maps std::type_info to the corresponding template, calling a desired modifier function.
F | - struct that implements static callback<type>(T & target), where type is basetype or std::string. |
T | - target object class |
T2 | - selector type (Type or typecode as char or string) |
|
inlinestatic |
Returns the base type associated with a character key.
Notice that for integral types the signed and unsigned are denoted with uppercase and lowercase letters, respectivelty.
|
inlinestatic |
Returns the type corresponding to a single-character string.
Checks that a single letter is given, and calls call(char);
|
inlinestatic |
Returns the type corresponding to a single-character string.
Checks that a single letter is given, and calls call(char);
|
inline |
Set current type to t.
T | - type code: type_info, char, string or drain::Type. |
|
inlinestatic |
Given a string, check if it could be stored as int
or double
instead of std::string
.