LLURI Class Reference

#include <lluri.h>

Collaboration diagram for LLURI:

Collaboration graph
[legend]
List of all members.

Parts of a URI

std::string scheme () const
 ex.: "http", note lack of colon
std::string opaque () const
 everything after the colon
std::string authority () const
std::string hostName () const
std::string userName () const
std::string password () const
U16 hostPort () const
BOOL defaultPort () const
const std::string & escapedPath () const
std::string path () const
std::string query () const
const std::string & escapedQuery () const
LLSD queryMap () const
static LLSD queryMap (std::string escaped_query_string)
static std::string mapToQueryString (const LLSD &query_map)
 given a name value map, return a serialized query string.

Public Member Functions

 LLURI ()
 LLURI (const std::string &escaped_str)
 LLURI (const std::string &scheme, const std::string &userName, const std::string &password, const std::string &hostName, U16 hostPort, const std::string &escapedPath, const std::string &escapedQuery)
 ~LLURI ()
std::string asString () const
 the whole URI, escaped as needed

Static Public Member Functions

static LLURI buildHTTP (const std::string &prefix, const LLSD &path)
static LLURI buildHTTP (const std::string &prefix, const LLSD &path, const LLSD &query)
static LLURI buildHTTP (const std::string &host, const U32 &port, const LLSD &path)
static LLURI buildHTTP (const std::string &host, const U32 &port, const LLSD &path, const LLSD &query)
Escaping Utilities
static std::string escape (const std::string &str)
static std::string escape (const std::string &str, const std::string &allowed)
static std::string unescape (const std::string &str)

Private Attributes

std::string mScheme
std::string mEscapedOpaque
std::string mEscapedAuthority
std::string mEscapedPath
std::string mEscapedQuery

Detailed Description

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

Definition at line 49 of file lluri.h.


Constructor & Destructor Documentation

LLURI::LLURI (  ) 

Definition at line 127 of file lluri.cpp.

Referenced by buildHTTP().

LLURI::LLURI ( const std::string &  escaped_str  ) 

Definition at line 131 of file lluri.cpp.

References mEscapedAuthority, mEscapedOpaque, mEscapedPath, mEscapedQuery, and mScheme.

LLURI::LLURI ( const std::string &  scheme,
const std::string &  userName,
const std::string &  password,
const std::string &  hostName,
U16  hostPort,
const std::string &  escapedPath,
const std::string &  escapedQuery 
)

Definition at line 206 of file lluri.cpp.

References escape(), isDefault(), mEscapedAuthority, mEscapedOpaque, and opaque().

LLURI::~LLURI (  ) 

Definition at line 243 of file lluri.cpp.


Member Function Documentation

std::string LLURI::asString (  )  const

the whole URI, escaped as needed

Definition at line 325 of file lluri.cpp.

References mEscapedOpaque, and mScheme.

Referenced by tut::ensure_equals(), LLHTTPClient::get(), and update_dialog_callback().

std::string LLURI::authority (  )  const

Definition at line 347 of file lluri.cpp.

References mEscapedAuthority, and unescape().

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

Definition at line 317 of file lluri.cpp.

References buildHTTP(), llformat(), path(), and query().

LLURI LLURI::buildHTTP ( const std::string &  host,
const U32 port,
const LLSD path 
) [static]

Definition at line 309 of file lluri.cpp.

References buildHTTP(), llformat(), and path().

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

Definition at line 296 of file lluri.cpp.

References buildHTTP(), mapToQueryString(), mEscapedOpaque, mEscapedQuery, path(), and query().

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

Definition at line 248 of file lluri.cpp.

References escapeHostAndPort(), escapePathComponent(), lldebugs, llendl, LLURI(), llwarns, mEscapedAuthority, mEscapedOpaque, mEscapedPath, mScheme, and path().

Referenced by buildHTTP(), LLHTTPClient::get(), and update_dialog_callback().

BOOL LLURI::defaultPort (  )  const

Definition at line 416 of file lluri.cpp.

References hostPort(), isDefault(), and mScheme.

Referenced by LLSRV::rewriteURI().

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

Definition at line 45 of file lluri.cpp.

References c, and end.

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

Definition at line 122 of file lluri.cpp.

References unreserved().

Referenced by escapeHostAndPort(), escapePathComponent(), escapeQueryValue(), escapeQueryVariable(), LLPanelDirFindAll::getSearchURLSuffix(), LLURI(), and LLVoiceClient::sessionCreateSendMessage().

const std::string& LLURI::escapedPath (  )  const [inline]

Definition at line 108 of file lluri.h.

References mEscapedPath.

Referenced by LLSRV::rewriteURI().

const std::string& LLURI::escapedQuery (  )  const [inline]

Definition at line 112 of file lluri.h.

References mEscapedQuery.

Referenced by LLSRV::rewriteURI().

std::string LLURI::hostName (  )  const

Definition at line 385 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and unescape().

Referenced by LLSRV::rewriteURI().

U16 LLURI::hostPort (  )  const

Definition at line 421 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and mScheme.

Referenced by defaultPort(), and LLSRV::rewriteURI().

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&...'

Definition at line 494 of file lluri.cpp.

References LLSD::beginMap(), end, LLSD::endMap(), escapeQueryValue(), escapeQueryVariable(), LLSD::isMap(), and queryMap().

Referenced by buildHTTP(), and LLServiceBuilder::buildServiceURI().

std::string LLURI::opaque (  )  const

everything after the colon

Definition at line 342 of file lluri.cpp.

References mEscapedOpaque, and unescape().

Referenced by LLURI().

std::string LLURI::password (  )  const

Definition at line 404 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and unescape().

Referenced by LLSRV::rewriteURI().

std::string LLURI::path (  )  const

Definition at line 438 of file lluri.cpp.

References mEscapedPath, and unescape().

Referenced by buildHTTP().

std::string LLURI::query (  )  const

Definition at line 443 of file lluri.cpp.

References mEscapedQuery, and unescape().

Referenced by buildHTTP().

LLSD LLURI::queryMap ( std::string  escaped_query_string  )  [static]

Definition at line 454 of file lluri.cpp.

References LLSD::emptyArray(), lldebugs, llendl, and unescape().

LLSD LLURI::queryMap (  )  const

Definition at line 448 of file lluri.cpp.

References mEscapedQuery.

Referenced by mapToQueryString().

std::string LLURI::scheme (  )  const

ex.: "http", note lack of colon

Definition at line 337 of file lluri.cpp.

References mScheme.

Referenced by LLSRV::rewriteURI().

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

Definition at line 69 of file lluri.cpp.

References c, end, and hex_as_nybble().

Referenced by authority(), hostName(), opaque(), password(), path(), query(), queryMap(), and userName().

std::string LLURI::userName (  )  const

Definition at line 392 of file lluri.cpp.

References findAuthorityParts(), mEscapedAuthority, and unescape().

Referenced by LLSRV::rewriteURI().


Member Data Documentation

std::string LLURI::mEscapedAuthority [private]

Definition at line 140 of file lluri.h.

Referenced by authority(), buildHTTP(), hostName(), hostPort(), LLURI(), password(), and userName().

std::string LLURI::mEscapedOpaque [private]

Definition at line 139 of file lluri.h.

Referenced by asString(), buildHTTP(), LLURI(), and opaque().

std::string LLURI::mEscapedPath [private]

Definition at line 141 of file lluri.h.

Referenced by buildHTTP(), escapedPath(), LLURI(), and path().

std::string LLURI::mEscapedQuery [private]

Definition at line 142 of file lluri.h.

Referenced by buildHTTP(), escapedQuery(), LLURI(), query(), and queryMap().

std::string LLURI::mScheme [private]

Definition at line 138 of file lluri.h.

Referenced by asString(), buildHTTP(), defaultPort(), hostPort(), LLURI(), and scheme().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:55 2010 for Second Life Viewer by  doxygen 1.4.7