version 3.3

VRS::StringUtils Class Reference

#include <vrs/stringutils.h>

List of all members.

Static Public Member Functions

static std::string Int2String (INT64 value, unsigned int width=0, char fillChar= ' ')
 Converts the given integer into a string representation.
static INT64 String2Int (const std::string &value, INT64 defaultValue=0)
 Tries to convert the given string into an integer value; on failure the default value will be returned.
static std::string Double2String (double value, int decimals=-1)
 Converts the given double value into a string representation.
static double String2Double (const std::string &value, double defaultValue=0.0)
 Tries to convert the given string into a double value; on failure the default value will be returned.
static bool String2DoubleC (const std::string &value, double &result)
 Tries to convert the given string into a double stored in result. Returns false on failure, otherwise true.
static std::string Bool2String (bool value, bool use0and1)
 Converts the given boolean value to a string representation.
static bool String2Bool (const std::string &value, bool defaultValue=false)
 Tries to convert the given string into a boolean value.
static std::string Color2String (const Color &color, char prefix= '#')
 Converts the given color value to a hex string representation "#RRGGBBAA" (with the given prefix character).
static Color String2Color (const std::string &color, const Color &defaultColor=Color::black, char prefix= '#')
 Tries to convert the given string into a color value.
static std::string Vector2String (const Vector &vec)
 Converts the given Vector to a string representation.
static Vector String2Vector (const std::string &vec, const Vector &defaultVector=Vector::origin)
 Tries to convert the given string into a Vector.
static std::string Matrix2String (const Matrix &mat)
 Converts a Matrix to a string using ';' as row- and ',' as column-delimiter.
static Matrix String2Matrix (const std::string &s, const Matrix &defaultValue=Matrix::identity)
 Converts a string to a Matrix using ';' as row- and ',' as column-delimiter.
static std::string Binary2Hex (SO< DataResource > binary)
 Converts the given binary data into an hex string.
static SO< DataResourceHex2Binary (const std::string &hex)
 Converts the given hex string to binary data.
static std::string TrimLeft (const std::string &str)
 Remove leading white spaces.
static std::string TrimRight (const std::string &str)
 Remove trailing white spaces.
static std::string Trim (const std::string &str)
 Remove leading and trailing white spaces.
static std::string ToLowerCase (const std::string &str)
 Converts all characters to lower case.
static std::string ToUpperCase (const std::string &str)
 Converts all characters to upper case.
static bool Split (const std::string &strToSplit, const std::string &separator, std::vector< std::string > &outParts)
 Splits a string into a vector of sub strings.
static std::string Replace (const std::string &str, const std::string &toReplace, const std::string &replaceWith)
 Replaces every occurence of "toReplace" in "str" by "replaceWith" and returns the resulting string.
static std::string Encrypt (const std::string &stringToEncrypt)
 Encrypts "stringToEncrypt" using VRS::MD5Filter filter.
static bool Decrypt (const std::string &stringToDecrypt, std::string &result)
 Decrypts "stringToDecrypt" using VRS::MD5Filter filter.


Member Function Documentation

static std::string VRS::StringUtils::Int2String ( INT64  value,
unsigned int  width = 0,
char  fillChar = ' ' 
) [static]

Converts the given integer into a string representation.

Parameters:
i Integer number
width The number of digits to be printed
fillChar is used to fill empty digits

static INT64 VRS::StringUtils::String2Int ( const std::string &  value,
INT64  defaultValue = 0 
) [static]

Tries to convert the given string into an integer value; on failure the default value will be returned.

static std::string VRS::StringUtils::Double2String ( double  value,
int  decimals = -1 
) [static]

Converts the given double value into a string representation.

"decimals" is the desired number of decimal places (including the decimal "."). If it is negative (default), there is no fixed number of decimal places. Otherwise the number of decimal places is forced to that value. Strings that are too short will be filled with "0".

static double VRS::StringUtils::String2Double ( const std::string &  value,
double  defaultValue = 0.0 
) [static]

Tries to convert the given string into a double value; on failure the default value will be returned.

static bool VRS::StringUtils::String2DoubleC ( const std::string &  value,
double &  result 
) [static]

Tries to convert the given string into a double stored in result. Returns false on failure, otherwise true.

static std::string VRS::StringUtils::Bool2String ( bool  value,
bool  use0and1 
) [static]

Converts the given boolean value to a string representation.

If "use0and1" is "true", the output will be "1" or "0". If "use0and1" is "false", the output will be "true" or "false".

static bool VRS::StringUtils::String2Bool ( const std::string &  value,
bool  defaultValue = false 
) [static]

Tries to convert the given string into a boolean value.

"true", "yes", "y" and "1" are set to "true". "false", "no", "n" and "0" are set to "false". If the given string starts with a "!", the returned value will be negated. On failure the given default value will be returned.

static std::string VRS::StringUtils::Color2String ( const Color color,
char  prefix = '#' 
) [static]

Converts the given color value to a hex string representation "#RRGGBBAA" (with the given prefix character).

If the 0x00-char prefix is used, the prefix will be omitted.

static Color VRS::StringUtils::String2Color ( const std::string &  color,
const Color defaultColor = Color::black,
char  prefix = '#' 
) [static]

Tries to convert the given string into a color value.

The following hex representations can be converted: "#RRGGBB", "#RRGGBBAA", "xRRGGBB", "xRRGGBBAA". In addition a special prefix character can be specified; if the 0x00-char is used as prefix, the prefix will be omitted. On failure the given default value will be returned.

static std::string VRS::StringUtils::Vector2String ( const Vector vec  )  [static]

Converts the given Vector to a string representation.

static Vector VRS::StringUtils::String2Vector ( const std::string &  vec,
const Vector defaultVector = Vector::origin 
) [static]

Tries to convert the given string into a Vector.

On failure the given default value will be returned.

static std::string VRS::StringUtils::Matrix2String ( const Matrix mat  )  [static]

Converts a Matrix to a string using ';' as row- and ',' as column-delimiter.

static Matrix VRS::StringUtils::String2Matrix ( const std::string &  s,
const Matrix defaultValue = Matrix::identity 
) [static]

Converts a string to a Matrix using ';' as row- and ',' as column-delimiter.

static std::string VRS::StringUtils::Binary2Hex ( SO< DataResource binary  )  [static]

Converts the given binary data into an hex string.

static SO<DataResource> VRS::StringUtils::Hex2Binary ( const std::string &  hex  )  [static]

Converts the given hex string to binary data.

static std::string VRS::StringUtils::TrimLeft ( const std::string &  str  )  [static]

Remove leading white spaces.

static std::string VRS::StringUtils::TrimRight ( const std::string &  str  )  [static]

Remove trailing white spaces.

static std::string VRS::StringUtils::Trim ( const std::string &  str  )  [static]

Remove leading and trailing white spaces.

static std::string VRS::StringUtils::ToLowerCase ( const std::string &  str  )  [static]

Converts all characters to lower case.

static std::string VRS::StringUtils::ToUpperCase ( const std::string &  str  )  [static]

Converts all characters to upper case.

static bool VRS::StringUtils::Split ( const std::string &  strToSplit,
const std::string &  separator,
std::vector< std::string > &  outParts 
) [static]

Splits a string into a vector of sub strings.

static std::string VRS::StringUtils::Replace ( const std::string &  str,
const std::string &  toReplace,
const std::string &  replaceWith 
) [static]

Replaces every occurence of "toReplace" in "str" by "replaceWith" and returns the resulting string.

static std::string VRS::StringUtils::Encrypt ( const std::string &  stringToEncrypt  )  [static]

Encrypts "stringToEncrypt" using VRS::MD5Filter filter.

Returns encrypted string.

static bool VRS::StringUtils::Decrypt ( const std::string &  stringToDecrypt,
std::string &  result 
) [static]

Decrypts "stringToDecrypt" using VRS::MD5Filter filter.

"result" will contain decrypted string if decryption was successful

Returns "true" if decryption was successful, otherwise "false".


The documentation for this class was generated from the following file:

Generated on Wed May 23 06:00:30 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact