string_conversion.h File Reference


Detailed Description

Id
string_conversion.h,v 1.4 2003/09/03 14:44:00 fleury Exp

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},


Define Documentation

#define NL_BEGIN_STRING_CONVERSION_TABLE __type   ) 
 

Value:

static const NLMISC::CStringConversion<__type>::CPair __type##_nl_string_conversion_table[] =          \
{
This macro helps building a string conversion table Example of use :

// 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.

#define NL_END_STRING_CONVERSION_TABLE __type,
__tableName,
__defaultValue   ) 
 

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.

#define NL_STRING_CONVERSION_TABLE_ENTRY val   )     { #val, val},
 

Definition at line 144 of file string_conversion.h.


Generated on Tue Mar 16 06:43:22 2004 for NeL by doxygen 1.3.6