#include <GeoIp.h>
Public Member Functions | |
GeoIp () | |
GeoIp (const QHostAddress &ip, float latitude, float longitude, const QString &city=QString(), const QString ®ion=QString(), const QString &country=QString(), const QString &countryCode=QString()) | |
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 |
Definition at line 25 of file GeoIp.h.
GeoIp::GeoIp | ( | ) |
Default constructor. Creates an empty GeoIp object.
Definition at line 27 of file GeoIp.cpp.
References _latitude, and _longitude.
GeoIp::GeoIp | ( | const QHostAddress & | ip, | |
float | latitude, | |||
float | longitude, | |||
const QString & | city = QString() , |
|||
const QString & | region = QString() , |
|||
const QString & | country = QString() , |
|||
const QString & | countryCode = QString() | |||
) |
Definition at line 33 of file GeoIp.cpp.
References _city, _country, _countryCode, _ip, _latitude, _longitude, and _region.
QString GeoIp::city | ( | ) | const [inline] |
Returns the name of the city associated with this IP address, if known. Otherwise, returns an empty QString.
Definition at line 55 of file GeoIp.h.
References _city.
Referenced by GeoIpCacheItem::GeoIpCacheItem().
QString GeoIp::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 65 of file GeoIp.h.
References _country.
Referenced by TorMapWidget::addRouter(), and GeoIpCacheItem::GeoIpCacheItem().
QString GeoIp::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 71 of file GeoIp.h.
References _countryCode.
Referenced by GeoIpCacheItem::GeoIpCacheItem(), and RouterListItem::setLocation().
QHostAddress GeoIp::ip | ( | ) | const [inline] |
Returns the IP address associated with this GeoIP object.
Definition at line 40 of file GeoIp.h.
References _ip.
Referenced by GeoIpCache::addToCache(), and NetViewer::resolved().
bool GeoIp::isValid | ( | ) | const |
Returns true if the GeoIp object is valid. A valid GeoIp object must have valid IP address, valid latitude and longitude coordinates and a two-letter country code.
Definition at line 47 of file GeoIp.cpp.
References _ip, _latitude, _longitude, IS_VALID_LATITUDE, and IS_VALID_LONGITUDE.
Referenced by GeoIpResolver::parseGeoIpResponse().
float GeoIp::latitude | ( | ) | const [inline] |
Returns the latitude portion of the geographic coordinates associated with this IP address or range of IP addresses.
Definition at line 45 of file GeoIp.h.
References _latitude.
Referenced by TorMapWidget::addRouter(), TorMapImageView::addRouter(), and GeoIpCacheItem::GeoIpCacheItem().
float GeoIp::longitude | ( | ) | const [inline] |
Returns the longitude portion of the geographic coordinates associated with this IP address or range of IP addresses.
Definition at line 50 of file GeoIp.h.
References _longitude.
Referenced by TorMapWidget::addRouter(), TorMapImageView::addRouter(), and GeoIpCacheItem::GeoIpCacheItem().
QString GeoIp::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 60 of file GeoIp.h.
References _region.
Referenced by GeoIpCacheItem::GeoIpCacheItem().
QString GeoIp::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 55 of file GeoIp.cpp.
References _city, _country, _countryCode, and _region.
Referenced by TorMapWidget::addRouter(), and RouterListItem::setLocation().
QString GeoIp::_city [private] |
City in which this IP lives.
Definition at line 89 of file GeoIp.h.
Referenced by city(), GeoIp(), and toString().
QString GeoIp::_country [private] |
Country in which this IP lives.
Definition at line 91 of file GeoIp.h.
Referenced by country(), GeoIp(), and toString().
QString GeoIp::_countryCode [private] |
ISO-3166-1 alpha-2 country code.
Definition at line 92 of file GeoIp.h.
Referenced by countryCode(), GeoIp(), and toString().
QHostAddress GeoIp::_ip [private] |
float GeoIp::_latitude [private] |
Latitudinal coordinate for this IP's location.
Definition at line 87 of file GeoIp.h.
Referenced by GeoIp(), isValid(), and latitude().
float GeoIp::_longitude [private] |
Longitudinal coordinate for this IP's location.
Definition at line 88 of file GeoIp.h.
Referenced by GeoIp(), isValid(), and longitude().
QString GeoIp::_region [private] |
State or district in which this IP lives.
Definition at line 90 of file GeoIp.h.
Referenced by GeoIp(), region(), and toString().