#include <cstring>
#include <iosfwd>
#include <vector>
#include <string>
#include <sstream>
#include "zypp/base/Easy.h"
#include "zypp/base/PtrTypes.h"
Go to the source code of this file.
Classes | |
class | zypp::C_Str |
Convenience char* constructible from std::string and char* , it maps (char*)0 to an empty string. More... | |
struct | zypp::str::SafeBuf |
Assert free called for allocated char * . More... | |
struct | zypp::str::Str |
Convenient building of std::string via std::ostream::operator<<. More... | |
Namespaces | |
namespace | zypp |
Easy-to use interface to the ZYPP dependency resolver. | |
namespace | zypp::str |
String related utilities and Regular expressions. | |
Functions | |
std::string | zypp::str::asString (const std::string &t) |
Global asString() that works with std::string too. | |
std::string | zypp::str::asString (const char *t) |
template<class _T > | |
std::string | zypp::str::asString (const _T &t) |
template<class _T > | |
std::string | zypp::str::asString (const intrusive_ptr< _T > &p) |
template<class _T > | |
std::string | zypp::str::asString (const weak_ptr< _T > &p) |
template<> | |
std::string | zypp::str::asString (const bool &t) |
std::string | zypp::str::form (const char *format,...) __attribute__((format(printf |
Printf style construction of std::string. | |
std::string | zypp::str::strerror (int errno_r) |
Return string describing the error_r code. | |
std::string | zypp::str::gsub (const std::string &sData, const std::string &sFrom, const std::string &sTo) |
Looks for text in a string and replaces it. | |
std::string & | zypp::str::replaceAll (std::string &str, const std::string &from, const std::string &to) |
Looks for text in string and replaces it in place. | |
std::string | zypp::str::stripFirstWord (std::string &line, const bool ltrim_first) |
std::string | zypp::str::stripLastWord (std::string &line, const bool rtrim_first) |
std::string | zypp::str::getline (std::istream &str, bool trim) |
std::string | zypp::str::getline (std::istream &str, const Trim trim_r) |
String representation of number. | |
std::string | zypp::str::numstring (char n, int w=0) |
std::string | zypp::str::numstring (unsigned char n, int w=0) |
std::string | zypp::str::numstring (short n, int w=0) |
std::string | zypp::str::numstring (unsigned short n, int w=0) |
std::string | zypp::str::numstring (int n, int w=0) |
std::string | zypp::str::numstring (unsigned n, int w=0) |
std::string | zypp::str::numstring (long n, int w=0) |
std::string | zypp::str::numstring (unsigned long n, int w=0) |
std::string | zypp::str::numstring (long long n, int w=0) |
std::string | zypp::str::numstring (unsigned long long n, int w=0) |
template<> | |
std::string | zypp::str::asString (const char &t) |
template<> | |
std::string | zypp::str::asString (const unsigned char &t) |
template<> | |
std::string | zypp::str::asString (const short &t) |
template<> | |
std::string | zypp::str::asString (const unsigned short &t) |
template<> | |
std::string | zypp::str::asString (const int &t) |
template<> | |
std::string | zypp::str::asString (const unsigned &t) |
template<> | |
std::string | zypp::str::asString (const long &t) |
template<> | |
std::string | zypp::str::asString (const unsigned long &t) |
template<> | |
std::string | zypp::str::asString (const long long &t) |
template<> | |
std::string | zypp::str::asString (const unsigned long long &t) |
String representation of number as hex value with leading '0x'. | |
std::string | zypp::str::hexstring (char n, int w=4) |
std::string | zypp::str::hexstring (unsigned char n, int w=4) |
std::string | zypp::str::hexstring (short n, int w=10) |
std::string | zypp::str::hexstring (unsigned short n, int w=10) |
std::string | zypp::str::hexstring (int n, int w=10) |
std::string | zypp::str::hexstring (unsigned n, int w=10) |
std::string | zypp::str::hexstring (long n, int w=10) |
std::string | zypp::str::hexstring (unsigned long n, int w=10) |
std::string | zypp::str::hexstring (long long n, int w=0) |
std::string | zypp::str::hexstring (unsigned long long n, int w=0) |
String representation of number as octal value with leading '0'. | |
std::string | zypp::str::octstring (char n, int w=4) |
std::string | zypp::str::octstring (unsigned char n, int w=4) |
std::string | zypp::str::octstring (short n, int w=5) |
std::string | zypp::str::octstring (unsigned short n, int w=5) |
std::string | zypp::str::octstring (int n, int w=5) |
std::string | zypp::str::octstring (unsigned n, int w=5) |
std::string | zypp::str::octstring (long n, int w=5) |
std::string | zypp::str::octstring (unsigned long n, int w=5) |
std::string | zypp::str::octstring (long long n, int w=0) |
std::string | zypp::str::octstring (unsigned long long n, int w=0) |
template<typename _It > | |
_It | zypp::str::strtonum (const C_Str &str) |
Parsing numbers from string. | |
template<> | |
short | zypp::str::strtonum (const C_Str &str) |
Parsing numbers from string. | |
template<typename _It > | |
_It | zypp::str::strtonum (const C_Str &str, _It &i) |
String to integer type detemined 2nd function arg i. | |
bool | zypp::str::strToTrue (const C_Str &str) |
Parsing boolean from string. | |
bool | zypp::str::strToFalse (const C_Str &str) |
Return false if str is 0, false, no, off . | |
bool | zypp::str::strToBool (const C_Str &str, bool default_r) |
Parse str into a bool depending on the default value. | |
bool | zypp::str::strToBoolNodefault (const C_Str &str, bool &return_r) |
Parse str into a bool if it's a legal true or false string. | |
Split. | |
template<class _OutputIterator > | |
unsigned | zypp::str::split (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t") |
Split line_r into words. | |
template<class _OutputIterator > | |
unsigned | zypp::str::splitEscaped (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false) |
Split line_r into words with respect to escape delimeters. | |
template<class _OutputIterator > | |
unsigned | zypp::str::splitFields (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=":") |
Split line_r into fields. | |
template<class _OutputIterator > | |
unsigned | zypp::str::splitFieldsEscaped (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=":") |
Split line_r into fields handling also escaped separators. | |
Join. | |
template<class _Iterator > | |
std::string | zypp::str::join (_Iterator begin, _Iterator end, const C_Str &sep_r=" ") |
Join strings using separator sep_r (defaults to BLANK). | |
template<class _Container > | |
std::string | zypp::str::join (const _Container &cont_r, const C_Str &sep_r=" ") |
Join strings using separator sep_r (defaults to BLANK). | |
template<class _Iterator > | |
std::string | zypp::str::joinEscaped (_Iterator begin, _Iterator end, const char sep_r= ' ') |
Join strings using separator sep_r, quoting or escaping the values. | |
std::string | zypp::str::escape (const C_Str &str_r, const char c= ' ') |
Escape desired character c using a backslash. | |
void | zypp::str::appendEscaped (std::string &str_r, const C_Str &next_r, const char sep_r= ' ') |
Escape next_r and append it to str_r using separator sep_r. | |
Hexencode. | |
Encode all characters other than [a-zA-Z0-9] as XX.
This includes the % character itself, which becomes 25. | |
std::string | zypp::str::hexencode (const C_Str &str_r) |
Encode all characters other than [a-zA-Z0-9] as XX. | |
std::string | zypp::str::hexdecode (const C_Str &str_r) |
Decode hexencoded XX sequences. | |
Case conversion. | |
std::string | zypp::str::toLower (const std::string &s) |
Return lowercase version of s. | |
std::string | zypp::str::toLower (const char *s) |
std::string | zypp::str::toUpper (const std::string &s) |
Return uppercase version of s. | |
std::string | zypp::str::toUpper (const char *s) |
Case insensitive comparison. | |
int | zypp::str::compareCI (const C_Str &lhs, const C_Str &rhs) |
Locate substring. | |
bool | zypp::str::contains (const C_Str &str_r, const C_Str &val_r) |
Locate substring case sensitive. | |
bool | zypp::str::containsCI (const C_Str &str_r, const C_Str &val_r) |
Locate substring case insensitive. | |
String prefix/suffix handling. | |
bool | zypp::str::hasPrefix (const C_Str &str_r, const C_Str &prefix_r) |
Return whether str_r has prefix prefix_r. | |
std::string | zypp::str::stripPrefix (const C_Str &str_r, const C_Str &prefix_r) |
Strip a prefix_r from str_r and return the resulting string. | |
bool | zypp::str::hasSuffix (const C_Str &str_r, const C_Str &suffix_r) |
Return whether str_r has suffix suffix_r. | |
std::string | zypp::str::stripSuffix (const C_Str &str_r, const C_Str &suffix_r) |
Strip a suffix_r from str_r and return the resulting string. | |
bool | zypp::str::startsWith (const C_Str &str_r, const C_Str &prefix_r) |
alias for hasPrefix | |
bool | zypp::str::endsWith (const C_Str &str_r, const C_Str &prefix_r) |
alias for hasSuffix | |
Trimming whitepace. | |
| |
enum | zypp::str::Trim { zypp::str::NO_TRIM = 0x00, zypp::str::L_TRIM = 0x01, zypp::str::R_TRIM = 0x02, zypp::str::TRIM = (L_TRIM|R_TRIM) } |
To define how to trim. More... | |
std::string | zypp::str::trim (const std::string &s, const Trim trim_r) |
std::string | zypp::str::ltrim (const std::string &s) |
std::string | zypp::str::rtrim (const std::string &s) |
Definition in file String.h.