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... | |
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.
Enumeration.
Enumerator | |
---|---|
null | |
DOMAIN_NAME |
domain name |
IP_ADDRESS |
IP address. |
IPV6_ADDRESS |
IP v6 address. |
Definition at line 52 of file authority.h.
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).
std::invalid_argument | if invalid or empty |
|
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.
|
inline |
Get host.
Definition at line 65 of file authority.h.
|
inline |
Get host type.
Definition at line 66 of file authority.h.
|
inline |
Test if null/empty.
Definition at line 64 of file authority.h.
|
private |
std::ostream& te::common::uri::authority::operator<< | ( | std::ostream & | os | ) | const |
Stream out.
|
inline |
Get port (0 if none).
Definition at line 67 of file authority.h.
|
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.
|
friend |
Parse URI authority, returning whether found or not and advancing first and setting authority if found.
Does not skip leading space.
|
private |
Definition at line 86 of file authority.h.
|
private |
Definition at line 85 of file authority.h.
|
static |
IP literal begin ('[')
Definition at line 79 of file authority.h.
|
static |
IP literal end (']')
Definition at line 80 of file authority.h.
|
private |
Definition at line 88 of file authority.h.
|
private |
Definition at line 89 of file authority.h.
|
private |
Definition at line 87 of file authority.h.
|
static |
port separator (':')
Definition at line 81 of file authority.h.
|
staticprivate |
Protocol to default port. Added by Lauro.
Definition at line 92 of file authority.h.