Gnash
0.8.11dev
|
Uniform Resource Locator. More...
#include <URL.h>
Public Member Functions | |
URL (const std::string &absolute_url) | |
Construct an URL from the given absolute url string. More... | |
URL (const std::string &relative_url, const URL &baseurl) | |
const std::string & | protocol () const |
Return the 'protocol' member of this URL, as a string. More... | |
const std::string & | hostname () const |
Return the 'hostname' member of this URL, as a string. More... | |
const std::string & | port () const |
Return the 'port' member of this URL, as a string. More... | |
const std::string & | path () const |
Return the 'path' member of this URL, as a string. More... | |
const std::string & | anchor () const |
Return the 'anchor' member of this URL, as a string. More... | |
const std::string & | querystring () const |
Return the 'querystring' member of this URL, as a string. More... | |
void | set_querystring (const std::string &value) |
Set the 'querystring' member of this URL to a new value. More... | |
std::string | str () const |
Return the full absolute URL as a string. More... | |
Static Public Member Functions | |
static void | parse_querystring (const std::string &query_string, std::map< std::string, std::string > &target_map) |
Parse a query string filling the provided map. More... | |
static void | encode (std::string &str) |
Encode a string to URL-encoded format converting all dodgy characters to AB hex sequences. More... | |
static std::string | encode (const std::string &str) |
Encode a string to URL-encoded format converting all dodgy characters to AB hex sequences. This merely uses the void encode() function on a new string. More... | |
static void | decode (std::string &str) |
Decode a string from URL-encoded format converting all hexadecimal sequences to ASCII characters. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const URL &u) |
Uniform Resource Locator.
This class is used to manage URLs.
gnash::URL::URL | ( | const std::string & | absolute_url | ) |
Construct an URL from the given absolute url string.
A relative URL will be considered a filesystem path relative to the current working directory.
Throws std::runtime_error on error
References gnash::key::i.
gnash::URL::URL | ( | const std::string & | relative_url, |
const URL & | baseurl | ||
) |
Construct an URL from the given relative url string, using the given URL for resolving it. Throws std::runtime_error on error
References gnash::key::e, gnash::key::i, and path().
|
inline |
Return the 'anchor' member of this URL, as a string.
The anchor is the string after the '#' character
|
static |
Decode a string from URL-encoded format converting all hexadecimal sequences to ASCII characters.
A sequence to convert is % followed by two case-independent hexadecimal digits, which is replaced by the equivalent ASCII character. See RFC1738 http://www.rfc-editor.org/rfc/rfc1738.txt, Section 2.2 "URL Character Encoding Issues"
str | The input/output string |
References gnash::key::i.
Referenced by gnash::Global_as::makeObject(), and parse_querystring().
|
static |
Encode a string to URL-encoded format converting all dodgy characters to AB hex sequences.
Characters that need escaping are:
str | The input/output string |
References gnash::key::c, and gnash::key::i.
Referenced by encode(), gnash::getURLEncodedVars(), gnash::Global_as::makeObject(), and gnash::registerSystemNative().
|
static |
|
inline |
Return the 'hostname' member of this URL, as a string.
NOTE: return the empty string if protocol() is "file"
Referenced by gnash::URLAccessManager::allow(), gnash::rtmp::RTMP::connect(), gnash::externalinterface_class_init(), gnash::OverwriteExisting::operator()(), gnash::IncrementalRename::operator()(), and gnash::registerLocalConnectionNative().
|
static |
Parse a query string filling the provided map.
query_string | the url-escaped query string (can include or not the starting question mark) |
target_map | A standard map to put parsed values into. Note: existing elements of the map will be replaced. |
References decode(), and name.
Referenced by gnash::MovieLoader::clear().
|
inline |
Return the 'path' member of this URL, as a string.
The returned path starts with '/'
Referenced by gnash::URLAccessManager::allow(), gnash::StreamProvider::getStream(), gnash::OverwriteExisting::operator()(), gnash::IncrementalRename::operator()(), gnash::Player::setScale(), and URL().
|
inline |
Return the 'port' member of this URL, as a string.
NOTE: return the empty string if the port isn't specified, as this is an optional field.
Referenced by gnash::rtmp::RTMP::connect().
|
inline |
Return the 'protocol' member of this URL, as a string.
Referenced by gnash::URLAccessManager::allow(), gnash::StreamProvider::getStream(), and gnash::Player::setScale().
|
inline |
Return the 'querystring' member of this URL, as a string.
The query is the string after the '?' character
Referenced by gnash::MovieLoader::clear().
|
inline |
std::string gnash::URL::str | ( | ) | const |
Return the full absolute URL as a string.
TODO: make output operator and operator+ for strings
Referenced by gnash::MovieFactory::clear(), gnash::rtmp::RTMP::connect(), gnash::externalinterface_class_init(), gnash::StreamProvider::getStream(), gnash::MovieFactory::makeMovie(), gnash::operator<<(), and gnash::Player::run().
|
friend |