ParCompMark::StringConverter Class Reference

#include <PCMStringConverter.h>

List of all members.


Detailed Description

Convert different types to std::string.

Definition at line 58 of file PCMStringConverter.h.


Class methods

static std::string toString (const u8 &value)
 Convert u8 to string.
static std::string toString (const u16 &value)
 Convert u16 to string.
static std::string toString (const u32 &value)
 Convert u32 to string.
static std::string toString (const s8 &value)
 Convert s8 to string.
static std::string toString (const s16 &value)
 Convert s16 to string.
static std::string toString (const s32 &value)
 Convert s32 to string.
static std::string toString (const Real &value, const s32 &fieldWidth=StringConverter::DEFAULTFIELDWIDTH, const s32 &precision=StringConverter::DEFAULTPRECISION)
 Convert Real to string.
static std::string toString (const bool value)
 Convert bool to string.
static std::string toString (const void *value)
 Convert void * to string.
static u32 toU32 (const std::string value)
 Convert string to u32.
static Real toReal (const std::string value)
 Convert string to Real.
static void * parsePointer (const std::string value)
 Convert string to void *.
static void trim (std::string &str)
 Leave whitespaces from the beginning and the end of the string.
static std::vector< std::string > tokenize (const std::string &str, const char *delimiters)
 Tokenize the specified string.
static std::string _fitFieldWidth (const std::string &str, const s32 &fieldWidth)
 Append empty spaces to fit to field width.

Static Public Attributes

Class constants
static const s32 DEFAULTPRECISION = -1
 Constant for default precision.
static const s32 DEFAULTFIELDWIDTH = -1
 Constant for default field width.

Member Function Documentation

std::string ParCompMark::StringConverter::_fitFieldWidth ( const std::string &  str,
const s32 fieldWidth 
) [static, protected]

Append empty spaces to fit to field width.

Parameters:
[in] str String to fill to fit to the field width.
[in] fieldWidth Field width.
Returns:
Converted string value

Definition at line 233 of file PCMStringConverter.cpp.

References DEFAULTFIELDWIDTH.

Referenced by toString().

void * ParCompMark::StringConverter::parsePointer ( const std::string  value  )  [static]

Convert string to void *.

Parameters:
[in] value Value to convert.
Returns:
Converted pointer

Definition at line 157 of file PCMStringConverter.cpp.

Referenced by ParCompMark::OpenGLRenderingEngine::create().

std::vector< std::string > ParCompMark::StringConverter::tokenize ( const std::string &  str,
const char *  delimiters 
) [static]

Tokenize the specified string.

Original source: http://www.digitalpeer.com/id/simple

Parameters:
[in] str String to trim.
[in] delimiters String to trim.
Returns:
Array of tokens.

Definition at line 183 of file PCMStringConverter.cpp.

Referenced by ParCompMark::FileSystemManager::findLibraryPath(), and ParCompMark::Application::initialize().

Real ParCompMark::StringConverter::toReal ( const std::string  value  )  [static]

Convert string to Real.

Parameters:
[in] value Value to convert.
Returns:
Converted Real value

Definition at line 145 of file PCMStringConverter.cpp.

std::string ParCompMark::StringConverter::toString ( const void *  value  )  [static]

Convert void * to string.

Parameters:
[in] value Value to convert.
Returns:
Converted string value

Definition at line 124 of file PCMStringConverter.cpp.

std::string ParCompMark::StringConverter::toString ( const bool  value  )  [static]

Convert bool to string.

Parameters:
[in] value Value to convert.
Returns:
Converted string value

Definition at line 115 of file PCMStringConverter.cpp.

std::string ParCompMark::StringConverter::toString ( const Real value,
const s32 fieldWidth = StringConverter::DEFAULTFIELDWIDTH,
const s32 precision = StringConverter::DEFAULTPRECISION 
) [static]

Convert Real to string.

If the precision is set, the real value is converted in fixed point notation scientific notation otherwise.

Parameters:
[in] value Value to convert.
[in] fieldWidth Field width.
[in] precision Number of fragment digits.
Returns:
Converted string value

Definition at line 99 of file PCMStringConverter.cpp.

References _fitFieldWidth(), and DEFAULTPRECISION.

Here is the call graph for this function:

std::string ParCompMark::StringConverter::toString ( const s32 value  )  [static]

Convert s32 to string.

Parameters:
[in] value Value to convert.
Returns:
Converted string value

Definition at line 90 of file PCMStringConverter.cpp.

std::string ParCompMark::StringConverter::toString ( const s16 value  )  [static]

Convert s16 to string.

Parameters:
[in] value Value to convert.
Returns:
Converted string value

Definition at line 81 of file PCMStringConverter.cpp.

std::string ParCompMark::StringConverter::toString ( const s8 value  )  [static]

Convert s8 to string.

Parameters:
[in] value Value to convert.
Returns:
Converted string value

Definition at line 72 of file PCMStringConverter.cpp.

std::string ParCompMark::StringConverter::toString ( const u32 value  )  [static]

Convert u32 to string.

Parameters:
[in] value Value to convert.
Returns:
Converted string value

Definition at line 63 of file PCMStringConverter.cpp.

std::string ParCompMark::StringConverter::toString ( const u16 value  )  [static]

Convert u16 to string.

Parameters:
[in] value Value to convert.
Returns:
Converted string value

Definition at line 54 of file PCMStringConverter.cpp.

u32 ParCompMark::StringConverter::toU32 ( const std::string  value  )  [static]

Convert string to u32.

Parameters:
[in] value Value to convert.
Returns:
Converted u32 value

Definition at line 133 of file PCMStringConverter.cpp.

Referenced by ParCompMark::Client::handleMessage(), and ParCompMark::Application::setExpectedHostCount().

void ParCompMark::StringConverter::trim ( std::string &  str  )  [static]

Leave whitespaces from the beginning and the end of the string.

Parameters:
[out] str String to trim.

Definition at line 168 of file PCMStringConverter.cpp.

Referenced by ParCompMark::FileSystemManager::_replaceHomeChar(), ParCompMark::ConfigOptions::loadFromIniFile(), and ParCompMark::PluginManager::loadPlugins_old().


Member Data Documentation

Constant for default field width.

Remarks:
This is own attribute of this class.

Definition at line 89 of file PCMStringConverter.h.

Referenced by _fitFieldWidth(), ParCompMark::Application::_start(), and ParCompMark::Process::gatherStatistics().

Constant for default precision.

Remarks:
This is own attribute of this class.

Definition at line 82 of file PCMStringConverter.h.

Referenced by toString().


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