IP2C Class Reference

IP to Country database handler. More...

#include <ip2c.h>

+ Inheritance diagram for IP2C:

Public Types

enum  Lookup { LOOKUP_IP, LOOKUP_DIRECT, LOOKUP_DONT }
 Indicate how the IP2C resolution should occur. More...
 

Public Member Functions

IP2CCountry countryInfo (const QString &countryCode)
 
IP2CCountry countryInfoForAddress (const QHostAddress &ipaddress)
 
IP2CCountry countryInfoForIPv4 (unsigned int ipaddress)
 
IP2CCountry countryInfoForServer (const Server &server)
 
const QPixmap & flag (const QString &countryCode)
 
bool hasData () const
 
bool isDataAccessLocked () const
 
const QMap< QString, QString > & licenceNotice () const
 
int numKnownEntries () const
 
void setDataAccessLockEnabled (bool b)
 
void setLicence (const QMap< QString, QString > &licences)
 
void setRangesDatabase (const QList< IP2CRange > &sortedRanges)
 Sets the IP range database to the list specified.
 
void setUrl (const QString &url)
 
const QString & urlDatabase () const
 

Static Public Member Functions

static void deinstantiate ()
 
static Lookup howLookup (const QString &countryCode)
 
static IP2Cinstance ()
 

Public Attributes

const QPixmap flagLan
 
const QPixmap flagLocalhost
 
const QPixmap flagUnknown
 

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
IP2CParser

Definition at line 48 of file ip2c.h.

Member Enumeration Documentation

Indicate how the IP2C resolution should occur.

Enumerator
LOOKUP_IP 

Lookup the country by IP.

LOOKUP_DIRECT 

The country info is known; use it directly.

LOOKUP_DONT 

Don't look-up the country; force an unknown country.

Definition at line 56 of file ip2c.h.

Member Function Documentation

IP2CCountry IP2C::countryInfo ( const QString &  countryCode)

Returns country information based on the ISO 3166-1 alpha-3 code.

Definition at line 154 of file ip2c.cpp.

IP2CCountry IP2C::countryInfoForIPv4 ( unsigned int  ipaddress)

Returns country information based on given IP.

Definition at line 170 of file ip2c.cpp.

IP2C::Lookup IP2C::howLookup ( const QString &  countryCode)
static

Interpret the country code or a special value to see if and how the IP2C should be resolved.

Definition at line 112 of file ip2c.cpp.

void IP2C::setRangesDatabase ( const QList< IP2CRange > &  sortedRanges)
inline

Sets the IP range database 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: