IP2C Class Reference

IP to Country database handler. More...

#include <ip2c.h>

+ Inheritance diagram for IP2C:


class  IP2CData

Public Member Functions

void appendEntryToDatabase (const IP2CData &entry)
 Adds new country entry to the database. More...
const QPixmap & flag (const QString &countryShortName)
bool isDataAccessLocked () const
const IP2CDatalookupIP (unsigned int ipaddress)
const IP2CDatalookupIP (const QHostAddress &ipaddress)
int numKnownEntries () const
IP2CCountryInfo obtainCountryInfo (unsigned int ipaddress)
IP2CCountryInfo obtainCountryInfo (const QHostAddress &ipaddress)
void setDataAccessLockEnabled (bool b)
void setDatabase (const QList< IP2CData > &sortedCountryData)
 Sets database contents to the list specified. More...

Static Public Member Functions

static void deinstantiate ()
static IP2Cinstance ()

Public Attributes

const QPixmap flagLan
const QPixmap flagLocalhost
const QPixmap flagUnknown

Protected Member Functions

bool isLANAddress (unsigned ipv4Address)
bool isLocalhostAddress (unsigned ipv4Address)

Detailed Description

IP to Country database handler.

IP2C class provides an interface for translating IP addresses into country names they are in. Additional methods allow to retrieve country's flag picture for given IP.

See Also

Definition at line 48 of file ip2c.h.

Member Function Documentation

void IP2C::appendEntryToDatabase ( const IP2CData entry)

Adds new country entry to the database.

Makes sure the database is sorted in ascending order.

Definition at line 70 of file ip2c.cpp.

const IP2C::IP2CData & IP2C::lookupIP ( unsigned int  ipaddress)

Returns a reference to the structure describing the country.

Definition at line 117 of file ip2c.cpp.

IP2CCountryInfo IP2C::obtainCountryInfo ( unsigned int  ipaddress)

Returns country information based on given IP.

Definition at line 152 of file ip2c.cpp.

void IP2C::setDatabase ( const QList< IP2CData > &  sortedCountryData)

Sets database contents to the list specified.

To avoid performance issues it is already assumed that the specified list is sorted.

Definition at line 121 of file ip2c.h.

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