Definition in file string_conversion.h.
#include "types_nl.h"
#include <map>
Go to the source code of this file.
Namespaces | |
namespace | NLMISC |
Defines | |
#define | NL_BEGIN_STRING_CONVERSION_TABLE(__type) |
#define | NL_END_STRING_CONVERSION_TABLE(__type, __tableName, __defaultValue) |
#define | NL_STRING_CONVERSION_TABLE_ENTRY(val) { #val, val}, |
|
Value: static const NLMISC::CStringConversion<__type>::CPair __type##_nl_string_conversion_table[] = \ { // The enumerated type for which a conversion should be defined enum TMyType { Foo = 0, Bar, FooBar, Unknown }; // The conversion table NL_BEGIN_STRING_CONVERSION_TABLE(TMyType) NL_STRING_CONVERSION_TABLE_ENTRY(Foo) NL_STRING_CONVERSION_TABLE_ENTRY(Bar) NL_STRING_CONVERSION_TABLE_ENTRY(FooBar) NL_END_STRING_CONVERSION_TABLE(TMyType, myConversionTable, Unknown) // Now, we can use the 'myConversionTable' intance std::string str = myConversionTable.toString(Bar) // returns "Bar" Definition at line 136 of file string_conversion.h. |
|
Value: }; \ NLMISC::CStringConversion<__type> \ __tableName(__type##_nl_string_conversion_table, sizeof(__type##_nl_string_conversion_table) \ / sizeof(__type##_nl_string_conversion_table[0]), __defaultValue); Definition at line 139 of file string_conversion.h. |
|
Definition at line 144 of file string_conversion.h. |