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
Public Types | |
null | |
DOMAIN_NAME | |
domain name | |
IP_ADDRESS | |
IP address. | |
IPV6_ADDRESS | |
IP v6 address. | |
enum | host_type_e { null, DOMAIN_NAME, IP_ADDRESS, IPV6_ADDRESS } |
Enumeration. More... | |
Public Member Functions | |
authority () | |
authority (const std::string &v) | |
bool | empty () const |
Test if null/empty. | |
bool | is_null () const |
Test if null/empty. | |
const std::string & | host () const |
Get host. | |
host_type_e | host_type () const |
Get host type. | |
unsigned short | port () const |
Get port (0 if none). | |
std::string | string () const |
Calculate string. | |
std::ostream & | operator<< (std::ostream &os) const |
Stream out. | |
Static Public Attributes | |
static const char | IP_LITERAL_BEGIN_CHAR |
IP literal begin ('['). | |
static const char | IP_LITERAL_END_CHAR |
IP literal end (']'). | |
static const char | PORT_SEPARATOR_CHAR |
port separator (':') | |
Friends | |
bool URIPP_API | parse (std::string::const_iterator &first, std::string::const_iterator last, authority &v) |
uripp::authority::authority | ( | ) |
Construct.
uripp::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 |
bool URIPP_API 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.