gloox
1.0.1
|
Classes | |
class | AtomicRefCount |
A simple implementation of a thread safe 32-bit reference count. Native functions are used where possible. When not available, a mutex is used for locking and unlocking. More... | |
class | Mutex |
A simple implementation of mutex as a wrapper around a pthread mutex or a win32 critical section. More... | |
class | MutexGuard |
A simple implementation of a mutex guard. More... |
Functions | |
int | internalLog2 (unsigned int n) |
unsigned | _lookup (const std::string &str, const char *values[], unsigned size, int def) |
const std::string | _lookup (unsigned code, const char *values[], unsigned size, const std::string &def) |
unsigned | _lookup2 (const std::string &str, const char *values[], unsigned size, int def) |
const std::string | _lookup2 (unsigned code, const char *values[], unsigned size, const std::string &def) |
const std::string | escape (std::string what) |
void | appendEscaped (std::string &target, const std::string &data) |
bool | checkValidXMLChars (const std::string &data) |
void | replaceAll (std::string &target, const std::string &find, const std::string &replace) |
template<typename T , typename F > | |
void | ForEach (T &t, F f) |
template<typename T , typename F , typename D > | |
void | ForEach (T &t, F f, D &d) |
template<typename T , typename F , typename D1 , typename D2 > | |
void | ForEach (T &t, F f, D1 &d1, D2 &d2) |
template<typename T , typename F , typename D1 , typename D2 , typename D3 > | |
void | ForEach (T &t, F f, D1 &d1, D2 &d2, D3 &d3) |
template<typename T > | |
void | clearList (std::list< T * > &L) |
template<typename Key , typename T > | |
void | clearMap (std::map< Key, T * > &M) |
template<typename Key , typename T > | |
void | clearMap (std::map< const Key, T * > &M) |
A namespace holding a couple utility functions.
GLOOX_API unsigned _lookup | ( | const std::string & | str, |
const char * | values[], | ||
unsigned | size, | ||
int | def = -1 |
||
) |
GLOOX_API const std::string _lookup | ( | unsigned | code, |
const char * | values[], | ||
unsigned | size, | ||
const std::string & | def = EmptyString |
||
) |
Finds the string associated with an enumerated type.
code | Code of the string to search for. |
values | Array of String/Code pairs to look into. |
size | The array's size. |
def | Default value returned in case the lookup failed. |
GLOOX_API unsigned _lookup2 | ( | const std::string & | str, |
const char * | values[], | ||
unsigned | size, | ||
int | def = -1 |
||
) |
GLOOX_API const std::string _lookup2 | ( | unsigned | code, |
const char * | values[], | ||
unsigned | size, | ||
const std::string & | def = EmptyString |
||
) |
Finds the string associated with an ORable enumerated type.
code | Code of the string to search for. |
values | Array of String/Code pairs to look into. |
size | The array's size. |
def | The default value to return if the lookup failed. |
GLOOX_API void appendEscaped | ( | std::string & | target, |
const std::string & | data | ||
) |
Append the data to the target, doing any necessary escaping along the way (& –> &, etc). This method is faster than calling "escape" and appending the return value, especially for source strings that don't need any escaping.
target | The string to append the data to. |
data | The string to append that might need escaping. |
GLOOX_API bool checkValidXMLChars | ( | const std::string & | data | ) |
|
inline |
|
inline |
|
inline |
GLOOX_API const std::string escape | ( | std::string | what | ) |
|
inline |
|
inline |
|
inline |
A convenience function that executes the given function on each object in a given list, passing the given arguments.
t | The object to execute the function on. |
f | The function to execute. |
d1 | An argument to pass to the function. |
d2 | An argument to pass to the function. |
|
inline |
A convenience function that executes the given function on each object in a given list, passing the given arguments.
t | The object to execute the function on. |
f | The function to execute. |
d1 | An argument to pass to the function. |
d2 | An argument to pass to the function. |
d3 | An argument to pass to the function. |
GLOOX_API int internalLog2 | ( | unsigned int | n | ) |
GLOOX_API void replaceAll | ( | std::string & | target, |
const std::string & | find, | ||
const std::string & | replace | ||
) |
Replace all instances of one substring of arbitrary length with another substring of arbitrary length. Replacement happens in place (so make a copy first if you don't want the original modified).
target | The string to process. Changes are made "in place". |
find | The sub-string to find within the target string |
replace | The sub-string to substitute for the find string. |