te::common::uri::ip_address Class Reference

IP address. More...

#include <ip_address.h>

Public Member Functions

 ip_address ()
 Construct null. More...
 
 ip_address (const std::string &v)
 Construct from string. More...
 
bool is_null () const
 Test if null (all 0's). More...
 
std::ostream & operator<< (std::ostream &os) const
 Stream out. More...
 
std::string string () const
 Calculate string. More...
 

Static Public Attributes

static const char SEPARATOR_CHAR
 separator ('.') More...
 

Private Attributes

unsigned char octets_ [4]
 

Friends

bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, ip_address &v)
 Parse IP address, returning whether found or not and advancing first and setting address if found. More...
 
bool TECOMMONEXPORT parse (std::string::const_iterator &first, std::string::const_iterator last, ipv6_address &v)
 Parse IP v6 address, returning whether found or not and advancing first and setting address if found. More...
 

Detailed Description

IP address.

Syntax: Note that leading 0's are not valid.

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet   = DIGIT                 ; 0-9
            | %x31-39 DIGIT         ; 10-99
            | "1" 2DIGIT            ; 100-199
            | "2" %x30-34 DIGIT     ; 200-249
            | "25" %x30-35          ; 250-255
See also
http://tools.ietf.org/html/rfc3986#section-3.2.2

Definition at line 46 of file ip_address.h.

Constructor & Destructor Documentation

te::common::uri::ip_address::ip_address ( )

Construct null.

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

Construct from string.

Note that the string cannot be empty, it must contain valid chars.

Exceptions
std::invalid_argumentif invalid

Member Function Documentation

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

Test if null (all 0's).

Definition at line 54 of file ip_address.h.

std::ostream& te::common::uri::ip_address::operator<< ( std::ostream &  os) const

Stream out.

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

Calculate string.

Friends And Related Function Documentation

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

Parse IP address, returning whether found or not and advancing first and setting address if found.

Does not skip leading space.

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

Parse IP v6 address, returning whether found or not and advancing first and setting address if found.

Does not skip leading space.

Member Data Documentation

unsigned char te::common::uri::ip_address::octets_[4]
private

Definition at line 61 of file ip_address.h.

const char te::common::uri::ip_address::SEPARATOR_CHAR
static

separator ('.')

Definition at line 57 of file ip_address.h.


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