libassa
3.5.1
|
Functions | |
void | split (const char *text_, std::vector< std::string > &vec_) |
Split character string into tokens separated by the whitespace character (blank, tab, newline, formfeed, and carriage return). More... | |
int | split_pair (const string &text_, char sep_, string &lhs_, string &rhs_) |
Split input string into two parts separated by the separator character. More... | |
int | ltrim (std::string &text_, const std::string &delim_) |
Trim string from the beginning to the left of the delimiter. More... | |
int | rtrim (std::string &text_, const std::string &delim_) |
Trim string from the delimiter to the end of the string. More... | |
void | trim_sides (std::string &text_) |
Trim white spaces and tabs from the beginning and the end of the text string. More... | |
void | find_and_replace_char (std::string &text_, char src_, char dest_) |
Find and relpace all instances of src_ character with dest_ character in a string text_. More... | |
std::string | strenv (const char *in_) |
Expand the passed string in_ by substituting environment variable names for their values. More... | |
std::string | get_cwd_name () |
Get current working directory. More... | |
void | sleep_for_seconds (long secs_to_sleep_) |
Portable sleep. More... | |
void ASSA::Utils::find_and_replace_char | ( | std::string & | text_, |
char | src_, | ||
char | dest_ | ||
) |
Find and relpace all instances of src_ character with dest_ character in a string text_.
text_ | String to modify |
src_ | Find the character |
dest_ | Character to replace with |
Definition at line 109 of file CommonUtils.cpp.
Referenced by ASSA::CmdLineOpts::parse_config_file().
std::string ASSA::Utils::get_cwd_name | ( | void | ) |
Get current working directory.
Definition at line 203 of file CommonUtils.cpp.
int ASSA::Utils::ltrim | ( | std::string & | text_, |
const std::string & | delim_ | ||
) |
Trim string from the beginning to the left of the delimiter.
Delimiter is removed as well.
text_ | String to modify |
delim_ | Delimiter character |
Definition at line 66 of file CommonUtils.cpp.
Referenced by ASSA::IniFile::trim_section_name().
int ASSA::Utils::rtrim | ( | std::string & | text_, |
const std::string & | delim_ | ||
) |
Trim string from the delimiter to the end of the string.
Delimiter is removed as well.
text_ | String to modify |
delim_ | Delimiter character |
Definition at line 79 of file CommonUtils.cpp.
Referenced by ASSA::IniFile::trim_section_name().
|
inline |
Portable sleep.
secs_to_sleep_ | Number of seconds to sleep |
Definition at line 142 of file CommonUtils.h.
void ASSA::Utils::split | ( | const char * | text_, |
std::vector< std::string > & | vec_ | ||
) |
Split character string into tokens separated by the whitespace character (blank, tab, newline, formfeed, and carriage return).
The vec_ vector is emptied out prior parsing string text_.
text_ | string of tokens to split |
vec_ | vector with tokens extracted from the string str_ |
Definition at line 33 of file CommonUtils.cpp.
int ASSA::Utils::split_pair | ( | const string & | text_, |
char | sep_, | ||
string & | lhs_, | ||
string & | rhs_ | ||
) |
Split input string into two parts separated by the separator character.
text_ | Input string to split |
sep_ | Separator character |
lhs_ | Return left-hand side of the input string |
rhs_ | Return right-hand side of the input string |
Definition at line 46 of file CommonUtils.cpp.
std::string ASSA::Utils::strenv | ( | const char * | in_ | ) |
Expand the passed string in_ by substituting environment variable names for their values.
Environment variables must be preceeded by dollar sign and optionally enclosed in parentheses: $ENV_NAME, or , or ${ENV_NAME}. $HOME is equivalent to '~' or '~username'. If later is used, "username" is looked up in the password file.
Definition at line 122 of file CommonUtils.cpp.
Referenced by ASSA::GenServer::init(), ASSA::GenServer::init_internals(), and ASSA::PidFileLock::lock().
void ASSA::Utils::trim_sides | ( | std::string & | text_ | ) |
Trim white spaces and tabs from the beginning and the end of the text string.
text_ | String to trim |
Definition at line 92 of file CommonUtils.cpp.