QNetworkString Namespace Reference


Detailed Description

collection of utility functions used with network strings

Author:
sergio.didomizio@ge.infn.it


Functions

void FixNewLines (std::string &message)
 substitute all newline characters with special token '$'.
void RestoreNewLines (std::string &message)
 restore newline characters in network message
bool GetInt (const std::string &src, int &dest)
 convert string to int
bool GetBool (const std::string &src, bool &dest)
 convert string to bool
bool GetDouble (const std::string &src, double &dest)
 convert string to double
bool GetChar (const std::string &src, char &dest)
 convert string to char
std::string GetHexadecimal (int value)
 convert unsigned int value to string using hexadecimal format
bool GetParameter (const std::string &srcString, const std::string &parName, std::string &parVal, const char separator=DEFAULT_SEPARATOR)
 extract parameter from network string
bool GetIntParameter (const std::string &srcString, const std::string &parName, int &val, const char separator=DEFAULT_SEPARATOR)
 get integer parameter from network string
bool GetCharParameter (const std::string &srcString, const std::string &parName, char &val, const char separator=DEFAULT_SEPARATOR)
 get char parameter from network string
std::string GetDaqStatusString (const QDaqState daqState)
 convert QDaqState enum to corresponding human readable string
ProcessStatus_t GetProcessStatusCode (int code)
std::string GetProcessStatusString (ProcessStatus_t status)


Function Documentation

void QNetworkString::FixNewLines ( std::string &  message  ) 

substitute all newline characters with special token '$'.

Parameters:
message string to be parsed

bool QNetworkString::GetBool ( const std::string &  src,
bool &  dest 
)

convert string to bool

Parameters:
src source string
dest destination bool
Returns:
true on success, false on failure. In case of failure the value of dest is undefined.

bool QNetworkString::GetChar ( const std::string &  src,
char &  dest 
)

convert string to char

Parameters:
src source string
dest destination char
Returns:
true on success, false on failure.

bool QNetworkString::GetCharParameter ( const std::string &  srcString,
const std::string &  parName,
char &  val,
const char  separator = DEFAULT_SEPARATOR 
)

get char parameter from network string

Parameters:
srcString string from which parameter is to be extracted
parName parameter to be extracted
val destination char
Returns:
true on success, false on failure
this is a wrapper function that calls in sequence GetParameter() and GetChar() functions

bool QNetworkString::GetDouble ( const std::string &  src,
double &  dest 
)

convert string to double

Parameters:
src source string
dest destination bool
Returns:
true on success, false on failure

std::string QNetworkString::GetHexadecimal ( int  value  ) 

convert unsigned int value to string using hexadecimal format

Parameters:
value to convert

bool QNetworkString::GetInt ( const std::string &  src,
int &  dest 
)

convert string to int

Parameters:
src source string
dest destination int
Returns:
true on success, false on failure
The input string can be both in hex and decimal format In hex format the muber must begin with 0x

bool QNetworkString::GetIntParameter ( const std::string &  srcString,
const std::string &  parName,
int &  val,
const char  separator = DEFAULT_SEPARATOR 
)

get integer parameter from network string

Parameters:
srcString string from which parameter is to be extracted
parName parameter to be extracted
val destination int
separator character used in srcString to separate different parName=parVal pieces (defaults to DEFAULT_SEPARATOR)
Returns:
true on success, false on failure
this is a wrapper function that calls in sequence GetParameter() and GetInt() functions

bool QNetworkString::GetParameter ( const std::string &  srcString,
const std::string &  parName,
std::string &  parVal,
const char  separator = DEFAULT_SEPARATOR 
)

extract parameter from network string

Parameters:
srcString string from which parameter is to be extracted
parName parameter to be extracted
parVal string filled with value of requested parameter
separator character used in srcString to separate different parName=parVal pieces (defaults to DEFAULT_SEPARATOR)
Returns:
true on success, false on failure. In case of failure the value of parVal is undefined.
srcString must follow the syntax: par1=val1 par2=val2 ...

void QNetworkString::RestoreNewLines ( std::string &  message  ) 

restore newline characters in network message

Parameters:
message string to be parsed


Generated on Fri Mar 6 13:40:45 2009 for CUORE Software by  doxygen 1.5.1