Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

authority_view

A non-owning reference to a valid authority.

Synopsis

Defined in header <boost/url/authority_view.hpp>

class authority_view
Member Functions

Name

Description

authority_view [constructor]

Constructor.

Construct from a string.

buffer

Return the complete authority.

data

Return a pointer to the first character.

empty

Return true if the authority is empty.

encoded_host

Return the host.

encoded_host_address

Return the host.

encoded_host_and_port

Return the host and port.

encoded_host_name

Return the host name.

encoded_password

Return the password.

encoded_user

Return the user.

encoded_userinfo

Return the userinfo.

has_password

Return true if a password is present.

has_port

Return true if a port is present.

has_userinfo

Return true if a userinfo is present.

host

Return the host.

host_address

Return the host.

host_ipv4_address

Return the host IPv4 address.

host_ipv6_address

Return the host IPv6 address.

host_ipvfuture

Return the host IPvFuture address.

host_name

Return the host name.

host_type

Return the host type.

operator=

Assignment.

password

Return the password.

port

Return the port.

port_number

Return the port.

size

Return the number of characters in the authority.

user

Return the user.

userinfo

Return the userinfo.

~authority_view [destructor]

Destructor.

Friends

Name

Description

operator<<

Format the encoded authority to the output stream.

Description

Objects of this type represent valid authority strings constructed from a parsed, external character buffer whose storage is managed by the caller. That is, it acts like a string_view in terms of ownership. The caller is responsible for ensuring that the lifetime of the underlying character buffer extends until it is no longer referenced.

Example 1

Construction from a string parses the input as an authority and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred.

authority_view a( "user:pass@www.example.com:8080" );
Example 2

The parsing function parse_authority returns a result containing either a valid authority_view upon succcess, otherwise it contain an error. The error can be converted to an exception by the caller if desired:

result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );
BNF
authority     = [ userinfo "@" ] host [ ":" port ]

userinfo      = user [ ":" [ password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )

host          = IP-literal / IPv4address / reg-name

port          = *DIGIT
Specification
See Also

parse_authority.

Convenience header <boost/url.hpp>


PrevUpHomeNext