String.h File Reference

#include <iosfwd>
#include <string>
#include "zypp/base/PtrTypes.h"

Go to the source code of this file.

Namespaces

namespace  zypp
namespace  zypp::str

Classes

struct  zypp::str::SafeBuf
 Assert free called for allocated char *. More...

Trimming whitepace.

Todo:
optimize l/r trim.


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)

Functions

template<class _T>
std::string zypp::str::asString (const _T &t)
 Global asString() that works with std::string too.
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 std::string &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::stripFirstWord (std::string &line, const bool ltrim_first)
std::string zypp::str::getline (std::istream &str, bool trim)
std::string zypp::str::getline (std::istream &str, const Trim trim_r)
bool zypp::str::startsWith (const std::string &s, const char *str)
bool zypp::str::endsWith (const std::string &s, const char *str)
bool zypp::str::contains (const std::string &s, const char *str)
std::string zypp::str::gsub (const std::string &sData, const std::string &sFrom, const std::string &sTo)
String representation of number.
Optional second argument sets the minimal string width (' ' padded).

Negative values will cause the number to be left adjusted within the string.

Default width is 0.

 numstring(42)           -> "42"
 numstring(42, 4)        -> "  42"
 numstring(42,-4)        -> "42  "


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)
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 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'.
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 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 std::string &str)
 Parsing numbers from string.
template<typename _It>
_It zypp::str::strtonum (const std::string &str, _It &i)
 String to integer type detemined 2nd function arg i.
bool zypp::str::strToTrue (const std::string &str)
 Parsing boolean from string.
bool zypp::str::strToFalse (const std::string &str)
 Return false if str is 0, false, no, off.
bool zypp::str::strToBool (const std::string &str, bool default_r)
 Parse str into a bool depending on the default value.
Split.
template<class _OutputIterator>
unsigned zypp::str::split (const std::string &line_r, _OutputIterator result_r, const std::string &sepchars_r=" \t")
 Split line_r into words.
Join.
template<class _Iterator>
std::string zypp::str::join (_Iterator begin, _Iterator end, const std::string &sep_r=" ")
 Join strings using separator sep_r (defaults to BLANK).
template<class _Container>
std::string zypp::str::join (const _Container &cont_r, const std::string &sep_r=" ")
 Join strings using separator sep_r (defaults to BLANK).
Case conversion.
std::string zypp::str::toLower (const std::string &s)
 Return lowercase version of s.
std::string zypp::str::toUpper (const std::string &s)
 Return uppercase version of s.
String prefix handling.
bool zypp::str::hasPrefix (const std::string &str_r, const std::string &prefix_r)
 Return whether str_r has prefix prefix_r.
std::string zypp::str::stripPrefix (const std::string &str_r, const std::string &prefix_r)
 Strip a prefix_r from str_r and return the resulting string.


Detailed Description

Definition in file String.h.


Generated on Tue Sep 25 19:23:11 2007 for libzypp by  doxygen 1.5.3