34 #define lookup( a, b ) _lookup( a, b, sizeof(b)/sizeof(char*) )
35 #define lookup2( a, b ) _lookup2( a, b, sizeof(b)/sizeof(char*) )
36 #define deflookup( a, b, c ) _lookup( a, b, sizeof(b)/sizeof(char*), c )
37 #define deflookup2( a, b, c ) _lookup2( a, b, sizeof(b)/sizeof(char*), c )
47 GLOOX_API
unsigned _lookup(
const std::string& str,
const char* values[],
48 unsigned size,
int def = -1 );
58 GLOOX_API
const std::string
_lookup(
unsigned code,
const char* values[],
59 unsigned size,
const std::string& def =
EmptyString );
69 GLOOX_API
unsigned _lookup2(
const std::string& str,
const char* values[],
70 unsigned size,
int def = -1 );
80 GLOOX_API
const std::string
_lookup2(
unsigned code,
const char* values[],
81 unsigned size,
const std::string& def =
EmptyString );
88 std::string
hex(
const std::string& input );
95 template<
typename T,
typename F >
98 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
109 template<
typename T,
typename F,
typename D >
112 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
124 template<
typename T,
typename F,
typename D1,
typename D2 >
125 inline void ForEach( T& t, F f, D1& d1, D2& d2 )
127 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
128 ( (*it)->*f )( d1, d2 );
140 template<
typename T,
typename F,
typename D1,
typename D2,
typename D3 >
141 inline void ForEach( T& t, F f, D1& d1, D2& d2, D3& d3 )
143 for(
typename T::iterator it = t.begin(); it != t.end(); ++it )
144 ( (*it)->*f )( d1, d2, d3 );
151 template<
typename T >
154 typename std::list< T* >::iterator it = L.begin();
155 typename std::list< T* >::iterator it2;
156 while( it != L.end() )
168 template<
typename Key,
typename T >
171 typename std::map< Key, T* >::iterator it = M.begin();
172 typename std::map< Key, T* >::iterator it2;
173 while( it != M.end() )
176 delete (*it2).second;
186 template<
typename Key,
typename T >
187 inline void clearMap( std::map< const Key, T* >& M )
189 typename std::map< const Key, T* >::iterator it = M.begin();
190 typename std::map< const Key, T* >::iterator it2;
191 while( it != M.end() )
194 delete (*it2).second;
206 GLOOX_API
const std::string
escape( std::string what );
217 GLOOX_API
void appendEscaped( std::string& target,
const std::string& data );
242 GLOOX_API
void replaceAll( std::string& target,
const std::string& find,
const std::string& replace );
250 static inline const std::string long2string(
long int value,
const int base = 10 )
252 if( base < 2 || base > 16 || value == 0 )
264 while( output.empty() || value > 0 )
266 output.insert(
static_cast<size_t>( 0 ),
static_cast<size_t>( 1 ),
static_cast<char>( value % base +
'0' ) );
270 return sign + output;
278 static inline const std::string int2string(
int value )
280 return long2string( value );
int internalLog2(unsigned int n)
unsigned _lookup(const std::string &str, const char *values[], unsigned size, int def)
unsigned _lookup2(const std::string &str, const char *values[], unsigned size, int def)
void clearMap(std::map< Key, T * > &M)
void appendEscaped(std::string &target, const std::string &data)
void replaceAll(std::string &target, const std::string &find, const std::string &replace)
bool checkValidXMLChars(const std::string &data)
void clearList(std::list< T * > &L)
std::string hex(const std::string &input)
const std::string escape(std::string what)
The namespace for the gloox library.
const std::string EmptyString