Parfis
v0.0.7
|
#include <global.h>
Public Member Functions | |
template<> | |
int | setValueVec (std::vector< int > &vecRef, const std::string &str, char bra, char ket) |
Parses string of the format key=[val1, val2, val3, ...], where vals are int. Fills the supplied vector referece. More... | |
template<> | |
int | setValueVec (std::vector< double > &vecRef, const std::string &str, char bra, char ket) |
Parses string of the format key=[val1, val2, val3, ...], where vals are double. Fills the supplied vector referece. More... | |
template<> | |
double | getNthElement (const std::string &str, int n, char splitChar) |
Gets the n-th element from the array contained in the string and separated by the sepStr. More... | |
Static Public Member Functions | |
static std::string | currentDateTime () |
Get current date and time in the format YYYY-MM-DD HH:mm:ss. More... | |
static std::string | removeWhitespace (const std::string &str) |
Remove all characters that return true to ::isspace. More... | |
static std::tuple< std::string, std::string > | splitKeyValue (const std::string &str) |
Create key,value pair from "key=value" string. More... | |
static std::tuple< std::string, std::string > | splitKeyString (const std::string &str) |
Gets string after '=' and '#' or end of string. Captures all data as value, range and type of the data string. Used mainly for parsing data that is not the value (ex. range). More... | |
static std::string | childName (const std::string &str) |
Return last child name if there is a '.' as a parent-child classifier. More... | |
static std::tuple< std::string, std::string > | splitDot (const std::string &str) |
Splits string with a dot to two strings, before and after the dot. More... | |
static bool | fileExists (const std::string &fname) |
Check if file. More... | |
static std::vector< std::string > | getVector (const std::string &str, char bra, char ket) |
Parses string and returns vector of elements. More... | |
static std::vector< std::string > | getInheritanceVector (const std::string &str) |
Returns vector of iheritance. More... | |
template<class T > | |
static int | setValueVec (std::vector< T > &vecRef, const std::string &str, char bra, char ket) |
template<class T > | |
static T | getNthElement (const std::string &str, int n, char splitChar=',') |
static std::string | to_string (double num) |
Convert double to string. | |
static std::string | to_string (float num) |
Convert float to string. | |
static std::string | to_string (int num) |
Comvert int to string (for completness and use in Vec3D struct) | |
Global functions.
|
static |
Return last child name if there is a '.' as a parent-child classifier.
str | string of the format "parent.child.child..." |
|
static |
Get current date and time in the format YYYY-MM-DD HH:mm:ss.
Get current date and time as a string.
|
static |
Check if file.
fname | exists |
|
static |
Returns vector of iheritance.
Splits a string where the split character is dot and constructs a vector
str | string in the format grandparent.parent.child |
double parfis::Global::getNthElement | ( | const std::string & | str, |
int | n, | ||
char | splitChar | ||
) |
Gets the n-th element from the array contained in the string and separated by the sepStr.
double |
str | String containing the array of values |
n | Order of element to be returned |
splitChar | Spliting character (default is ',') |
|
static |
Parses string and returns vector of elements.
str | string to be parsed of the form [a,b,c] |
bra | starting array character (ex. '[' or '(') |
ket | ending array character (ex. ']' or ')') |
|
static |
Remove all characters that return true to ::isspace.
str | original string |
int parfis::Global::setValueVec | ( | std::vector< double > & | vecRef, |
const std::string & | str, | ||
char | bra, | ||
char | ket | ||
) |
Parses string of the format key=[val1, val2, val3, ...], where vals are double. Fills the supplied vector referece.
double |
vecRef | Vector referece to be filled with data |
str | Data defined as string |
bra | Vector starts with bra character (usually '[') |
ket | Vector ends with character (usually ']') |
int parfis::Global::setValueVec | ( | std::vector< int > & | vecRef, |
const std::string & | str, | ||
char | bra, | ||
char | ket | ||
) |
Parses string of the format key=[val1, val2, val3, ...], where vals are int. Fills the supplied vector referece.
int |
vecRef | Vector referece to be filled with data |
str | Data defined as string |
bra | Vector starts with bra character (usually '[') |
ket | Vector ends with character (usually ']') |
|
static |
Splits string with a dot to two strings, before and after the dot.
str | The string that has data in the forman str1.str2 |
|
static |
Gets string after '=' and '#' or end of string. Captures all data as value, range and type of the data string. Used mainly for parsing data that is not the value (ex. range).
str | The string that has data in the forman key=value <additional data> (range data) |
|
static |
Create key,value pair from "key=value" string.
str | String must be without whitespace characters |