util::StringFactory Class Reference

This class returns a number in the requested type. More...

List of all members.

Static Public Member Functions

Static Protected Member Functions

Static Protected Attributes


Detailed Description

This class returns a number in the requested type.

In case of string output this is a right adjusted string of selected length and (if possible) precision. The string is filled with leading blanks to match width.


Member Function Documentation

template<class T >
string util::StringFactory::floatToString ( const T  xd,
const int  width,
const int  precision,
const char  format 
) [inline, static, protected]

Convert float/double to string

Parameters:
format,: char to select the _floatfield_ format flag

  • 'd': default floating-point notation
  • 'f': fixed-point notation
  • 'e': scientific notation

References error_text, and factory_text.

template<class T >
string util::StringFactory::intToString ( const T  xd,
const int  width 
) [inline, static, protected]

References error_text, and factory_text.

static void util::StringFactory::changeFormat ( ostringstream &  s,
const char  format 
) [static, protected]

set the _floatfield_ format flag

Parameters:
s,: `ostringstream` where to write
format,: char to select the _floatfield_ format flag

  • 'd': default floating-point notation
  • 'f': fixed-point notation
  • 'e': scientific notation
static string util::StringFactory::toString ( const double  xd,
const int  width = DBL_DIG+7,
const int  precision = DBL_DIG,
const char  format = 'd' 
) [static]

Convert number to string

Parameters:
format,: (for double and float only) char to select the _floatfield_ format flag

  • 'd': default floating-point notation
  • 'f': fixed-point notation
  • 'e': scientific notation
static string util::StringFactory::toString ( const float  xd,
const int  width = FLT_DIG+7,
const int  precision = FLT_DIG,
const char  format = 'd' 
) [static]
static string util::StringFactory::toString ( const long  xd,
const int  width = ((sizeof(long)*8)/3)+1 
) [static]
static string util::StringFactory::toString ( const int  xd,
const int  width = ((sizeof(int)*8)/3)+1 
) [static]
static string util::StringFactory::toMinSecString ( const double  xd,
const int  precision = 0 
) [static]

Return xd in dd:mm:ss[.sss] format.

Precision gives No second decimals.

static int util::StringFactory::toInt ( const string &  xs  )  [inline, static]

Convert xs to integer number.

static long util::StringFactory::toLong ( const string &  xs  )  [inline, static]

Convert xs to long integer number.

static float util::StringFactory::toFloat ( const string &  xs  )  [inline, static]

Convert xs to float number.

dd:mm:ss[.sss] strings are automatically recognized.

References toDouble().

static double util::StringFactory::toDouble ( string  xs  )  [static]

Convert xs to double number.

dd:mm:ss[.sss] strings are automatically recognized.

Referenced by toFloat().


Member Data Documentation

const string util::StringFactory::factory_text [static, protected]

Referenced by floatToString(), and intToString().

const string util::StringFactory::error_text [static, protected]

Referenced by floatToString(), and intToString().


Generated on 19 Feb 2015 for LTL by  doxygen 1.6.1