Main Page | Modules | Alphabetical List | Class List | File List | Class Members | File Members

String handling helper functions


Functions

std::string trim (const std::string &orig)
template<typename T>
std::string dataToString (const T &x)
std::string intToString (int x, int width)
template<typename T>
void stringToData (const std::string &x, T &value)
template<typename T>
stringToData (const std::string &x)
void parse_file (const std::string &filename, std::map< std::string, std::string > &dict)

Function Documentation

std::string trim const std::string &  orig  ) 
 

Returns the string orig without leading and trailing whitespace.

template<typename T>
std::string dataToString const T &  x  ) 
 

Returns a string containing the text representation of x.

Care is taken that no information is lost in the conversion.

Definition at line 83 of file cxxutils.cc.

std::string intToString int  x,
int  width
 

Returns a string containing the text representation of x, padded with leading zeroes to width characters.

Definition at line 114 of file cxxutils.cc.

template<typename T>
void stringToData const std::string &  x,
T &  value
 

Reads a value of a given datatype from a string.

template<typename T>
T stringToData const std::string &  x  )  [inline]
 

Reads a value of a given datatype from a string.

Definition at line 223 of file cxxutils.h.

void parse_file const std::string &  filename,
std::map< std::string, std::string > &  dict
 

Parses the file filename and returns the key/value pairs in dict.


Generated on Fri Jul 8 09:37:14 2005 for LevelS C++ support library