AnaMark Tuning Library
|
Functions | |
int | IsLetterOrUnderscore (int c) |
const char * | WhiteSpaceChars () |
std::string & | ToLower (std::string &str) |
std::string | GetAsLower (const std::string &str) |
std::string & | Trim (std::string &str) |
std::string & | RemoveSpaces (std::string &str) |
std::string & | Escape (std::string &str) |
std::string & | Unescape (std::string &str) |
bool | Eval (const std::string &input_string, std::string::size_type &pos, double &result) |
bool | Eval (const std::string &input_string, std::string::size_type &pos, long &result) |
bool | EvalKeyAndValue (std::string &input_string, std::string &key, std::string &value) |
bool | EvalSection (std::string &str) |
bool | EvalFunctionParam (std::string &str) |
bool | EvalString (std::string &str) |
void | Split (std::string &input_string, char separator, std::list< std::string > &resulting_strings, bool trim_resulting_strings, bool ignore_any_empty_split_strings) |
std::string | ltostr (long value) |
std::string | dtostr (double value) |
std::string | GetAsSection (const std::string &str) |
std::string | GetAsString (const std::string &str) |
std::string TUN::strx::dtostr | ( | double | value | ) |
Converts double to string.
value | Double to convert. |
std::string & TUN::strx::Escape | ( | std::string & | str | ) |
bool TUN::strx::Eval | ( | const std::string & | input_string, |
std::string::size_type & | pos, | ||
double & | result | ||
) |
Evaluate string as a double. Evaluation starts at input_string index pos.
input_string | Referenced string to evaluate. String is not modified. |
pos | Index in input_string to start evaluating. Passed variable modified to be first character after the double (if function returns true). |
result | Double that was evaluated (if function returns true). |
bool TUN::strx::Eval | ( | const std::string & | input_string, |
std::string::size_type & | pos, | ||
long & | result | ||
) |
Evaluate string as a long. Evaluation starts at input_string index pos.
input_string | Referenced string to evaluate. String is not modified. |
pos | Index in input_string to start evaluating. Passed variable modified to be first character after the long (if function returns true). |
result | Long that was evaluated (if function returns true). |
bool TUN::strx::EvalFunctionParam | ( | std::string & | str | ) |
Get the function parameters from str.
Removes encompassing "()" characters.
Modification happens in-place (str is modiifed).
str | Function parameters string. Of form "(function parameters)". |
bool TUN::strx::EvalKeyAndValue | ( | std::string & | input_string, |
std::string & | key, | ||
std::string & | value | ||
) |
Split a input string to key and value parts via the character '='.
input_string | String to extract key and value strings from. |
key | Used as output. String will be the key part of input_string. |
value | Used as output. String will be the value part of input_string. |
bool TUN::strx::EvalSection | ( | std::string & | str | ) |
Get the section name from str.
Removes encompassing "[]" characters, and converts str to lowercase.
Modification happens in-place (str is modiifed).
str | Section name string. Of form "[Section Name]". |
bool TUN::strx::EvalString | ( | std::string & | str | ) |
Get the string from str.
Removes encompassing quote characters (i.e. \"). Unescapes any characters preceeded with \
Modification happens in-place (str is modiifed).
str | Function parameters string. Of form "(function parameters)". |
std::string TUN::strx::GetAsLower | ( | const std::string & | str | ) |
Apply ToLower function on string. Return a copy, instead of a reference to the modified input.
str | Reference to string that will be converted to lowercase. |
std::string TUN::strx::GetAsSection | ( | const std::string & | str | ) |
Encompasses str with "[]".
Part of the TUN specification of having sections being declared with encompassing brackets.
str | String to add brackets around. Str is not modified. |
std::string TUN::strx::GetAsString | ( | const std::string & | str | ) |
Encompasses str with quotes, and converts all characters that must be escaped when programming (as defined in function Escape()) is prefaced with a \.
str | String to get as "string." Str is not modified. |
int TUN::strx::IsLetterOrUnderscore | ( | int | c | ) |
Replacement for Windows function __iscsymf.
c | The character. |
std::string TUN::strx::ltostr | ( | long | value | ) |
Convert long to string.
value | Long to convert. |
std::string & TUN::strx::RemoveSpaces | ( | std::string & | str | ) |
Remove all spaces in str.
Space characters are from that of the "C" locale.
Conversion is done in-place. Input string reference will be modified! Make a copy of string first if you dont want to modify your source string.
str | [description] |
void TUN::strx::Split | ( | std::string & | input_string, |
char | separator, | ||
std::list< std::string > & | resulting_strings, | ||
bool | trim_resulting_strings, | ||
bool | ignore_any_empty_split_strings | ||
) |
Split input_string into a list of strings at each seperator character in input_string.
input_string | String to split. Not modified. |
separator | Character to split input_string at. |
resulting_strings | Each seperate string as a list. List passed will be cleared to add the substrings! |
trim_resulting_strings | Set to true to trim each split string. |
ignore_any_empty_split_strings | Set to true to not add any substrings to resulting_strings if the substring is empty (i.e. no characters). |
std::string & TUN::strx::ToLower | ( | std::string & | str | ) |
Convert all characters to lower case using C++ function tolower.
Uses "C" locale regardless of global locale.
Conversion is done in-place. Input string reference will be modified! Make a copy of string first if you dont want to modify your source string.
str | Reference to string that will be converted. |
std::string & TUN::strx::Trim | ( | std::string & | str | ) |
Removes trailing and leading whitespace.
The whitespace considered is the whitespace in character array returned by WhiteSpaceChars().
Conversion is done in-place. Input string reference will be modified! Make a copy of string first if you dont want to modify your source string.
str | Reference of string to trim. |
std::string & TUN::strx::Unescape | ( | std::string & | str | ) |
const char * TUN::strx::WhiteSpaceChars | ( | ) |
Returns a string literal of the following whitespace characters in this order:
Returned string is the same regardless of locale.