te::common::uri::authority Class Reference

URI authority component (without userinfo). More...

#include <authority.h>

Public Types

enum  host_type_e { null, DOMAIN_NAME, IP_ADDRESS, IPV6_ADDRESS }
 Enumeration. More...
 

Public Member Functions

 authority ()
 Construct. More...
 
 authority (const std::string &v)
 Construct from string. More...
 
bool empty () const
 Test if null/empty. More...
 
int getDefaultPort (const std::string &scheme)
 Get Default port for the protocol. Added by Lauro. More...
 
std::string getEncodedLogin () const
 Get endoded login. Added by Lauro. More...
 
std::string getEncodedPassword () const
 Get encoded password. Added by Lauro. More...
 
std::string getLogin () const
 Get login. Added by Lauro. More...
 
std::string getPassword () const
 Get password. Added by Lauro. More...
 
const std::string & host () const
 Get host. More...
 
host_type_e host_type () const
 Get host type. More...
 
bool is_null () const
 Test if null/empty. More...
 
std::ostream & operator<< (std::ostream &os) const
 Stream out. More...
 
unsigned short port () const
 Get port (0 if none). More...
 
void port (unsigned short p)
 Set port. Added by Lauro. More...
 
void setDefaultPort (const std::string &scheme)
 Set Default port for the protocol. Added by Lauro. More...
 
void setLogin (const std::string &login)
 Set login. Added by Lauro. More...
 
void setPassword (const std::string &password)
 Set password. Added by Lauro. More...
 
std::string string () const
 Calculate string. More...
 

Static Public Attributes

static const char IP_LITERAL_BEGIN_CHAR
 IP literal begin ('[') More...
 
static const char IP_LITERAL_END_CHAR
 IP literal end (']') More...
 
static const char PORT_SEPARATOR_CHAR
 port separator (':') More...
 

Private Member Functions

void loadDefaultPorts ()
 

Private Attributes

std::string host_
 
host_type_e host_type_
 
std::string login_
 
std::string password_
 
unsigned short port_
 

Static Private Attributes

static std::map< std::string, unsigned short > protocol2DefaultPort_
 Protocol to default port. Added by Lauro. More...
 

Friends

bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, authority &v)
 Parse URI authority, returning whether found or not and advancing first and setting authority if found. More...
 

Detailed Description

URI authority component (without userinfo).

The authority string and the type of the authority is stored in this object. The syntax is checked with the corresponding type. For example if this indicates DOMAIN_NAME then the string can be parsed as a domain_name object.

Syntax: This does not support userinfo nor IPvFuture. Requires domain-name instead of reg-name.

authority  = host [ ":" port ]
host       = IP-literal | IPv4address | domain-name
IP-literal = "[" IPv6address "]"
port       = *DIGIT

Definition at line 49 of file authority.h.

Member Enumeration Documentation

Enumeration.

Enumerator
null 
DOMAIN_NAME 

domain name

IP_ADDRESS 

IP address.

IPV6_ADDRESS 

IP v6 address.

Definition at line 52 of file authority.h.

Constructor & Destructor Documentation

te::common::uri::authority::authority ( )

Construct.

te::common::uri::authority::authority ( const std::string &  v)

Construct from string.

This test to be sure host is of a valid form (see class description).

Exceptions
std::invalid_argumentif invalid or empty

Member Function Documentation

bool te::common::uri::authority::empty ( ) const
inline

Test if null/empty.

Definition at line 63 of file authority.h.

int te::common::uri::authority::getDefaultPort ( const std::string &  scheme)

Get Default port for the protocol. Added by Lauro.

std::string te::common::uri::authority::getEncodedLogin ( ) const

Get endoded login. Added by Lauro.

std::string te::common::uri::authority::getEncodedPassword ( ) const

Get encoded password. Added by Lauro.

std::string te::common::uri::authority::getLogin ( ) const

Get login. Added by Lauro.

std::string te::common::uri::authority::getPassword ( ) const

Get password. Added by Lauro.

const std::string& te::common::uri::authority::host ( ) const
inline

Get host.

Definition at line 65 of file authority.h.

host_type_e te::common::uri::authority::host_type ( ) const
inline

Get host type.

Definition at line 66 of file authority.h.

bool te::common::uri::authority::is_null ( ) const
inline

Test if null/empty.

Definition at line 64 of file authority.h.

void te::common::uri::authority::loadDefaultPorts ( )
private
std::ostream& te::common::uri::authority::operator<< ( std::ostream &  os) const

Stream out.

unsigned short te::common::uri::authority::port ( ) const
inline

Get port (0 if none).

Definition at line 67 of file authority.h.

void te::common::uri::authority::port ( unsigned short  p)
inline

Set port. Added by Lauro.

Definition at line 68 of file authority.h.

void te::common::uri::authority::setDefaultPort ( const std::string &  scheme)

Set Default port for the protocol. Added by Lauro.

void te::common::uri::authority::setLogin ( const std::string &  login)

Set login. Added by Lauro.

void te::common::uri::authority::setPassword ( const std::string &  password)

Set password. Added by Lauro.

std::string te::common::uri::authority::string ( ) const

Calculate string.

Friends And Related Function Documentation

bool TECOMMONEXPORT parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
authority v 
)
friend

Parse URI authority, returning whether found or not and advancing first and setting authority if found.

Does not skip leading space.

Member Data Documentation

std::string te::common::uri::authority::host_
private

Definition at line 86 of file authority.h.

host_type_e te::common::uri::authority::host_type_
private

Definition at line 85 of file authority.h.

const char te::common::uri::authority::IP_LITERAL_BEGIN_CHAR
static

IP literal begin ('[')

Definition at line 79 of file authority.h.

const char te::common::uri::authority::IP_LITERAL_END_CHAR
static

IP literal end (']')

Definition at line 80 of file authority.h.

std::string te::common::uri::authority::login_
private

Definition at line 88 of file authority.h.

std::string te::common::uri::authority::password_
private

Definition at line 89 of file authority.h.

unsigned short te::common::uri::authority::port_
private

Definition at line 87 of file authority.h.

const char te::common::uri::authority::PORT_SEPARATOR_CHAR
static

port separator (':')

Definition at line 81 of file authority.h.

std::map<std::string, unsigned short> te::common::uri::authority::protocol2DefaultPort_
staticprivate

Protocol to default port. Added by Lauro.

Definition at line 92 of file authority.h.


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