#include <geoip.h>
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 |
Definition at line 24 of file geoip.h.
GeoIp::GeoIp | ( | ) | [inline] |
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 | |||
) |
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 |
QString GeoIp::toString | ( | ) | const |
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().