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. | |
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. | |
std::string | c_escape (const std::string &str) |
Escape the string so it can safely used as a C string inside double quotes. | |
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. | |
template<typename T > | |
std::string | fmt (const T &val) |
Format any value into a string using a std::stringstream. | |
template<typename X > | |
TPair< std::ostream, typenameX::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. | |
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. | |
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. | |
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. | |
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=", ") |
References joinpath().
|
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::sys::Buffer::print_preview().
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)
std::string wibble::str::decodeBase64 | ( | const std::string & | str | ) |
Decode a string encoded in Base64.
|
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.
Check if a string ends with the given substring.
Referenced by wibble::tests::TestEndsWith::check(), and wibble::tests::test_assert_endswith().
Referenced by wibble::assert_list_eq_fn(), fmt_container(), operator<<(), and wibble::commandline::Int::toString().
References fmt_container().
References fmt_container().
References fmt_container().
Format any value into a string using a std::stringstream.
|
inline |
|
inline |
std::string wibble::str::join | ( | const ITER & | begin, |
const ITER & | end, | ||
const std::string & | sep = ", " |
||
) |
Join two paths, adding slashes when appropriate.
Referenced by appendpath(), wibble::sys::fs::findExecutable(), 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 joinpath().
|
inline |
References fmt().
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.
References tolower().
Referenced by wibble::net::mime::Reader::read_headers(), tolower(), and ucfirst().
|
inline |
Convert a string to uppercase.
References toupper().
Referenced by wibble::net::http::Request::read_method(), toupper(), and ucfirst().
|
inline |
Return the substring of 'str' without all leading and trailing spaces.
References trim().
Return the substring of 'str' without all leading and trailing characters for which 'classifier' returns true.
Referenced by wibble::net::mime::Reader::read_headers(), and trim().
|
inline |
std::string wibble::str::urldecode | ( | const std::string & | str | ) |
Decode an urlencoded string.
Referenced by wibble::net::http::Params::parse_urlencoded().
std::string wibble::str::urlencode | ( | const std::string & | str | ) |
Urlencode a string.