Uniform Resource Identifier. More...

#include <ruri.h>

Collaboration diagram for RURI:
[legend]

Data Structures

struct  PartString
 

Public Member Functions

 RURI (void)
 
 RURI (const RString &uri)
 
 RURI (const char *uri)
 
 RURI (const RURI &uri)
 
int Compare (const RURI &uri) const
 
int Compare (const RString &uri) const
 
int Compare (const char *uri) const
 
bool operator== (const RURI &src) const
 
bool operator== (const char *src) const
 
bool operator== (const RString &src) const
 
bool operator!= (const RURI &src) const
 
bool operator!= (const char *src) const
 
bool operator!= (const RString &src) const
 
bool IsEmpty (void) const
 
RString GetScheme (void) const
 
RString GetAuthority (void) const
 
RString GetPath (void) const
 
RString GetPort (void) const
 
RString GetQuery (void) const
 
RString GetFragment (void) const
 
RString GetExtension (void) const
 
RString operator() (void) const
 
RURIoperator= (const RURI &uri)
 

Private Member Functions

void AnalyzeString (void)
 
void ReplaceChars (bool keepspaces=true)
 
RString Extract (const PartString &part) const
 

Private Attributes

RString URI
 
PartString Scheme
 
PartString Authority
 
PartString Path
 
PartString Port
 
PartString Query
 
PartString Fragment
 

Detailed Description

Uniform Resource Identifier.

This class implements a basic support of URI (Uniform Resource Identifier), in particular for the schemes involving files.

Here are two examples explaining how it is handle by the RURI class:

foo://example.com:8042/over/there?name=ferret#nose
\ / \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| ______________________|_
/ \ / \
urn:example:animal:ferret:nose

Under windows, the '\' is replaced by the '/'. For example:

C:\Documents and Settings\pal\test.doc

is transformed in:

file:///C:/Documents%20and%20Settings/pal/test.doc
Remarks
The whole specification is not supported.

Constructor & Destructor Documentation

RURI ( void  )

Default constructor.

RURI ( const RString uri)

Constructor of uniform resource identifier.

Parameters
uriString representing the URI.
RURI ( const char *  uri)

Constructor of uniform resource identifier.

Parameters
uriString representing the URI.
RURI ( const RURI uri)

Copy constructor.

Parameters
uriUniform resource identifier.

Member Function Documentation

void AnalyzeString ( void  )
private

Analyze the current URI.

void ReplaceChars ( bool  keepspaces = true)
private

Replace certain characters such as '\' by '/' or ' ' by '%20'.

Parameters
keepspacesSpecify if the spaces must be keeped or replaced by '%20'.
RString Extract ( const PartString &  part) const
private

Extract a given part of the URI based on a structure.

Parameters
partPart of the string to extract.
int Compare ( const RURI uri) const

Compare method used by R::RContainer.

Parameters
uriURI used for the comparisons.
int Compare ( const RString uri) const

Compare method used by R::RContainer.

Parameters
uriURI used for the comparisons.
int Compare ( const char *  uri) const

Compare method used by R::RContainer.

Parameters
uriURI used for the comparisons.
bool operator== ( const RURI src) const

Equal operator.

Parameters
srcURI to compare with.
bool operator== ( const char *  src) const

Equal operator.

Parameters
srcString to compare with.
bool operator== ( const RString src) const

Equal operator.

Parameters
srcString to compare with.
bool operator!= ( const RURI src) const

Non-equal operator.

Parameters
srcURI to compare with.
bool operator!= ( const char *  src) const

Non-equal operator.

Parameters
srcString to compare with.
bool operator!= ( const RString src) const

Non-equal operator.

Parameters
srcString to compare with.
bool IsEmpty ( void  ) const

Look if the URI is an empty one.

Returns
true if it is the case.
RString GetScheme ( void  ) const

Get the Scheme part of the uniform resource identifier.

RString GetAuthority ( void  ) const

Get the authority part of the uniform resource identifier.

RString GetPath ( void  ) const

Get the path part of the uniform resource identifier.

RString GetPort ( void  ) const

Get the port part of the uniform resource identifier.

RString GetQuery ( void  ) const

Get the query part of the uniform resource identifier.

RString GetFragment ( void  ) const

Get the fragment part of the uniform resource identifier.

RString GetExtension ( void  ) const

Get the extension of a file.

RString operator() ( void  ) const
Returns
String representing the URI.
RURI& operator= ( const RURI uri)

Assignment operator using another URI.

Parameters
uriSource URI.

Field Documentation

RString URI
private

The URI.

PartString Scheme
private

Structure identifying the schema of the URI.

PartString Authority
private

Structure identifying the authority of the URI.

PartString Path
private

Structure identifying the path of the URI

PartString Port
private

Structure identifying the port of the URI

PartString Query
private

Structure identifying the query of the URI.

PartString Fragment
private

Structure identifying the fragment of the URI.