Google APIs Client Library for C++
Platform Layer - URI Support Module

The URI Support module provides various classes and free functions to support the use and application of URIs in general. More...

Classes

class  UriTemplate
 Provides the ability to produce concrete URLs from templated ones. More...
class  ParsedUrl
 Parses a url as described in 2.4 of RFC 1808. More...

Functions

string ResolveUrl (const StringPiece &base_url, const StringPiece &new_url)
 Resolve a [possibly] relative url into an absolute url.
string JoinPath (const StringPiece &a, const StringPiece &b)
 Join two fragments together into a path.
string EscapeForUrl (const StringPiece &s)
 Escape a string so that it is valid in a URL.
template<typename T >
string CppValueToEscapedUrlValue (const T &value)
 Templated function that encodes a primitive C++ value for use in a URL.
template<typename T >
void AppendIteratorToUrl (const T &begin, const T &end, const StringPiece param_name, string *target)
 Templated function that encodes a C++ STL container for use as in a URL.

Detailed Description

The URI Support module provides various classes and free functions to support the use and application of URIs in general.


Function Documentation

void AppendIteratorToUrl ( const T &  begin,
const T &  end,
const StringPiece  param_name,
string *  target 
)

Templated function that encodes a C++ STL container for use as in a URL.

Implements default templated AppendIteratorToUrl.

The values in the array are those returned by the iterator. This does not put a leading (or ending) separator so you should form the uri with either a leading '&' or '?' to indicate that parameters are following.

Parameters:
[in]beginThe start of the array sequence.
[in]endThe end of the array sequence.
[in]param_nameThe name of the URL parameter being added.
[in,out]targetThe string to append the string-encoded value into.
string CppValueToEscapedUrlValue ( const T &  value) [inline]

Templated function that encodes a primitive C++ value for use in a URL.

Implements append a scalar value into a URL.

Parameters:
[in]valueThe C++ value
Returns:
The string encoding suitable for use in a URL.

This function is intended for scalar types: [u]int(16|32|64)

string googleapis::client::EscapeForUrl ( const StringPiece &  s)

Escape a string so that it is valid in a URL.

Parameters:
[in]sThe string to escape.
Returns:
the escaped string.
string googleapis::client::JoinPath ( const StringPiece &  a,
const StringPiece &  b 
)

Join two fragments together into a path.

Parameters:
[in]aThe first fragment may or may not have a trailing '/'.
[in]bThe second fragment may or may not have a leading '/'.
Returns:
The path "a/b" containing exactly one '/' between fragments a and b.
string googleapis::client::ResolveUrl ( const StringPiece &  base_url,
const StringPiece &  new_url 
)

Resolve a [possibly] relative url into an absolute url.

This function implements RFC 1808 Relative Uniform Resource Locators to resolve a url relative to a base url. Note that the actual RFC handles URLs embedded into complex documents. Here we only have a single base url.

Parameters:
[in]base_urlThe base url.
[in]new_urlThe url to be resolved against the base.
Returns:
The resolved URL or empty string on failure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines