Fastcgipp::Http::Address Class Reference

Efficiently stores IPv4 addresses. More...

#include <http.hpp>

List of all members.

Public Member Functions

uint32_t getInt () const
 Retrieve the integer value of the IPv4 address.
Address operator= (uint32_t data_)
 Assign the IPv4 address from an integer.
Address operator= (Address address)
 Address (const Address &address)
 Address (uint32_t 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.

Private Attributes

uint32_t data
 Data representation of the IPv4 address.

Friends

bool operator== (Address x, Address y)
 Compare two Address values.
bool operator> (Address x, Address y)
 Compare two Address values.
bool operator< (Address x, Address y)
 Compare two Address values.
bool operator<= (Address x, Address y)
 Compare two Address values.
bool operator>= (Address x, Address y)
 Compare two Address values.
Address operator& (Address x, Address y)
 Bitwise AND two Address values.
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 75 of file http.hpp.


Constructor & Destructor Documentation

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

Definition at line 89 of file http.hpp.

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

Construct the IPv4 address from an integer.

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

Definition at line 94 of file http.hpp.

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

Constructs from a value of 0.0.0.0 (0).

Definition at line 96 of file http.hpp.


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] start First character of the string
[in] end Last character of the string + 1

Definition at line 28 of file http.cpp.

References Fastcgipp::Http::atoi(), and data.

Referenced by Fastcgipp::Http::Session< charT >::fill().

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

References data.

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

Definition at line 88 of file http.hpp.

References data.

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

Assign the IPv4 address from an integer.

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

Definition at line 87 of file http.hpp.

References data.


Friends And Related Function Documentation

Address operator& ( Address  x,
Address  y 
) [friend]

Bitwise AND two Address values.

The bitwise AND operation is passed on to the internal unsigned 32 bit integer

Definition at line 153 of file http.hpp.

bool operator< ( Address  x,
Address  y 
) [friend]

Compare two Address values.

This comparator merely passes on the comparison to the internal unsigned 32 bit integer.

Definition at line 136 of file http.hpp.

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.

bool operator<= ( Address  x,
Address  y 
) [friend]

Compare two Address values.

This comparator merely passes on the comparison to the internal unsigned 32 bit integer.

Definition at line 142 of file http.hpp.

bool operator== ( Address  x,
Address  y 
) [friend]

Compare two Address values.

This comparator merely passes on the comparison to the internal unsigned 32 bit integer.

Definition at line 124 of file http.hpp.

bool operator> ( Address  x,
Address  y 
) [friend]

Compare two Address values.

This comparator merely passes on the comparison to the internal unsigned 32 bit integer.

Definition at line 130 of file http.hpp.

bool operator>= ( Address  x,
Address  y 
) [friend]

Compare two Address values.

This comparator merely passes on the comparison to the internal unsigned 32 bit integer.

Definition at line 148 of file http.hpp.

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

uint32_t Fastcgipp::Http::Address::data [private]


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

Generated on Thu Dec 11 01:47:29 2008 for fastcgi++ by  doxygen 1.5.7.1