xvr2::Net::URI Class Reference

#include <URI.h>

Inheritance diagram for xvr2::Net::URI:

Inheritance graph
[legend]

List of all members.


Detailed Description

Uniform Resource Identifier class.

Use when in need to break down a URI's components. Basically a URI is a string like this:

		 *    foo://username:password@example.com:8042/over/there/index.dtb;type=animal?name=ferret#nose
		 *    \ /   \________________/\_________/ \__/\_________/ \___/ \_/ \_________/ \_________/ \__/
		 *     |           |               |        |     |        |     |         |           |     |
		 *   scheme     userinfo       hostname  port  path  filename extension parameter(s) query fragment
		 *          \_______________________________/
		 *                      authority
  		 *  
So this class purpose is to leverage the taks of parsing a complex URI into the above components as easy as possible.

Definition at line 36 of file URI.h.


Public Types

typedef Map< String, String,
_cmpf
QueryMap
typedef QueryMap::iterator QueryMapIterator

Public Member Functions

 URI ()
 Default constructor, initializes an empty URI.
 URI (const String &uri)
 Initializes a URI object from a xvr2::String containing an uri.
 ~URI ()
const Stringscheme ()
 Returns the uri's scheme after a successful parse.
const Stringscheme () const
 Returns the uri's scheme after a successful parse.
const Stringhost ()
 Retrieves the host part on a uri.
const Stringhost () const
 Retrieves the host part on a uri.
int port ()
 Retrieves the port specified in the URI.
const Stringpath ()
 Returns the associated path in the URI.
const Stringpath () const
 Returns the associated path in the URI.
const StringparamString ()
 Returns a string containing a list of URI parameters, not to be confused with the query string which is the one that comes after ? (question mark sign).
const StringparamString () const
 Returns a string containing a list of URI parameters, not to be confused with the query string which is the one that comes after ? (question mark sign).
const StringqueryString ()
 Returns the query string on an URI which is the portion that comes after the ? (question mark sign).
const StringqueryString () const
 Returns the query string on an URI which is the portion that comes after the ? (question mark sign).
const Stringfragment ()
 Returns the fragment portion in the URI.
const Stringfragment () const
 Returns the fragment portion in the URI.
const Stringuser ()
 Retrieves the username from the authority section.
const Stringuser () const
 Retrieves the username from the authority section.
const Stringpassword ()
 Retrieves the password from the authority section.
const Stringpassword () const
 Retrieves the password from the authority section.
virtual std::string toString ()
 Returns a string representation of this URI object.
URIoperator= (const String &uri_str)
 Allows to change the contents of this URI by assigning it a String to be parsed thereafter.
URI::QueryMap queryMap ()
virtual const char * getClassName ()
 Returns the name of the current class.

Static Public Member Functions

static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)

Protected Attributes

String _uri
String _scheme
String _user
String _password
String _host
String _query_string
String _param_string
String _fragment
int _port
String _path
QueryMap query
std::string __cls_name

Private Member Functions

void parse ()
 Will parse the contents of _uri in order to obtain all its components.

Friends

std::ostream & operator<< (std::ostream &stream, const Object &s)

Classes

struct  _cmpf

Member Typedef Documentation

Definition at line 47 of file URI.h.

typedef QueryMap::iterator xvr2::Net::URI::QueryMapIterator

Definition at line 48 of file URI.h.


Constructor & Destructor Documentation

xvr2::Net::URI::URI (  ) 

Default constructor, initializes an empty URI.

xvr2::Net::URI::URI ( const String uri  ) 

Initializes a URI object from a xvr2::String containing an uri.

xvr2::Net::URI::~URI (  ) 


Member Function Documentation

void xvr2::Net::URI::parse (  )  [private]

Will parse the contents of _uri in order to obtain all its components.

const String& xvr2::Net::URI::scheme (  ) 

Returns the uri's scheme after a successful parse.

const String& xvr2::Net::URI::scheme (  )  const

Returns the uri's scheme after a successful parse.

const String& xvr2::Net::URI::host (  ) 

Retrieves the host part on a uri.

const String& xvr2::Net::URI::host (  )  const

Retrieves the host part on a uri.

int xvr2::Net::URI::port (  ) 

Retrieves the port specified in the URI.

In case no port is specified X-VR2 will to guess it from a list of known schemes.

const String& xvr2::Net::URI::path (  ) 

Returns the associated path in the URI.

Sometimes a URI lacks a path so it is possible to have an empty path, like in

http://example.com 

const String& xvr2::Net::URI::path (  )  const

Returns the associated path in the URI.

Sometimes a URI lacks a path so it is possible to have an empty path, like in

http://example.com 
.

const String& xvr2::Net::URI::paramString (  ) 

Returns a string containing a list of URI parameters, not to be confused with the query string which is the one that comes after ? (question mark sign).

It is not very common to the a param string in an URI, in fact I've never seen it before so most of the time this method will return an empty String.

const String& xvr2::Net::URI::paramString (  )  const

Returns a string containing a list of URI parameters, not to be confused with the query string which is the one that comes after ? (question mark sign).

It is not very common to the a param string in an URI, in fact I've never seen it before so most of the time this method will return an empty String.

const String& xvr2::Net::URI::queryString (  ) 

Returns the query string on an URI which is the portion that comes after the ? (question mark sign).

This method returns the string as is, however if you need to have it broke down, you may better take a look at the queryMap method.

const String& xvr2::Net::URI::queryString (  )  const

Returns the query string on an URI which is the portion that comes after the ? (question mark sign).

This method returns the string as is, however if you need to have it broke down, you may better take a look at the queryMap method.

const String& xvr2::Net::URI::fragment (  ) 

Returns the fragment portion in the URI.

A URI allows to specify an offset from where to start displaying or reading the addressed document, this is called, the fragment.

const String& xvr2::Net::URI::fragment (  )  const

Returns the fragment portion in the URI.

A URI allows to specify an offset from where to start displaying or reading the addressed document, this is called, the fragment.

const String& xvr2::Net::URI::user (  ) 

Retrieves the username from the authority section.

Not everytime the authority section contains a username and password in the URI, for HTTP this practice is being phased out more and more.

const String& xvr2::Net::URI::user (  )  const

Retrieves the username from the authority section.

Not everytime the authority section contains a username and password in the URI, for HTTP this practice is being phased out more and more.

const String& xvr2::Net::URI::password (  ) 

Retrieves the password from the authority section.

Not everytime the authority section contains a username and password in the URI, for HTTP this practice is being phased out more and more.

const String& xvr2::Net::URI::password (  )  const

Retrieves the password from the authority section.

Not everytime the authority section contains a username and password in the URI, for HTTP this practice is being phased out more and more.

virtual std::string xvr2::Net::URI::toString (  )  [virtual]

Returns a string representation of this URI object.

Reimplemented from xvr2::Object.

URI& xvr2::Net::URI::operator= ( const String uri_str  ) 

Allows to change the contents of this URI by assigning it a String to be parsed thereafter.

URI::QueryMap xvr2::Net::URI::queryMap (  ) 

virtual const char* xvr2::Object::getClassName (  )  [virtual, inherited]

Returns the name of the current class.

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]


Member Data Documentation

Definition at line 50 of file URI.h.

Definition at line 51 of file URI.h.

Definition at line 52 of file URI.h.

Definition at line 53 of file URI.h.

Definition at line 54 of file URI.h.

Definition at line 55 of file URI.h.

Definition at line 56 of file URI.h.

Definition at line 57 of file URI.h.

int xvr2::Net::URI::_port [protected]

Definition at line 58 of file URI.h.

Definition at line 59 of file URI.h.

Definition at line 60 of file URI.h.

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.


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

Generated on Fri Jun 20 22:56:03 2008 for X-VR2 SDK by  doxygen 1.5.5