libcamgm
|
#include <cstring>
#include <iosfwd>
#include <vector>
#include <string>
#include <iostream>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
class | ca_mgm::C_Str |
struct | ca_mgm::str::SafeBuf |
Namespaces | |
ca_mgm | |
ca_mgm::str | |
Macros | |
#define | for_(IT, BEG, END) for ( typeof(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT ) |
Functions | |
std::string | ca_mgm::str::toString (bool b) |
template<class _T > | |
std::string | ca_mgm::str::asString (const _T &t) |
template<> | |
std::string | ca_mgm::str::asString (const std::string &t) |
std::string | ca_mgm::str::form (const char *format,...) |
std::string | ca_mgm::str::strerror (int errno_r) |
std::string | ca_mgm::str::gsub (const std::string &sData, const std::string &sFrom, const std::string &sTo) |
Looks for text in a string and replaces it. More... | |
std::string & | ca_mgm::str::replaceAll (std::string &str, const std::string &from, const std::string &to) |
Looks for text in string and replaces it in place. More... | |
std::string | ca_mgm::str::stripFirstWord (std::string &line, const bool ltrim_first) |
std::string | ca_mgm::str::stripLastWord (std::string &line, const bool rtrim_first) |
std::string | ca_mgm::str::getline (std::istream &str, bool trim=false) |
std::string | ca_mgm::str::getline (std::istream &str, const Trim trim_r) |
std::string representation of number. | |
std::string | ca_mgm::str::numstring (char n, int w=0) |
std::string | ca_mgm::str::numstring (unsigned char n, int w=0) |
std::string | ca_mgm::str::numstring (short n, int w=0) |
std::string | ca_mgm::str::numstring (unsigned short n, int w=0) |
std::string | ca_mgm::str::numstring (int n, int w=0) |
std::string | ca_mgm::str::numstring (unsigned n, int w=0) |
std::string | ca_mgm::str::numstring (long n, int w=0) |
std::string | ca_mgm::str::numstring (unsigned long n, int w=0) |
std::string | ca_mgm::str::numstring (long long n, int w=0) |
std::string | ca_mgm::str::numstring (unsigned long long n, int w=0) |
std::string representation of number as hex value with leading '0x'. | |
Optional second argument sets the minimal string width (0 padded). Negative values will cause the number to be left adjusted within the string. Default width is 10 (4 for char). hexstring(42) -> "0x0000002a" hexstring(42, 4) -> "0x2a" hexstring(42,-4) -> "0x2a" | |
std::string | ca_mgm::str::hexstring (char n, int w=4) |
std::string | ca_mgm::str::hexstring (unsigned char n, int w=4) |
std::string | ca_mgm::str::hexstring (short n, int w=10) |
std::string | ca_mgm::str::hexstring (unsigned short n, int w=10) |
std::string | ca_mgm::str::hexstring (int n, int w=10) |
std::string | ca_mgm::str::hexstring (unsigned n, int w=10) |
std::string | ca_mgm::str::hexstring (long n, int w=10) |
std::string | ca_mgm::str::hexstring (unsigned long n, int w=10) |
std::string | ca_mgm::str::hexstring (long long n, int w=0) |
std::string | ca_mgm::str::hexstring (unsigned long long n, int w=0) |
std::string representation of number as octal value with leading '0'. | |
Optional second argument sets the minimal string width (0 padded). Negative values will cause the number to be left adjusted within the string. Default width is 5 (4 for char). octstring(42) -> "00052" octstring(42, 4) -> "0052" octstring(42,-4) -> "052 " | |
std::string | ca_mgm::str::octstring (char n, int w=4) |
std::string | ca_mgm::str::octstring (unsigned char n, int w=4) |
std::string | ca_mgm::str::octstring (short n, int w=5) |
std::string | ca_mgm::str::octstring (unsigned short n, int w=5) |
std::string | ca_mgm::str::octstring (int n, int w=5) |
std::string | ca_mgm::str::octstring (unsigned n, int w=5) |
std::string | ca_mgm::str::octstring (long n, int w=5) |
std::string | ca_mgm::str::octstring (unsigned long n, int w=5) |
std::string | ca_mgm::str::octstring (long long n, int w=0) |
std::string | ca_mgm::str::octstring (unsigned long long n, int w=0) |
template<typename _It > | |
_It | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
short | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
int | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
long | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
long long | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
unsigned short | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
unsigned | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
unsigned long | ca_mgm::str::strtonum (const C_Str &str) |
template<> | |
unsigned long long | ca_mgm::str::strtonum (const C_Str &str) |
template<typename _It > | |
_It | ca_mgm::str::strtonum (const C_Str &str, _It &i) |
bool | ca_mgm::str::strToTrue (const C_Str &str) |
bool | ca_mgm::str::strToFalse (const C_Str &str) |
bool | ca_mgm::str::strToBool (const C_Str &str, bool default_r) |
bool | ca_mgm::str::strToBoolNodefault (const C_Str &str, bool &return_r) |
Split. | |
template<class _OutputIterator > | |
unsigned | ca_mgm::str::split (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t") |
template<class _OutputIterator > | |
unsigned | ca_mgm::str::splitEscaped (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false) |
template<class _OutputIterator > | |
unsigned | ca_mgm::str::splitFields (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=":") |
template<class _OutputIterator > | |
unsigned | ca_mgm::str::splitFieldsEscaped (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=":") |
Join. | |
template<class _Iterator > | |
std::string | ca_mgm::str::join (_Iterator begin, _Iterator end, const C_Str &sep_r=" ") |
template<class _Container > | |
std::string | ca_mgm::str::join (const _Container &cont_r, const C_Str &sep_r=" ") |
template<class _Iterator > | |
std::string | ca_mgm::str::joinEscaped (_Iterator begin, _Iterator end, const char sep_r= ' ') |
std::string | ca_mgm::str::escape (const std::string &str_r, const char c= ' ') |
Hexencode. | |
Encode all characters other than [a-zA-Z0-9] as XX. This includes the % character itself, which becomes %25. | |
std::string | ca_mgm::str::hexencode (const C_Str &str_r) |
std::string | ca_mgm::str::hexdecode (const C_Str &str_r) |
Case conversion. | |
std::string | ca_mgm::str::toLower (const std::string &s) |
std::string | ca_mgm::str::toLower (const char *s) |
std::string | ca_mgm::str::toUpper (const std::string &s) |
std::string | ca_mgm::str::toUpper (const char *s) |
Case insensitive comparison. | |
int | ca_mgm::str::compareCI (const C_Str &lhs, const C_Str &rhs) |
Locate substring. | |
bool | ca_mgm::str::contains (const C_Str &str_r, const C_Str &val_r) |
bool | ca_mgm::str::containsCI (const C_Str &str_r, const C_Str &val_r) |
std::string prefix/suffix handling. | |
bool | ca_mgm::str::hasPrefix (const C_Str &str_r, const C_Str &prefix_r) |
bool | ca_mgm::str::hasPrefixCI (const C_Str &str_r, const C_Str &prefix_r) |
std::string | ca_mgm::str::stripPrefix (const C_Str &str_r, const C_Str &prefix_r) |
bool | ca_mgm::str::hasSuffix (const C_Str &str_r, const C_Str &suffix_r) |
bool | ca_mgm::str::hasSuffixCI (const C_Str &str_r, const C_Str &suffix_r) |
std::string | ca_mgm::str::stripSuffix (const C_Str &str_r, const C_Str &suffix_r) |
bool | ca_mgm::str::startsWith (const C_Str &str_r, const C_Str &prefix_r) |
bool | ca_mgm::str::startsWithCI (const C_Str &str_r, const C_Str &prefix_r) |
bool | ca_mgm::str::endsWith (const C_Str &str_r, const C_Str &prefix_r) |
bool | ca_mgm::str::endsWithCI (const C_Str &str_r, const C_Str &prefix_r) |
Trimming whitepace. | |
| |
enum | ca_mgm::str::Trim { ca_mgm::str::NO_TRIM = 0x00, ca_mgm::str::L_TRIM = 0x01, ca_mgm::str::R_TRIM = 0x02, ca_mgm::str::TRIM = (L_TRIM|R_TRIM) } |
std::string | ca_mgm::str::trim (const std::string &s, const Trim trim_r=TRIM) |
std::string | ca_mgm::str::ltrim (const std::string &s) |
std::string | ca_mgm::str::rtrim (const std::string &s) |
#define for_ | ( | IT, | |
BEG, | |||
END | |||
) | for ( typeof(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT ) |
Referenced by ca_mgm::str::joinEscaped().