Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::URI Class Reference

#include <URI.h>

List of all members.


Detailed Description

A Uniform Resource Identifier, as specified in RFC 3986.

The URI class provides methods for building URIs from their parts, as well as for splitting URIs into their parts. Furthermore, the class provides methods for resolving relative URIs against base URIs.

The class automatically performs a few normalizations on all URIs and URI parts passed to it: scheme identifiers are converted to lower case. percent-encoded characters are decoded optionally, dot segments are removed from paths (see normalize())

Definition at line 50 of file URI.h.


Public Member Functions

void clear ()
 Swaps the URI with another one.
bool empty () const
std::string getAuthority () const
 Sets the port number part of the URI.
const std::string & getFragment () const
 Sets the query part of the URI.
const std::string & getHost () const
 Sets the user-info part of the URI.
const std::string & getPath () const
std::string getPathAndQuery () const
 Returns the path, query and fragment parts of the URI.
std::string getPathEtc () const
 Sets the path, query and fragment parts of the URI.
void getPathSegments (std::vector< std::string > &segments)
unsigned short getPort () const
 Sets the host part of the URI.
std::string getQuery () const
 Sets the path part of the URI.
const std::string & getRawQuery () const
 Sets the query part of the URI.
const std::string & getScheme () const
const std::string & getUserInfo () const
bool isRelative () const
void normalize ()
bool operator!= (const std::string &uri) const
 Returns true if both URIs are identical, false otherwise.
bool operator!= (const URI &uri) const
URIoperator= (const char *uri)
URIoperator= (const std::string &uri)
 Assignment operator.
URIoperator= (const URI &uri)
 Destroys the URI.
bool operator== (const std::string &uri) const
bool operator== (const URI &uri) const
 Returns true if the URI is empty, false otherwise.
void resolve (const URI &relativeURI)
void resolve (const std::string &relativeURI)
 Returns the path and query parts of the URI.
void setAuthority (const std::string &authority)
void setFragment (const std::string &fragment)
 Returns the fragment part of the URI.
void setHost (const std::string &host)
 Returns the host part of the URI.
void setPath (const std::string &path)
 Returns the path part of the URI.
void setPathEtc (const std::string &pathEtc)
 Sets the fragment part of the URI.
void setPort (unsigned short port)
void setQuery (const std::string &query)
 Returns the query part of the URI.
void setRawQuery (const std::string &query)
 Returns the unencoded query part of the URI.
void setScheme (const std::string &scheme)
 Returns the scheme part of the URI.
void setUserInfo (const std::string &userInfo)
 Returns the user-info part of the URI.
void swap (URI &uri)
std::string toString () const
 Clears all parts of the URI.
 URI (const URI &baseURI, const std::string &relativeURI)
 Copy constructor. Creates an URI from another one.
 URI (const URI &uri)
 Creates an URI from its parts.
 URI (const std::string &scheme, const std::string &authority, const std::string &path, const std::string &query, const std::string &fragment)
 Creates an URI from its parts.
 URI (const std::string &scheme, const std::string &authority, const std::string &path, const std::string &query)
 Creates an URI from its parts.
 URI (const std::string &scheme, const std::string &authority, const std::string &pathEtc)
 Creates an URI from its parts.
 URI (const std::string &scheme, const std::string &pathEtc)
 URI (const char *uri)
 URI (const std::string &uri)
 Creates an empty URI.
 ~URI ()

Static Public Member Functions

static void decode (const std::string &str, std::string &decodedStr)
static void encode (const std::string &str, const std::string &reserved, std::string &encodedStr)

Protected Member Functions

void buildPath (const std::vector< std::string > &segments, bool leadingSlash, bool trailingSlash)
bool equals (const URI &uri) const
unsigned short getWellKnownPort () const
bool isWellKnownPort () const
 Returns true if both uri's are equivalent.
void mergePath (const std::string &path)
 Parses and sets the fragment from the given data.
void parse (const std::string &uri)
void parseAuthority (std::string::const_iterator &it, const std::string::const_iterator &end)
void parseFragment (std::string::const_iterator &it, const std::string::const_iterator &end)
 Parses and sets the query from the given data.
void parseHostAndPort (std::string::const_iterator &it, const std::string::const_iterator &end)
 Parses and sets the user-info, host and port from the given data.
void parsePath (std::string::const_iterator &it, const std::string::const_iterator &end)
 Parses and sets the host and port from the given data.
void parsePathEtc (std::string::const_iterator &it, const std::string::const_iterator &end)
 Parses and sets the path from the given data.
void parseQuery (std::string::const_iterator &it, const std::string::const_iterator &end)
 Parses and sets the path, query and fragment from the given data.
void removeDotSegments (bool removeLeading=true)
 Appends a path to the URI's path.

Static Protected Member Functions

static void getPathSegments (const std::string &path, std::vector< std::string > &segments)
 Removes all dot segments from the path.

Static Protected Attributes

static const std::string ILLEGAL = "%<>{}|\\\"^`"
static const std::string RESERVED_FRAGMENT = ""
static const std::string RESERVED_PATH = "?#"
 Builds the path from the given segments.
static const std::string RESERVED_QUERY = "#"

Private Attributes

std::string _fragment
std::string _host
std::string _path
unsigned short _port
std::string _query
std::string _scheme
std::string _userInfo

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index