Ceylan::Network::IPAddressvFour Class Reference

Handles IPv4 addresses. More...

#include <CeylanIPAddressvFour.h>

Inheritance diagram for Ceylan::Network::IPAddressvFour:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::Network::IPAddressvFour:

Collaboration graph
[legend]

List of all members.

Public Types

typedef Ceylan::Uint8 IPvFourComponent
enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 IPAddressvFour (IPvFourComponent first, IPvFourComponent second, IPvFourComponent third, IPvFourComponent fourth)
 Constructs an IPv4 address from its four sub-components.
 IPAddressvFour (const std::string &IPString)
 Constructs an IPv4 from specified string, whose form must be that of "120.200.65.3".
virtual ~IPAddressvFour () throw ()
 Basic virtual destructor.
virtual NetworkAddressType getType () const
 Returns the actual type of the IP address, IPv4.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns a user-friendly description of the state of this object.

Static Public Member Functions

static bool IsValidIPv4 (const std::string &ipString)
 Returns whether IPString is a valid IP.
static bool IsValid (const std::string IPString)
 Tells whether the specified string is a valid IP address.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Member Functions

virtual void validate () const
 Checks that internal IP is valid.

Protected Attributes

IPvFourComponent _first
 First IPv4 component.
IPvFourComponent _second
 Second IPv4 component.
IPvFourComponent _third
 Third IPv4 component.
IPvFourComponent _fourth
 Fourth IPv4 component.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 IPAddressvFour (const IPAddressvFour &source)
 Copy constructor made private to ensure that it will never be called.
IPAddressvFouroperator= (const IPAddressvFour &source)
 Assignment operator made private to ensure that it will never be called.


Detailed Description

Handles IPv4 addresses.

Definition at line 48 of file CeylanIPAddressvFour.h.


Member Typedef Documentation

Definition at line 57 of file CeylanIPAddressvFour.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

IPAddressvFour::IPAddressvFour ( IPvFourComponent  first,
IPvFourComponent  second,
IPvFourComponent  third,
IPvFourComponent  fourth 
)

Constructs an IPv4 address from its four sub-components.

Example: 'IPAddressvFour( 120, 200, 65, 3)' constructs the IPv4 address '120.200.65.3'

Exceptions:
NetworkException is the specified arguments are not valid.

Definition at line 49 of file CeylanIPAddressvFour.cc.

References validate().

IPAddressvFour::IPAddressvFour ( const std::string &  IPString  )  [explicit]

Constructs an IPv4 from specified string, whose form must be that of "120.200.65.3".

Exceptions:
NetworkException if the string does not contain a representation of a valid IPv4 address.

Definition at line 67 of file CeylanIPAddressvFour.cc.

References _first, _fourth, _second, _third, Ceylan::toString(), and validate().

IPAddressvFour::~IPAddressvFour (  )  throw () [virtual]

Basic virtual destructor.

Definition at line 189 of file CeylanIPAddressvFour.cc.

Ceylan::Network::IPAddressvFour::IPAddressvFour ( const IPAddressvFour source  )  [private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

NetworkAddressType IPAddressvFour::getType (  )  const [virtual]

Returns the actual type of the IP address, IPv4.

Implements Ceylan::Network::IPAddress.

Definition at line 196 of file CeylanIPAddressvFour.cc.

References Ceylan::Network::IPv4.

bool IPAddress::IsValid ( const std::string  IPString  )  [static, inherited]

Tells whether the specified string is a valid IP address.

Note:
For abstract IPAddress, always returns false.

Definition at line 61 of file CeylanIPAddress.cc.

References generalUtils::false.

bool IPAddressvFour::IsValidIPv4 ( const std::string &  ipString  )  [static]

Returns whether IPString is a valid IP.

Note:
If the regular expression support is not available, less checks are performed.

Definition at line 217 of file CeylanIPAddressvFour.cc.

References dataUtils::e, generalUtils::false, Ceylan::RegExp::matches(), and generalUtils::true.

IPAddressvFour& Ceylan::Network::IPAddressvFour::operator= ( const IPAddressvFour source  )  [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string IPAddressvFour::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level. For level 'Ceylanlow', the exact usual stringified IP will be returned (ex: "82.225.152.215").
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Reimplemented from Ceylan::Network::IPAddress.

Definition at line 205 of file CeylanIPAddressvFour.cc.

References _first, _fourth, _second, _third, and Ceylan::toNumericalString().

Referenced by Ceylan::Network::ClientStreamSocket::connect().

void IPAddressvFour::validate (  )  const [protected, virtual]

Checks that internal IP is valid.

Exceptions:
NetworkException if the address is not valid.

Implements Ceylan::Network::IPAddress.

Definition at line 256 of file CeylanIPAddressvFour.cc.

Referenced by IPAddressvFour().


Member Data Documentation

First IPv4 component.

Definition at line 149 of file CeylanIPAddressvFour.h.

Referenced by IPAddressvFour(), and toString().

Fourth IPv4 component.

Definition at line 161 of file CeylanIPAddressvFour.h.

Referenced by IPAddressvFour(), and toString().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

Second IPv4 component.

Definition at line 153 of file CeylanIPAddressvFour.h.

Referenced by IPAddressvFour(), and toString().

Third IPv4 component.

Definition at line 157 of file CeylanIPAddressvFour.h.

Referenced by IPAddressvFour(), and toString().


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

Generated on Thu Jun 4 20:40:41 2009 for Ceylan by  doxygen 1.5.8