|
Google APIs Client Library for C++
|
Parses a url as described in 2.4 of RFC 1808. More...
#include "client/util/uri_utils.h"
Public Types | |
| typedef pair< StringPiece, string > | QueryParameterAssignment |
| Type used for getting individual query parameter bindings. | |
Public Member Functions | |
| ParsedUrl (const StringPiece &url) | |
| Construct the parsed url from a URL. | |
| ~ParsedUrl () | |
| Standard destructor. | |
| const string & | url () const |
| Returns the URL that was parsed. | |
| StringPiece | scheme () const |
| Returns the URL's scheme. | |
| StringPiece | netloc () const |
| Returns the URL's network location. | |
| StringPiece | path () const |
| Returns the URL's path. | |
| StringPiece | params () const |
| Returns the URL's parameters. | |
| StringPiece | query () const |
| Returns the URL's query string. | |
| StringPiece | fragment () const |
| Returns the URL's fragment. | |
| bool | IsValid () const |
| Returns whether the URL was valid or not. | |
| const vector < QueryParameterAssignment > & | GetQueryParameterAssignments () const |
| Returns the detailed assignments for individual query parameters. | |
| bool | GetQueryParameter (const StringPiece &name, string *value) const |
| Looks up value of query paraemter if it is there. | |
Static Public Member Functions | |
| static string | SegmentOrEmpty (bool join, const StringPiece &a, const StringPiece &b) |
| Conditionally joins two strings for a URL segment. | |
Parses a url as described in 2.4 of RFC 1808.
This is an extension of RFC 1738 that includes fragments.
In RFC 1808 the URL is in the form: [scheme]://[netloc]/[path];[params]?[query]#[fragment] Each of these parts is optional.
In RFC 1738 the URL form is a function of the scheme, but for http it is http://[host]:[port]/[path]?[searchpart] where here we:
Note that the [fragment] and '#' that proceeds it is not actually part of the URL but is here because it is commonly used within the same string context as a URL as specified in RFC 1808.
| typedef pair<StringPiece, string> QueryParameterAssignment |
Type used for getting individual query parameter bindings.
The values will be unescaped.
| ParsedUrl | ( | const StringPiece & | url | ) | [explicit] |
Construct the parsed url from a URL.
| ~ParsedUrl | ( | ) |
Standard destructor.
| StringPiece fragment | ( | ) | const [inline] |
Returns the URL's fragment.
| bool GetQueryParameter | ( | const StringPiece & | name, |
| string * | value | ||
| ) | const |
Looks up value of query paraemter if it is there.
| [in] | name | The value to look for. |
| [out] | value | The [unescaped] value found. |
| const vector<QueryParameterAssignment>& GetQueryParameterAssignments | ( | ) | const |
Returns the detailed assignments for individual query parameters.
This method is not thread-safe for the first invocation.
| bool IsValid | ( | ) | const |
Returns whether the URL was valid or not.
| StringPiece netloc | ( | ) | const [inline] |
Returns the URL's network location.
| StringPiece params | ( | ) | const [inline] |
Returns the URL's parameters.
| StringPiece path | ( | ) | const [inline] |
Returns the URL's path.
| StringPiece query | ( | ) | const [inline] |
Returns the URL's query string.
| StringPiece scheme | ( | ) | const [inline] |
Returns the URL's scheme.
| static string SegmentOrEmpty | ( | bool | join, |
| const StringPiece & | a, | ||
| const StringPiece & | b | ||
| ) | [inline, static] |
Conditionally joins two strings for a URL segment.
This is a helper function for joining together an attribute with its separator.
| [in] | join | If true then join the strings, if false then return empty. |
| [in] | a | The prefix of the joined string. |
| [in] | b | The postfix of the joined string. |
| const string& url | ( | ) | const [inline] |
Returns the URL that was parsed.