Functions | |
void | Escape (std::string &text, char toBeEscaped) |
escape text by adding backslash before each instance of toBeEscaped character | |
void | UnEscape (std::string &text, char escaped) |
unescape text by removing backslash preceding each instance of escaped character | |
void | Replace (std::string &text, char oldChar, char newChar) |
replace oldChar with newChar in text. Escaped characters are not replaced. | |
size_t | Split (std::string source, std::list< std::string > &splitted, char separtator) |
split source into a list of substrings separated by separator | |
bool | StringToInt (std::string in, int &out, bool strictCheck) |
convert string to integer | |
bool | StringToBool (std::string in, bool &out) |
convert string to bool | |
bool | StringToDouble (std::string in, double &out, bool strictCheck) |
convert string to double | |
bool | StringToChar (const std::string &in, char &out) |
convert string to signed char (i.e. 8-bit int) | |
std::string | IntToString (int val) |
convert int value to string | |
std::string | BoolToString (bool val) |
convert bool value to string ("true" or "false") | |
std::string | DoubleToString (double val, int nDigits=4) |
convert double value to string | |
std::string | IntToHexString (int value) |
convert int value to string using hex representation | |
std::string & | SwallowSpaces (std::string &s) |
remove spaces and tabs from the beginning of s | |
std::string & | RSwallowSpaces (std::string &s) |
remove spaces and tabs from the end of s | |
std::string & | DoubleSwallowSpaces (std::string &s) |
remove spaces and tabs from both the beginning and the end of s | |
bool | StringToInt (const std::string &in, int &out) |
wrapper for StringToInt(in, out, true) | |
bool | StringToDouble (const std::string &in, double &out) |
wrapper for StringToDouble(in, out, true) |
std::string QStringHandler::DoubleToString | ( | double | val, | |
int | nDigits = 4 | |||
) |
convert double value to string
nDigits | total number of significant digits (defaults to 4) |
Referenced by QCommand::AddDoubleToAnswer(), QSlowControlClient::SetPSupplyIset(), and QSlowControlClient::SetPSupplyVset().
std::string QStringHandler::IntToHexString | ( | int | value | ) |
convert int value to string using hex representation
The returned string is prefixed with 0x
Referenced by QSlowControlServer::LoadElectronicsDevice(), and QSlowControlClient::WritePulser().
size_t QStringHandler::Split | ( | std::string | source, | |
std::list< std::string > & | splitted, | |||
char | separtator | |||
) |
split source into a list of substrings separated by separator
source | string to be splitted | |
splitted | list filled with splitted substrings | |
separator | character used to split source |
References DoubleSwallowSpaces().
Referenced by QBaseCmdParser::Parse(), QBaseCmdParser::ParseParameters(), and QBaseClient::ProcessAnswer().
bool QStringHandler::StringToBool | ( | std::string | in, | |
bool & | out | |||
) |
convert string to bool
References DoubleSwallowSpaces().
Referenced by QCommand::GetBool(), QBaseClient::GetBool(), and QCommand::GetBoolList().
bool QStringHandler::StringToChar | ( | const std::string & | in, | |
char & | out | |||
) |
convert string to signed char (i.e. 8-bit int)
References StringToInt().
Referenced by QNetworkString::GetCharParameter().
bool QStringHandler::StringToDouble | ( | std::string | in, | |
double & | out, | |||
bool | strictCheck | |||
) |
convert string to double
Does the same things as StringToInt() apart for the following:
References DoubleSwallowSpaces().
Referenced by QCommand::GetDouble(), QBaseClient::GetDouble(), QCommand::GetDoubleList(), and StringToDouble().
bool QStringHandler::StringToInt | ( | std::string | in, | |
int & | out, | |||
bool | strictCheck | |||
) |
convert string to integer
in | can be formatted as decimal or hex (must start with "0x") | |
strictCheck | determines the return value if only a part of input string can be converted |
References DoubleSwallowSpaces().
Referenced by QBaseClient::BuildError(), QCommand::GetInt(), QBaseClient::GetInt(), QCommand::GetIntList(), QNetworkString::GetIntParameter(), StringToChar(), and StringToInt().