LibPkg
Public Member Functions | List of all members
pkg::uri Class Reference

A class to represent a uniform resource identifier. More...

#include <uri.h>

Public Member Functions

 uri ()
 Construct empty URI. More...
 
 uri (const string &s)
 Construct URI from string. More...
 
 operator string ()
 Convert URI to string. More...
 
uri operator+ (const uri &rel_uri)
 Resolve relative URI to produce absolute URI. More...
 
urioperator+= (const uri &rel_uri)
 Resolve relative URI to produce absolute URI. More...
 
const string & scheme () const
 Get scheme component. More...
 
const string & authority () const
 Get authority component. More...
 
const string & path () const
 Get path component. More...
 
const string & query () const
 Get query component. More...
 
const string & fragment () const
 Get fragment component. More...
 
urischeme (const string &scheme)
 Set scheme component. More...
 
uriauthority (const string &authority)
 Set authority component. More...
 
uripath (const string &path)
 Set path component. More...
 
uriquery (const string &query)
 Set query component. More...
 
urifragment (const string &fragment)
 Set fragment component. More...
 

Detailed Description

A class to represent a uniform resource identifier.

This is a suitable representation for accessing the individual components of a URI (the scheme, authority, path, query and fragment). Where an opaque representation is sufficient, a string is likely to be a more efficient method of storage.

For simplicity, the scheme, authority, query and fragment are taken to include the prefix/suffix with which they are associated. This does not match the syntax given in RFC 2396.

Constructor & Destructor Documentation

◆ uri() [1/2]

pkg::uri::uri ( )

Construct empty URI.

◆ uri() [2/2]

pkg::uri::uri ( const string &  s)
explicit

Construct URI from string.

Member Function Documentation

◆ operator string()

pkg::uri::operator string ( )

Convert URI to string.

Returns
the URI as a string.

◆ operator+()

uri pkg::uri::operator+ ( const uri rel_uri)

Resolve relative URI to produce absolute URI.

This URI acts as the base.

Parameters
rel_urithe relative URI
Returns
the absolute URI

References authority(), fragment(), path(), query(), and scheme().

Referenced by operator+=().

◆ operator+=()

uri & pkg::uri::operator+= ( const uri rel_uri)

Resolve relative URI to produce absolute URI.

This URI initially acts as the base.

Parameters
rel_urithe relative URI
Returns
the absolute URI

References operator+().

◆ scheme() [1/2]

const string& pkg::uri::scheme ( ) const
inline

Get scheme component.

This should either be blank (meaning that there is no scheme component) or end with ":".

Returns
the scheme component

Referenced by fragment(), operator+(), and scheme().

◆ authority() [1/2]

const string& pkg::uri::authority ( ) const
inline

Get authority component.

This should either be blank (meaning that there is no authority component) or begin with "//".

Returns
the authority component, or 0 if undefined

Referenced by authority(), fragment(), and operator+().

◆ path() [1/2]

const string& pkg::uri::path ( ) const
inline

Get path component.

Returns
the path component

Referenced by fragment(), operator+(), and path().

◆ query() [1/2]

const string& pkg::uri::query ( ) const
inline

Get query component.

This should either be blank (meaning that there is no query component) or begin with "?".

Returns
the query component

Referenced by fragment(), operator+(), and query().

◆ fragment() [1/2]

const string& pkg::uri::fragment ( ) const
inline

Get fragment component.

This should either be blank (meaning that there is no fragment component) or begin with "#".

Returns
the fragment component

References authority(), path(), query(), and scheme().

Referenced by fragment(), and operator+().

◆ scheme() [2/2]

uri & pkg::uri::scheme ( const string &  scheme)

Set scheme component.

This should either be blank (meaning that there is no scheme component) or end with ":".

Parameters
schemethe required scheme component
Returns
a reference to this

References scheme().

◆ authority() [2/2]

uri & pkg::uri::authority ( const string &  authority)

Set authority component.

This should either be blank (meaning that there is no authority component) or begin with "//".

Parameters
authoritythe required authority component
Returns
a reference to this

References authority().

◆ path() [2/2]

uri & pkg::uri::path ( const string &  path)

Set path component.

Parameters
paththe required path component
Returns
a reference to this

References path().

◆ query() [2/2]

uri & pkg::uri::query ( const string &  query)

Set query component.

This should either be blank (meaning that there is no query component) or begin with "?".

Parameters
querythe required query component
Returns
a reference to this

References query().

◆ fragment() [2/2]

uri & pkg::uri::fragment ( const string &  fragment)

Set fragment component.

This should either be blank (meaning that there is no fragment component) or begin with "#".

Parameters
fragmentthe required fragment component
Returns
a reference to this

References fragment().


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

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)