te::core::URI Class Reference

A class for representing an Uniform Resource Identifier (URI). More...

#include <URI.h>

Public Member Functions

std::string fragment () const
 Retrieving the fragment. More...
 
std::string host () const
 Retrieving the host. More...
 
bool isValid () const
 Return if the given URI is valid or not. More...
 
URIoperator= (const URI &other)
 Assingment operator. More...
 
std::string password () const
 Retrieving the password information. More...
 
std::string path () const
 Retrieving the path. More...
 
std::string port () const
 Retrieving the port. More...
 
std::string query () const
 Retrieving the query. More...
 
std::string scheme () const
 Retrieving the scheme. More...
 
 URI ()
 Default constructor. More...
 
 URI (const std::string &uri)
 A constructor from a string. More...
 
 URI (const URI &other)
 Copy constructor. More...
 
const std::string & uri () const
 Retrieving the full URI. More...
 
std::string user () const
 Retrieving the user information. More...
 
 ~URI ()
 

Private Member Functions

void encode ()
 Check if the uri_ contains any invalid character and parse it to his hexadecimal value. More...
 
std::string hexToLetter (int i)
 
void parse ()
 Parse the URI stored in uri_ member. More...
 
void swap (URI &other)
 Swap operation. More...
 

Private Attributes

std::unique_ptr< Impl > m_pimpl
 

Detailed Description

A class for representing an Uniform Resource Identifier (URI).

Definition at line 49 of file URI.h.

Constructor & Destructor Documentation

te::core::URI::URI ( )

Default constructor.

te::core::URI::URI ( const std::string &  uri)
explicit

A constructor from a string.

This constructor check the URI enconding, then parse it and validate.

Parameters
uriA string with the URI to be parsed.
Exceptions
URIExceptionwhen the given URI isn't valid.
te::core::URI::URI ( const URI other)

Copy constructor.

te::core::URI::~URI ( )

Default destructor.

Member Function Documentation

void te::core::URI::encode ( )
private

Check if the uri_ contains any invalid character and parse it to his hexadecimal value.

std::string te::core::URI::fragment ( ) const

Retrieving the fragment.

Returns
Returns the URI fragment.
std::string te::core::URI::hexToLetter ( int  i)
private
std::string te::core::URI::host ( ) const

Retrieving the host.

Returns
Returns the URI host.
bool te::core::URI::isValid ( ) const

Return if the given URI is valid or not.

Returns
Returns true if the given URI is valid.
URI& te::core::URI::operator= ( const URI other)

Assingment operator.

void te::core::URI::parse ( )
private

Parse the URI stored in uri_ member.

It uses regex to validate and parse the given URI.

After this, if the given URI is valid, the match_ member will have the references to all parts of the URI.

The regex split the URI by using named groups in regex, "(?<name>...)", so knowing the group name, you can require the corresponding group, from match_.

Exceptions
URIExceptionwhen the given URI isn't valid.
std::string te::core::URI::password ( ) const

Retrieving the password information.

Returns
Returns the URI password information.
std::string te::core::URI::path ( ) const

Retrieving the path.

Returns
Returns the URI path.
std::string te::core::URI::port ( ) const

Retrieving the port.

Returns
Returns the URI port.
std::string te::core::URI::query ( ) const

Retrieving the query.

Returns
Returns the URI query.
std::string te::core::URI::scheme ( ) const

Retrieving the scheme.

Returns
Returns the URI scheme.
void te::core::URI::swap ( URI other)
private

Swap operation.

const std::string& te::core::URI::uri ( ) const

Retrieving the full URI.

Returns
Returns the complete URI.
std::string te::core::URI::user ( ) const

Retrieving the user information.

Returns
Returns the URI user information.

Member Data Documentation

std::unique_ptr<Impl> te::core::URI::m_pimpl
private

Definition at line 178 of file URI.h.


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