Efficiently stores IPv4 addresses. More...
#include <http.hpp>
Public Member Functions | |
const unsigned int & | getInt () const |
Retrieve the integer value of the IPv4 address. | |
Address | operator= (unsigned int data_) |
Assign the IPv4 address from an integer. | |
Address | operator= (Address address) |
Address (const Address &address) | |
Address (unsigned int data_) | |
Construct the IPv4 address from an integer. | |
Address () | |
Constructs from a value of 0.0.0.0 (0) | |
void | assign (const char *start, const char *end) |
Assign the IPv4 address from a string of characters. | |
bool | operator== (const Address x) const |
bool | operator> (const Address x) const |
bool | operator< (const Address x) const |
bool | operator<= (const Address x) const |
bool | operator>= (const Address x) const |
Address | operator& (const Address x) const |
Private Attributes | |
unsigned int | data |
Data representation of the IPv4 address. | |
Friends | |
template<class charT , class Traits > | |
std::basic_ostream< charT, Traits > & | operator<< (std::basic_ostream< charT, Traits > &os, const Address &address) |
Address stream insertion operation. | |
template<class charT , class Traits > | |
std::basic_istream< charT, Traits > & | operator>> (std::basic_istream< charT, Traits > &is, Address &address) |
Address stream extractor operation. |
Efficiently stores IPv4 addresses.
This class stores IPv4 addresses as unsigned 32bit integers. It does this as opposed to storing the string itself to facilitate efficient logging and processing of the address. The class possesses full IO and comparison capabilities as well as allowing bitwise AND operations for netmask calculation.
Definition at line 105 of file http.hpp.
Fastcgipp::Http::Address::Address | ( | const Address & | address ) | [inline] |
Fastcgipp::Http::Address::Address | ( | unsigned int | data_ ) | [inline, explicit] |
Fastcgipp::Http::Address::Address | ( | ) | [inline] |
Constructs from a value of 0.0.0.0 (0)
Definition at line 126 of file http.hpp.
Referenced by operator&().
void Fastcgipp::Http::Address::assign | ( | const char * | start, |
const char * | end | ||
) |
Assign the IPv4 address from a string of characters.
In order for this to work the string must represent an IPv4 address in textual decimal form and nothing else. Example: "127.0.0.1".
[in] | start | First character of the string |
[in] | end | Last character of the string + 1 |
Definition at line 29 of file http.cpp.
References Fastcgipp::Http::atoi(), and data.
const unsigned int& Fastcgipp::Http::Address::getInt | ( | ) | const [inline] |
bool Fastcgipp::Http::Address::operator< | ( | const Address | x ) | const [inline] |
bool Fastcgipp::Http::Address::operator<= | ( | const Address | x ) | const [inline] |
Address Fastcgipp::Http::Address::operator= | ( | unsigned int | data_ ) | [inline] |
bool Fastcgipp::Http::Address::operator== | ( | const Address | x ) | const [inline] |
bool Fastcgipp::Http::Address::operator> | ( | const Address | x ) | const [inline] |
bool Fastcgipp::Http::Address::operator>= | ( | const Address | x ) | const [inline] |
std::basic_ostream<charT, Traits>& operator<< | ( | std::basic_ostream< charT, Traits > & | os, |
const Address & | address | ||
) | [friend] |
Address stream insertion operation.
This stream inserter obeys all stream manipulators regarding alignment, field width and numerical base.
std::basic_istream<charT, Traits>& operator>> | ( | std::basic_istream< charT, Traits > & | is, |
Address & | address | ||
) | [friend] |
Address stream extractor operation.
In order for this to work the stream must be positioned on at the start of a standard decimal representation of a IPv4 address. Example: "127.0.0.1".
unsigned int Fastcgipp::Http::Address::data [private] |
Data representation of the IPv4 address.
Definition at line 147 of file http.hpp.
Referenced by assign(), getInt(), operator&(), operator<(), operator<=(), operator=(), operator==(), operator>(), and operator>=().