glibmm 2.80.0
|
Various uri-related functions. More...
Functions | |
std::string | Glib::uri_unescape_string (const std::string &escaped_string, const std::string &illegal_characters={}) |
Unescapes a whole escaped string. | |
std::string | Glib::uri_parse_scheme (const std::string &uri) |
Gets the scheme portion of a URI. | |
std::string | Glib::uri_escape_string (const std::string &unescaped, const std::string &reserved_chars_allowed={}, bool allow_utf8=true) |
Escapes a string for use in a URI. | |
Various uri-related functions.
std::string Glib::uri_escape_string | ( | const std::string & | unescaped, |
const std::string & | reserved_chars_allowed = {} , |
||
bool | allow_utf8 = true |
||
) |
Escapes a string for use in a URI.
Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical characters plus dash, dot, underscore and tilde) are escaped. But if you specify characters in reserved_chars_allowed they are not escaped. This is useful for the "reserved" characters in the URI specification, since those are allowed unescaped in some portions of a URI.
unescaped | The unescaped input string. |
reserved_chars_allowed | A string of reserved characters that are allowed to be used. |
allow_utf8 | true if the result can include UTF-8 characters. |
std::string Glib::uri_parse_scheme | ( | const std::string & | uri | ) |
Gets the scheme portion of a URI.
RFC 3986 decodes the scheme as:
Common schemes include "file", "http", "svn+ssh", etc.
uri |
std::string Glib::uri_unescape_string | ( | const std::string & | escaped_string, |
const std::string & | illegal_characters = {} |
||
) |
Unescapes a whole escaped string.
If any of the characters in illegal_characters or the character zero appears as an escaped character in escaped_string then that is an error and an empty string will be returned. This is useful it you want to avoid, for instance, having a slash being expanded in an escaped path element, which might confuse pathname handling.
escaped_string | An escaped string to be unescaped. |
illegal_characters | An optional string of illegal characters not to be allowed. |