33 #define lookup( a, b ) _lookup( a, b, sizeof(b)/sizeof(char*) )
34 #define lookup2( a, b ) _lookup2( a, b, sizeof(b)/sizeof(char*) )
35 #define deflookup( a, b, c ) _lookup( a, b, sizeof(b)/sizeof(char*), c )
36 #define deflookup2( a, b, c ) _lookup2( a, b, sizeof(b)/sizeof(char*), c )
46 GLOOX_API
unsigned _lookup(
const std::string& str,
const char* values[],
47 unsigned size,
int def = -1 );
57 GLOOX_API
const std::string
_lookup(
unsigned code,
const char* values[],
58 unsigned size,
const std::string& def =
EmptyString );
68 GLOOX_API
unsigned _lookup2(
const std::string& str,
const char* values[],
69 unsigned size,
int def = -1 );
79 GLOOX_API
const std::string
_lookup2(
unsigned code,
const char* values[],
80 unsigned size,
const std::string& def =
EmptyString );
87 template<
typename T,
typename F >
90 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
101 template<
typename T,
typename F,
typename D >
104 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
116 template<
typename T,
typename F,
typename D1,
typename D2 >
117 inline void ForEach( T& t, F f, D1& d1, D2& d2 )
119 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
120 ( (*it)->*f )( d1, d2 );
132 template<
typename T,
typename F,
typename D1,
typename D2,
typename D3 >
133 inline void ForEach( T& t, F f, D1& d1, D2& d2, D3& d3 )
135 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
136 ( (*it)->*f )( d1, d2, d3 );
143 template<
typename T >
146 typename std::list< T* >::iterator it = L.begin();
147 typename std::list< T* >::iterator it2;
148 while( it != L.end() )
160 template<
typename Key,
typename T >
163 typename std::map< Key, T* >::iterator it = M.begin();
164 typename std::map< Key, T* >::iterator it2;
165 while( it != M.end() )
168 delete (*it2).second;
178 template<
typename Key,
typename T >
179 inline void clearMap( std::map< const Key, T* >& M )
181 typename std::map< const Key, T* >::iterator it = M.begin();
182 typename std::map< const Key, T* >::iterator it2;
183 while( it != M.end() )
186 delete (*it2).second;
198 GLOOX_API
const std::string
escape( std::string what );
209 GLOOX_API
void appendEscaped( std::string& target,
const std::string& data );
234 GLOOX_API
void replaceAll( std::string& target,
const std::string& find,
const std::string& replace );
242 static inline const std::string long2string(
long int value,
const int base = 10 )
244 if( base < 2 || base > 16 || value == 0 )
256 while( output.empty() || value > 0 )
258 output.insert( 0, 1, static_cast<char>( value % base +
'0' ) );
262 return sign + output;
270 static inline const std::string int2string(
int value )
272 return long2string( value );