fastcgi++
Public Member Functions | Private Attributes | Friends
Fastcgipp::Http::Address Class Reference

Efficiently stores IPv4 addresses. More...

#include <http.hpp>

List of all members.

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.

Detailed Description

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 116 of file http.hpp.


Constructor & Destructor Documentation

Fastcgipp::Http::Address::Address ( const Address address) [inline]

Definition at line 130 of file http.hpp.

Fastcgipp::Http::Address::Address ( unsigned int  data_) [inline, explicit]

Construct the IPv4 address from an integer.

Parameters:
[in]data_Unsigned 32bit integer representing the IPv4 address

Definition at line 135 of file http.hpp.

Fastcgipp::Http::Address::Address ( ) [inline]

Constructs from a value of 0.0.0.0 (0)

Definition at line 137 of file http.hpp.

Referenced by operator&().


Member Function Documentation

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".

Parameters:
[in]startFirst character of the string
[in]endLast 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]

Retrieve the integer value of the IPv4 address.

Returns:
Unsigned 32bit integer representing the IPv4 address

Definition at line 123 of file http.hpp.

References data.

Address Fastcgipp::Http::Address::operator& ( const Address  x) const [inline]

Definition at line 152 of file http.hpp.

References Address(), and data.

bool Fastcgipp::Http::Address::operator< ( const Address  x) const [inline]

Definition at line 149 of file http.hpp.

References data.

bool Fastcgipp::Http::Address::operator<= ( const Address  x) const [inline]

Definition at line 150 of file http.hpp.

References data.

Address Fastcgipp::Http::Address::operator= ( unsigned int  data_) [inline]

Assign the IPv4 address from an integer.

Parameters:
[in]data_Unsigned 32bit integer representing the IPv4 address

Definition at line 128 of file http.hpp.

References data.

Address Fastcgipp::Http::Address::operator= ( Address  address) [inline]

Definition at line 129 of file http.hpp.

References data.

bool Fastcgipp::Http::Address::operator== ( const Address  x) const [inline]

Definition at line 147 of file http.hpp.

References data.

bool Fastcgipp::Http::Address::operator> ( const Address  x) const [inline]

Definition at line 148 of file http.hpp.

References data.

bool Fastcgipp::Http::Address::operator>= ( const Address  x) const [inline]

Definition at line 151 of file http.hpp.

References data.


Friends And Related Function Documentation

template<class charT , class Traits >
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.

template<class charT , class Traits >
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".


Member Data Documentation

unsigned int Fastcgipp::Http::Address::data [private]

Data representation of the IPv4 address.

Definition at line 158 of file http.hpp.

Referenced by assign(), getInt(), operator&(), operator<(), operator<=(), operator=(), operator==(), operator>(), and operator>=().


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