Made to Order Software Corporation Logo

LLChatLib: LLURI Class Reference

LLURI Class Reference

#include <lluri.h>

List of all members.

Public Member Functions

std::string asString () const
 the whole URI, escaped as needed

Static Public Member Functions

static LLURI buildHTTP (const std::string &prefix, const LLSD &path, const LLSD &query)
Escaping Utilities

static std::string escape (const std::string &str, const std::string &allowed, bool is_allowed_sorted=false)
 Escape a string with a specified set of allowed characters.

static std::string escape (const std::string &str)
 Escape a raw url with a reasonable set of allowed characters.

static std::string unescape (const std::string &str)
 unescape an escaped URI string.

Parts of a URI





std::string authority () const
BOOL defaultPort () const
const std::string & escapedPath () const
const std::string & escapedQuery () const
std::string hostName () const
U16 hostPort () const
std::string opaque () const
 everything after the colon

std::string password () const
std::string path () const
LLSD pathArray () const
std::string query () const
LLSD queryMap () const
std::string scheme () const
 ex.: "http", note lack of colon

std::string userName () const
static std::string mapToQueryString (const LLSD &query_map)
 given a name value map, return a serialized query string.

static LLSD queryMap (std::string escaped_query_string)

Detailed Description

LLURI instances are immutable See: http://www.ietf.org/rfc/rfc3986.txt


Member Function Documentation

LLURI LLURI::buildHTTP ( const std::string &  prefix,
const LLSD path,
const LLSD query 
) [static]

prefix is either a full URL prefix of the form "http://example.com:8080", or it can be simply a host and optional port like "example.com" or "example.com:8080", in these cases, the "http://" will be added

Here is the call graph for this function:

std::string LLURI::escape ( const std::string &  str,
const std::string &  allowed,
bool  is_allowed_sorted = false 
) [static]

Escape a string with a specified set of allowed characters.

Escape a string by urlencoding all the characters that aren't in the allowed string.

Parameters:
str The raw URI to escape.
allowed Character array of allowed characters
is_allowed_sorted Optimization hint if allowed array is sorted.
Returns:
Returns the escaped uri or an empty string.

Here is the call graph for this function:

std::string LLURI::escape ( const std::string &  str  )  [static]

Escape a raw url with a reasonable set of allowed characters.

The default set was chosen to match HTTP urls and general guidelines for naming resources. Passing in a raw url does not produce well defined results because you really need to know which segments are path parts because path parts are supposed to be escaped individually. The default set chosen is:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 0123456789 -._~ :@!$'()*+,=/?&#;

*NOTE: This API is basically broken because it does not allow you to specify significant path characters. For example, if the filename actually contained a /, then you cannot use this function to generate the serialized url for that resource.

Parameters:
str The raw URI to escape.
Returns:
Returns the escaped uri or an empty string.
std::string LLURI::mapToQueryString ( const LLSD query_map  )  [static]

given a name value map, return a serialized query string.

Parameters:
query_map a map of name value. every value must be representable as a string.
Returns:
Returns an url query string of '?n1=v1&n2=v2&...'
std::string LLURI::unescape ( const std::string &  str  )  [static]

unescape an escaped URI string.

Parameters:
str The escped URI to unescape.
Returns:
Returns the unescaped uri or an empty string.

Here is the call graph for this function:


The documentation for this class was generated from the following files:
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llcommon/lluri.h
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llcommon/lluri.cpp
Generated on Thu Sep 23 17:18:47 2010 for LLChatLib by  doxygen 1.6.3