wibble
1.1
|
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 | fmtf (const char *f,...) |
std::string | fmt (const char *f,...) |
std::string | normpath (const std::string &pathname) |
Normalise a pathname. More... | |
std::string | urlencode (const std::string &str) |
Urlencode a string. More... | |
std::string | urldecode (const std::string &str) |
Decode an urlencoded string. More... | |
std::string | encodeBase64 (const std::string &str) |
Encode a string in Base64. More... | |
std::string | decodeBase64 (const std::string &str) |
Decode a string encoded in Base64. More... | |
std::string | c_escape (const std::string &str) |
Escape the string so it can safely used as a C string inside double quotes. More... | |
std::string | c_unescape (const std::string &str, size_t &lenParsed) |
Unescape a C string, stopping at the first double quotes or at the end of the string. More... | |
template<typename T > | |
std::string | fmt (const T &val) |
Format any value into a string using a std::stringstream. More... | |
template<typename X > | |
TPair< std::ostream, typename X::Type >::First & | operator<< (std::ostream &o, X list) |
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) |
template<typename X > | |
std::string | fmt (const std::deque< X > &val) |
std::string | basename (const std::string &pathname) |
Given a pathname, return the file name without its path. More... | |
std::string | dirname (const std::string &pathname) |
Given a pathname, return the directory name without the file name. More... | |
bool | startsWith (const std::string &str, const std::string &part) |
Check if a string starts with the given substring. More... | |
bool | endsWith (const std::string &str, const std::string &part) |
Check if a string ends with the given substring. More... | |
std::string | replace (const std::string &str, char from, char to) |
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. More... | |
std::string | trim (const std::string &str) |
Return the substring of 'str' without all leading and trailing spaces. More... | |
std::string | toupper (const std::string &str) |
Convert a string to uppercase. More... | |
std::string | tolower (const std::string &str) |
Convert a string to lowercase. More... | |
std::string | ucfirst (const std::string &str) |
Return the same string, with the first character uppercased. More... | |
std::string | joinpath (const std::string &path1, const std::string &path2) |
Join two paths, adding slashes when appropriate. More... | |
std::string | appendpath (const std::string &path1, const std::string &path2) |
template<typename ITER > | |
std::string | join (const ITER &begin, const ITER &end, const std::string &sep=", ") |
|
inline |
References decodeBase64(), encodeBase64(), joinpath(), urldecode(), and urlencode().
|
inline |
Given a pathname, return the file name without its path.
Referenced by wibble::net::http::FileParam::FileInfo::read().
std::string wibble::str::c_escape | ( | const std::string & | str | ) |
Escape the string so it can safely used as a C string inside double quotes.
Referenced by wibble::str::YamlStream::end(), and wibble::sys::Buffer::print_preview().
std::string wibble::str::c_unescape | ( | const std::string & | str, |
size_t & | lenParsed | ||
) |
Unescape a C string, stopping at the first double quotes or at the end of the string.
lenParsed is set to the number of characters that were pased (which can be greather than the size of the resulting string in case escapes were found)
Referenced by wibble::str::YamlStream::end().
std::string wibble::str::decodeBase64 | ( | const std::string & | str | ) |
Decode a string encoded in Base64.
Referenced by appendpath().
|
inline |
Given a pathname, return the directory name without the file name.
References normpath().
std::string wibble::str::encodeBase64 | ( | const std::string & | str | ) |
Encode a string in Base64.
Referenced by appendpath().
|
inline |
Check if a string ends with the given substring.
Referenced by wibble::tests::TestEndsWith::check(), and wibble::tests::test_assert_endswith().
|
inline |
Format any value into a string using a std::stringstream.
|
inline |
References fmt_container().
|
inline |
References fmt_container().
|
inline |
References fmt_container().
std::string wibble::str::fmt | ( | const char * | f, |
... | |||
) |
Referenced by wibble::assert_list_eq_fn(), fmt_container(), operator<<(), and wibble::commandline::Int::toString().
|
inline |
|
inline |
|
inline |
std::string wibble::str::fmtf | ( | const char * | f, |
... | |||
) |
std::string wibble::str::join | ( | const ITER & | begin, |
const ITER & | end, | ||
const std::string & | sep = ", " |
||
) |
References wibble::list::end().
|
inline |
Join two paths, adding slashes when appropriate.
Referenced by appendpath(), wibble::sys::fs::findExecutable(), wibble::sys::fs::inode(), normpath(), wibble::net::http::Request::pop_path_info(), and wibble::net::http::FileParam::FileInfo::read().
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 dirname().
|
inline |
References fmt().
|
inline |
|
inline |
Check if a string starts with the given substring.
Referenced by wibble::tests::TestStartsWith::check(), and wibble::tests::test_assert_startswith().
|
inline |
Convert a string to lowercase.
Referenced by wibble::net::mime::Reader::read_headers(), and ucfirst().
|
inline |
Convert a string to uppercase.
Referenced by wibble::net::http::Request::read_method(), and ucfirst().
|
inline |
Return the substring of 'str' without all leading and trailing characters for which 'classifier' returns true.
References wibble::list::end().
Referenced by wibble::net::mime::Reader::read_headers(), and trim().
|
inline |
Return the substring of 'str' without all leading and trailing spaces.
References wibble::list::end(), and trim().
|
inline |
std::string wibble::str::urldecode | ( | const std::string & | str | ) |
Decode an urlencoded string.
Referenced by appendpath(), and wibble::net::http::Params::parse_urlencoded().
std::string wibble::str::urlencode | ( | const std::string & | str | ) |
Urlencode a string.
Referenced by appendpath().