GeoIp Class Reference

#include <geoip.h>

List of all members.

Public Member Functions

 GeoIp ()
 GeoIp (QHostAddress ip)
 GeoIp (QHostAddress ip, float latitude, float longitude, QString city, QString state, QString country)
QString toString () const
QHostAddress ip () const
float latitude () const
float longitude () const
QString city () const
QString state () const
QString country () const
QString toLocation () const
bool isEmpty () const
bool isUnknown () const

Static Public Member Functions

static GeoIp fromString (QString geoip)

Private Attributes

QHostAddress _ip
float _latitude
float _longitude
QString _city
QString _state
QString _country


Detailed Description

Definition at line 24 of file geoip.h.


Constructor & Destructor Documentation

GeoIp::GeoIp (  )  [inline]

Default constructor

Definition at line 28 of file geoip.h.

Referenced by fromString().

GeoIp::GeoIp ( QHostAddress  ip  ) 

Constructor.

Constructor

Definition at line 28 of file geoip.cpp.

References _ip, _latitude, and _longitude.

GeoIp::GeoIp ( QHostAddress  ip,
float  latitude,
float  longitude,
QString  city,
QString  state,
QString  country 
)

Constructor

Constructor.

Definition at line 35 of file geoip.cpp.

References _city, _country, _ip, _latitude, _longitude, and _state.


Member Function Documentation

QString GeoIp::city (  )  const [inline]

Returns the city in which this IP lives.

Definition at line 48 of file geoip.h.

References _city.

Referenced by fromString().

QString GeoIp::country (  )  const [inline]

Returns the country in which this IP lives.

Definition at line 52 of file geoip.h.

References _country.

Referenced by fromString(), and RouterListItem::setLocation().

GeoIp GeoIp::fromString ( QString  geoip  )  [static]

Creates a GeoIp object from a string.

Parses the GeoIp information from a comma-delimited string. The format of the string is as in the following example:

128.213.48.13,Troy,NY,US,42.7495,-73.5951,1138402852

Definition at line 52 of file geoip.cpp.

References city(), country(), GeoIp(), ip(), latitude(), longitude(), and state().

Referenced by GeoIpResponse::GeoIpResponse().

QHostAddress GeoIp::ip (  )  const [inline]

Returns the IP address for this object.

Definition at line 42 of file geoip.h.

References _ip.

Referenced by GeoIpCache::cache(), GeoIpResolver::disconnected(), fromString(), GeoIpCacheItem::ip(), and NetViewer::resolved().

bool GeoIp::isEmpty (  )  const

Returns true if the GeoIp object is invalid.

Definition at line 92 of file geoip.cpp.

References _ip, _latitude, _longitude, IS_VALID_LATITUDE, and IS_VALID_LONGITUDE.

Referenced by GeoIpResponse::GeoIpResponse(), and GeoIpCacheItem::isEmpty().

bool GeoIp::isUnknown (  )  const

Returns true if the GeoIp object is valid, but no location information is known for the associated IP address.

Definition at line 102 of file geoip.cpp.

References _ip, _latitude, _longitude, IS_VALID_LATITUDE, and IS_VALID_LONGITUDE.

Referenced by GeoIpCacheItem::isExpired(), and NetViewer::resolved().

float GeoIp::latitude (  )  const [inline]

Returns the latitude coordinate for this IP.

Definition at line 44 of file geoip.h.

References _latitude.

Referenced by fromString(), and NetViewer::resolved().

float GeoIp::longitude (  )  const [inline]

Returns the longitude coordinate for this IP.

Definition at line 46 of file geoip.h.

References _longitude.

Referenced by fromString(), and NetViewer::resolved().

QString GeoIp::state (  )  const [inline]

Returns the state or district in which this IP lives.

Definition at line 50 of file geoip.h.

References _state.

Referenced by fromString().

QString GeoIp::toLocation (  )  const

Returns a human-readable string of city, region(state), and country.

Returns a human-readable string of GeoIp location information.

Definition at line 111 of file geoip.cpp.

References _city, _country, _state, and i().

Referenced by RouterListItem::setLocation().

QString GeoIp::toString (  )  const

Builds a comma-delimited string of GeoIp fields.

Formats the GeoIp information as a comma-delimited string.

Definition at line 77 of file geoip.cpp.

References _city, _country, _ip, _latitude, _longitude, and _state.

Referenced by GeoIpCacheItem::toString().


Member Data Documentation

QString GeoIp::_city [private]

City in which this IP lives.

Definition at line 66 of file geoip.h.

Referenced by city(), GeoIp(), toLocation(), and toString().

QString GeoIp::_country [private]

Country in which this IP lives.

Definition at line 68 of file geoip.h.

Referenced by country(), GeoIp(), toLocation(), and toString().

QHostAddress GeoIp::_ip [private]

IP address for this location.

Definition at line 63 of file geoip.h.

Referenced by GeoIp(), ip(), isEmpty(), isUnknown(), and toString().

float GeoIp::_latitude [private]

Latitudinal coordinate for this IP's location.

Definition at line 64 of file geoip.h.

Referenced by GeoIp(), isEmpty(), isUnknown(), latitude(), and toString().

float GeoIp::_longitude [private]

Longitudinal coordinate for this IP's location.

Definition at line 65 of file geoip.h.

Referenced by GeoIp(), isEmpty(), isUnknown(), longitude(), and toString().

QString GeoIp::_state [private]

State or district in which this IP lives.

Definition at line 67 of file geoip.h.

Referenced by GeoIp(), state(), toLocation(), and toString().


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

Generated on Wed Nov 26 21:04:21 2008 for Vidalia by  doxygen 1.5.7.1