Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

gloox::util Namespace Reference

A namespace holding a couple utility functions. More...


Functions

int log2 (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)
bool checkValidXMLChars (const std::string &data)
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)


Detailed Description

A namespace holding a couple utility functions.

Function Documentation

const std::string _lookup unsigned  code,
const char *  values[],
unsigned  size,
const std::string &  def = EmptyString
 

Finds the string associated with an enumerated type.

Parameters:
code Code of the string to search for.
values Array of String/Code pairs to look into.
size The array's size.
Returns:
The associated string (empty in case there's no match).

Definition at line 41 of file util.cpp.

unsigned _lookup const std::string &  str,
const char *  values[],
unsigned  size,
int  def = -1
 

Finds the enumerated value associated with a string value.

Parameters:
str String to search for.
values Array of String/Code pairs to look into.
size The array's size.
Returns:
The associated enum code.

Definition at line 33 of file util.cpp.

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.

Parameters:
code Code of the string to search for.
values Array of String/Code pairs to look into.
size The array's size.
Returns:
The associated string (empty in case there's no match).

Definition at line 52 of file util.cpp.

unsigned _lookup2 const std::string &  str,
const char *  values[],
unsigned  size,
int  def = -1
 

Finds the ORable enumerated value associated with a string value.

Parameters:
str String to search for.
values Array of String/Code pairs to look into.
size The array's size.
Returns:
The associated enum code.

Definition at line 46 of file util.cpp.

bool checkValidXMLChars const std::string &  data  ) 
 

Checks whether the given input is valid UTF-8.

Parameters:
data The data to check for validity.
Returns:
@b True if the input is valid UTF-8, false otherwise.

Definition at line 83 of file util.cpp.

const std::string escape std::string  what  ) 
 

Does some fancy escaping. (& --> &, etc).

Parameters:
what A string to escape.
Returns:
The escaped string.

Definition at line 65 of file util.cpp.

void ForEach T &  t,
f,
D1 &  d1,
D2 &  d2,
D3 &  d3
[inline]
 

A convenience function that executes the given function on each object in a given list, passing the given arguments.

Parameters:
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.

Definition at line 127 of file util.h.

void ForEach T &  t,
f,
D1 &  d1,
D2 &  d2
[inline]
 

A convenience function that executes the given function on each object in a given list, passing the given arguments.

Parameters:
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.

Definition at line 111 of file util.h.

void ForEach T &  t,
f,
D &  d
[inline]
 

A convenience function that executes the given function on each object in a given list, passing the given argument.

Parameters:
t The object to execute the function on.
f The function to execute.
d An argument to pass to the function.

Definition at line 96 of file util.h.

void ForEach T &  t,
f
[inline]
 

A convenience function that executes the given function on each object in a given list.

Parameters:
t The object to execute the function on.
f The function to execute.

Definition at line 82 of file util.h.

int log2 unsigned int  n  ) 
 

Custom log2() implementation.

Parameters:
n Figure to take the logarithm from.
Returns:
The logarithm to the basis of 2.

Definition at line 22 of file util.cpp.


Generated on Tue Apr 22 15:10:16 2008 for gloox by  doxygen 1.4.1