wibble::str Namespace Reference


Classes

class  Split
 Split a string where a given substring is found. More...
class  YamlStream
 Parse a record of Yaml-style field: value couples. More...

Functions

std::string normpath (const std::string &pathname)
 Normalise a pathname.
std::string urlencode (const std::string &str)
 Urlencode a string.
std::string urldecode (const std::string &str)
 Decode an urlencoded string.
std::string encodeBase64 (const std::string &str)
 Encode a string in Base64.
std::string decodeBase64 (const std::string &str)
 Decode a string encoded in Base64.
template<typename X>
TPair< std::ostream, typename
X::Type >::First & 
operator<< (std::ostream &o, X list)
template<typename T>
std::string fmt (const T &val)
 Format any value into a string using a std::stringstream.
template<>
std::string fmt< std::string > (const std::string &val)
template<>
std::string fmt< char * > (char *const &val)
template<typename C>
std::string fmt_container (const C &c, char f, char l)
template<typename X>
std::string fmt (const std::set< X > &val)
template<typename X>
std::string fmt (const std::vector< X > &val)
std::string basename (const std::string &pathname)
 Given a pathname, return the file name without its path.
std::string dirname (const std::string &pathname)
 Given a pathname, return the directory name without the file name.
bool startsWith (const std::string &str, const std::string &part)
 Check if a string starts with the given substring.
bool endsWith (const std::string &str, const std::string &part)
 Check if a string ends with the given substring.
template<typename FUN>
std::string trim (const std::string &str, const FUN &classifier)
 Return the substring of 'str' without all leading and trailing characters for which 'classifier' returns true.
std::string trim (const std::string &str)
 Return the substring of 'str' without all leading and trailing spaces.
std::string toupper (const std::string &str)
 Convert a string to uppercase.
std::string tolower (const std::string &str)
 Convert a string to lowercase.
std::string ucfirst (const std::string &str)
 Return the same string, with the first character uppercased.
std::string joinpath (const std::string &path1, const std::string &path2)
 Join two paths, adding slashes when appropriate.
template<typename ITER>
std::string join (const ITER &begin, const ITER &end, const std::string &sep=", ")


Function Documentation

std::string wibble::str::basename ( const std::string &  pathname  )  [inline]

Given a pathname, return the file name without its path.

std::string wibble::str::decodeBase64 ( const std::string &  str  ) 

Decode a string encoded in Base64.

std::string wibble::str::dirname ( const std::string &  pathname  )  [inline]

Given a pathname, return the directory name without the file name.

std::string wibble::str::encodeBase64 ( const std::string &  str  ) 

Encode a string in Base64.

bool wibble::str::endsWith ( const std::string &  str,
const std::string &  part 
) [inline]

Check if a string ends with the given substring.

template<typename X>
std::string wibble::str::fmt ( const std::vector< X > &  val  )  [inline]

template<typename X>
std::string wibble::str::fmt ( const std::set< X > &  val  )  [inline]

References fmt_container().

template<typename T>
std::string wibble::str::fmt ( const T &  val  )  [inline]

Format any value into a string using a std::stringstream.

template<>
std::string wibble::str::fmt< char * > ( char *const &  val  )  [inline]

template<>
std::string wibble::str::fmt< std::string > ( const std::string &  val  )  [inline]

template<typename C>
std::string wibble::str::fmt_container ( const C &  c,
char  f,
char  l 
) [inline]

Referenced by fmt().

template<typename ITER>
std::string wibble::str::join ( const ITER &  begin,
const ITER &  end,
const std::string &  sep = ", " 
) [inline]

std::string wibble::str::joinpath ( const std::string &  path1,
const std::string &  path2 
) [inline]

Join two paths, adding slashes when appropriate.

Referenced by wibble::sys::fs::abspath(), and normpath().

std::string wibble::str::normpath ( const std::string &  pathname  ) 

Normalise a pathname.

For example, A//B, A/./B and A/foo/../B all become A/B.

References wibble::str::Split::begin(), wibble::str::Split::end(), and joinpath().

Referenced by wibble::sys::fs::abspath().

template<typename X>
TPair< std::ostream, typename X::Type >::First& wibble::str::operator<< ( std::ostream &  o,
list 
) [inline]

bool wibble::str::startsWith ( const std::string &  str,
const std::string &  part 
) [inline]

Check if a string starts with the given substring.

std::string wibble::str::tolower ( const std::string &  str  )  [inline]

Convert a string to lowercase.

Referenced by ucfirst().

std::string wibble::str::toupper ( const std::string &  str  )  [inline]

Convert a string to uppercase.

Referenced by wibble::commandline::Manpage::output(), and ucfirst().

std::string wibble::str::trim ( const std::string &  str  )  [inline]

Return the substring of 'str' without all leading and trailing spaces.

References trim().

template<typename FUN>
std::string wibble::str::trim ( const std::string &  str,
const FUN &  classifier 
) [inline]

Return the substring of 'str' without all leading and trailing characters for which 'classifier' returns true.

References wibble::list::end().

Referenced by trim().

std::string wibble::str::ucfirst ( const std::string &  str  )  [inline]

Return the same string, with the first character uppercased.

References tolower(), and toupper().

std::string wibble::str::urldecode ( const std::string &  str  ) 

Decode an urlencoded string.

std::string wibble::str::urlencode ( const std::string &  str  ) 

Urlencode a string.


Generated on Wed Aug 20 11:10:13 2008 for wibble by  doxygen 1.5.6