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

Encapsulates a uniform resource identifier (URI) as described by RFC 3986. More...

#include <uri.hpp>

Public Member Functions

 uri ()
 Constructs an empty URI. More...
 
 uri (const uri &base, const uri &relative)
 Constructs a URI by combining base with relative. More...
 
 uri (const uri &base, const path &relative)
 Constructs a URI by combining base with relative path. More...
 
 uri (const std::string &uri_string)
 Constructs a URI by parsing the given uri_string. More...
 
bool is_relative () const
 Returns true if this URI is relative. More...
 
bool is_absolute () const
 Returns true if this URI is not relative (i.e. absolute). More...
 
std::string scheme () const
 Returns the scheme of this URI. E.g. the scheme of http://user:pass@example.com is "http" More...
 
std::string authority () const
 Returns the authority of this URI. E.g. the authority of http://user:pass@example.com:80/document is "user:pass@example.com:80" More...
 
bool has_authentication () const
 Returns true if an authentication section is specified for this URI. More...
 
std::string authentication () const
 Returns the authentication of this URI. E.g. the authentication of http://user:pass@example.com is "user:pass" More...
 
std::string username () const
 Returns the username of this URI. E.g. the username of http://user:pass@example.com is "user" More...
 
std::string password () const
 Returns the password of this URI. E.g. the password of http://user:pass@example.com is "pass" More...
 
std::string host () const
 Returns the host of this URI. E.g. the host of http://example.com:80/document is "example.com" More...
 
bool has_port () const
 Returns true if a non-default port is specified for this URI. More...
 
std::size_t port () const
 Returns the port of this URI. E.g. the port of https://example.com:443/document is "443" More...
 
const class pathpath () const
 Returns the path of this URI. E.g. the path of http://example.com/document is "/document" More...
 
bool has_query () const
 Returns true if this URI has a non-null query string section. More...
 
std::string query () const
 Returns the query string of this URI. E.g. the query of http://example.com/document?v=1&x=3#abc is "v=1&x=3" More...
 
bool has_fragment () const
 Returns true if this URI has a non-empty fragment section. More...
 
std::string fragment () const
 Returns the fragment section of this URI. E.g. the fragment of http://example.com/document#abc is "abc" More...
 
std::string to_string () const
 Returns a string representation of this URI. More...
 
uri make_absolute (const uri &base)
 If this URI is relative, an absolute URI will be returned by appending the path to the given absolute base URI. More...
 
uri make_reference (const uri &base)
 If this URI is absolute, a relative URI will be returned by removing the common base path from the given absolute base URI. More...
 
bool operator== (const uri &other) const
 Returns true if this URI is equivalent to other. More...
 

Detailed Description

Encapsulates a uniform resource identifier (URI) as described by RFC 3986.

Constructor & Destructor Documentation

◆ uri() [1/4]

xlnt::uri::uri ( )

Constructs an empty URI.

◆ uri() [2/4]

xlnt::uri::uri ( const uri base,
const uri relative 
)

Constructs a URI by combining base with relative.

◆ uri() [3/4]

xlnt::uri::uri ( const uri base,
const path relative 
)

Constructs a URI by combining base with relative path.

◆ uri() [4/4]

xlnt::uri::uri ( const std::string &  uri_string)

Constructs a URI by parsing the given uri_string.

Member Function Documentation

◆ authentication()

std::string xlnt::uri::authentication ( ) const

Returns the authentication of this URI. E.g. the authentication of http://user:pass@example.com is "user:pass"

◆ authority()

std::string xlnt::uri::authority ( ) const

Returns the authority of this URI. E.g. the authority of http://user:pass@example.com:80/document is "user:pass@example.com:80"

◆ fragment()

std::string xlnt::uri::fragment ( ) const

Returns the fragment section of this URI. E.g. the fragment of http://example.com/document#abc is "abc"

◆ has_authentication()

bool xlnt::uri::has_authentication ( ) const

Returns true if an authentication section is specified for this URI.

◆ has_fragment()

bool xlnt::uri::has_fragment ( ) const

Returns true if this URI has a non-empty fragment section.

◆ has_port()

bool xlnt::uri::has_port ( ) const

Returns true if a non-default port is specified for this URI.

◆ has_query()

bool xlnt::uri::has_query ( ) const

Returns true if this URI has a non-null query string section.

◆ host()

std::string xlnt::uri::host ( ) const

Returns the host of this URI. E.g. the host of http://example.com:80/document is "example.com"

◆ is_absolute()

bool xlnt::uri::is_absolute ( ) const

Returns true if this URI is not relative (i.e. absolute).

◆ is_relative()

bool xlnt::uri::is_relative ( ) const

Returns true if this URI is relative.

◆ make_absolute()

uri xlnt::uri::make_absolute ( const uri base)

If this URI is relative, an absolute URI will be returned by appending the path to the given absolute base URI.

◆ make_reference()

uri xlnt::uri::make_reference ( const uri base)

If this URI is absolute, a relative URI will be returned by removing the common base path from the given absolute base URI.

◆ operator==()

bool xlnt::uri::operator== ( const uri other) const

Returns true if this URI is equivalent to other.

◆ password()

std::string xlnt::uri::password ( ) const

Returns the password of this URI. E.g. the password of http://user:pass@example.com is "pass"

◆ path()

const class path& xlnt::uri::path ( ) const

Returns the path of this URI. E.g. the path of http://example.com/document is "/document"

◆ port()

std::size_t xlnt::uri::port ( ) const

Returns the port of this URI. E.g. the port of https://example.com:443/document is "443"

◆ query()

std::string xlnt::uri::query ( ) const

Returns the query string of this URI. E.g. the query of http://example.com/document?v=1&x=3#abc is "v=1&x=3"

◆ scheme()

std::string xlnt::uri::scheme ( ) const

Returns the scheme of this URI. E.g. the scheme of http://user:pass@example.com is "http"

◆ to_string()

std::string xlnt::uri::to_string ( ) const

Returns a string representation of this URI.

◆ username()

std::string xlnt::uri::username ( ) const

Returns the username of this URI. E.g. the username of http://user:pass@example.com is "user"


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