Vidalia  0.2.17
Public Member Functions | Private Attributes
GeoIpRecord Class Reference

#include <GeoIpRecord.h>

List of all members.

Public Member Functions

 GeoIpRecord ()
 GeoIpRecord (const QHostAddress &ip, float latitude, float longitude, const QString &country, const QString &countryCode)
 GeoIpRecord (const QHostAddress &ip, float latitude, float longitude, const QString &city, const QString &region, const QString &country, const QString &countryCode)
QHostAddress ip () const
float latitude () const
float longitude () const
QString city () const
QString region () const
QString country () const
QString countryCode () const
QString toString () const
bool isValid () const

Private Attributes

QHostAddress _ip
float _latitude
float _longitude
QString _city
QString _region
QString _country
QString _countryCode

Detailed Description

Definition at line 24 of file GeoIpRecord.h.


Constructor & Destructor Documentation

Default constructor. Creates an empty GeoIpRecord object.

Definition at line 26 of file GeoIpRecord.cpp.

References _latitude, and _longitude.

GeoIpRecord::GeoIpRecord ( const QHostAddress &  ip,
float  latitude,
float  longitude,
const QString &  country,
const QString &  countryCode 
)
GeoIpRecord::GeoIpRecord ( const QHostAddress &  ip,
float  latitude,
float  longitude,
const QString &  city,
const QString &  region,
const QString &  country,
const QString &  countryCode 
)

Member Function Documentation

QString GeoIpRecord::city ( ) const [inline]

Returns the name of the city associated with this IP address, if known. Otherwise, returns an empty QString.

Definition at line 59 of file GeoIpRecord.h.

References _city.

Referenced by GeoIpRecord().

QString GeoIpRecord::country ( ) const [inline]

Returns the full name of the country associated with this IP address or range of IP addresses, if known. Otherwise, returns an empty QString.

Definition at line 69 of file GeoIpRecord.h.

References _country.

Referenced by TorMapWidget::addRouter(), and GeoIpRecord().

QString GeoIpRecord::countryCode ( ) const [inline]

Returns the ISO 3166-1 alpha-2 two-letter country code of the country associated with this IP address or range of IP addresses, if known. Otherwise, returns an empty QString.

Definition at line 75 of file GeoIpRecord.h.

References _countryCode.

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

QHostAddress GeoIpRecord::ip ( ) const [inline]

Returns the IP address associated with this GeoIP object.

Definition at line 44 of file GeoIpRecord.h.

References _ip.

Referenced by NetViewer::addRouter(), and GeoIpRecord().

bool GeoIpRecord::isValid ( ) const

Returns true if the GeoIpRecord object is valid. A valid GeoIpRecord object must have valid IP address, valid latitude and longitude coordinates and a two-letter country code.

Definition at line 56 of file GeoIpRecord.cpp.

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

Referenced by NetViewer::addRouter().

float GeoIpRecord::latitude ( ) const [inline]

Returns the latitude portion of the geographic coordinates associated with this IP address or range of IP addresses.

Definition at line 49 of file GeoIpRecord.h.

References _latitude.

Referenced by TorMapImageView::addRouter(), TorMapWidget::addRouter(), and GeoIpRecord().

float GeoIpRecord::longitude ( ) const [inline]

Returns the longitude portion of the geographic coordinates associated with this IP address or range of IP addresses.

Definition at line 54 of file GeoIpRecord.h.

References _longitude.

Referenced by TorMapImageView::addRouter(), TorMapWidget::addRouter(), and GeoIpRecord().

QString GeoIpRecord::region ( ) const [inline]

Returns the full region name (e.g., state) in which this IP address resides, if known. Otherwise, returns an empty QString.

Definition at line 64 of file GeoIpRecord.h.

References _region.

Referenced by GeoIpRecord().

QString GeoIpRecord::toString ( ) const

Returns a human-readable string of city, region(state), and country. Some fields may be absent if they are not known. If no fields are known, this will return an empty QString.

Definition at line 64 of file GeoIpRecord.cpp.

References _city, _country, _countryCode, and _region.

Referenced by TorMapWidget::addRouter(), NetViewer::displayRouterInfo(), GeoIpDatabase::recordByAddr(), and RouterListItem::setLocation().


Member Data Documentation

QString GeoIpRecord::_city [private]

City in which this IP lives.

Definition at line 93 of file GeoIpRecord.h.

Referenced by city(), GeoIpRecord(), and toString().

QString GeoIpRecord::_country [private]

Country in which this IP lives.

Definition at line 95 of file GeoIpRecord.h.

Referenced by country(), GeoIpRecord(), and toString().

QString GeoIpRecord::_countryCode [private]

ISO-3166-1 alpha-2 country code.

Definition at line 96 of file GeoIpRecord.h.

Referenced by countryCode(), GeoIpRecord(), and toString().

QHostAddress GeoIpRecord::_ip [private]

IP address for this location.

Definition at line 90 of file GeoIpRecord.h.

Referenced by GeoIpRecord(), ip(), and isValid().

float GeoIpRecord::_latitude [private]

Latitudinal coordinate for this IP's location.

Definition at line 91 of file GeoIpRecord.h.

Referenced by GeoIpRecord(), isValid(), and latitude().

float GeoIpRecord::_longitude [private]

Longitudinal coordinate for this IP's location.

Definition at line 92 of file GeoIpRecord.h.

Referenced by GeoIpRecord(), isValid(), and longitude().

QString GeoIpRecord::_region [private]

State or district in which this IP lives.

Definition at line 94 of file GeoIpRecord.h.

Referenced by GeoIpRecord(), region(), and toString().


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