Defines | |
#define | _CITY_DATABASE_FILE "/usr/share/clock/wdb" |
#define | CLOCK_GETTEXT_LOCALE_DIR "/usr/share/locale" |
#define | CLOCK_GETTEXT_PACKAGE "osso-clock" |
#define | CLOCK_GETTEXT_CITY_DOMAIN "osso-cities" |
#define | CLOCK_GETTEXT_COUNTRY_DOMAIN "osso-countries" |
#define | _MAX_STRING_LENGTH 512 |
Max length of strings in Cityinfo structure (to use with g_strndup). | |
#define | MAX_ELEMENTS_NUMBER 20 |
Maximum number of elements for split functions. | |
#define | abs(value) ((0 <= value)?(value):(-1 * value)) |
#define | FIELD_DELIMITER '|' |
#define | ROW_MAX_LENGTH 1024 |
Enumerations | |
enum | { FIELD_ID = 0, FIELD_NAME, FIELD_CODE, FIELD_COUNTRY, FIELD_ZONE, FIELD_LAT, FIELD_LNG, FIELD_X, FIELD_Y, FIELD_LOCALE, FIELD_QTY } |
Functions | |
gchar * | cityinfo_get_name (const Cityinfo *city) |
Get city name from the Cityinfo structure. | |
gchar * | cityinfo_get_code (const Cityinfo *city) |
Get country code from the Cityinfo structure. | |
gchar * | cityinfo_get_country (const Cityinfo *city) |
Get country name from the Cityinfo structure. | |
gchar * | cityinfo_get_zone (const Cityinfo *city) |
Get timezone name from the Cityinfo structure. | |
gchar * | cityinfo_get_locale (const Cityinfo *city) |
Get locale used in particular city. | |
gdouble | cityinfo_get_xpos (const Cityinfo *city) |
Get x position of the city on the map. | |
gdouble | cityinfo_get_ypos (const Cityinfo *city) |
Get y position of the city on the map. | |
gdouble | cityinfo_get_lat (const Cityinfo *city) |
Get latitude of the city. | |
gdouble | cityinfo_get_lng (const Cityinfo *city) |
Get longitude of the city. | |
gint | cityinfo_get_id (const Cityinfo *city) |
Get the ID of particular city. | |
Cityinfo * | cityinfo_new (void) |
Create new structure. | |
void | cityinfo_free (Cityinfo *city) |
Free Cityinfo structure. | |
Cityinfo * | cityinfo_clone (const Cityinfo *city) |
Create duplication of particular Cityinfo structure. | |
void | cityinfo_foreach (CityinfoFunc func, gpointer data) |
Make a defined action on each city in the database. | |
Cityinfo * | cityinfo_find_closest (gdouble x, gdouble y) |
Search for the nearest city to given point on the map. | |
Cityinfo * | cityinfo_from_id (gint id) |
Find and return city with particular ID. | |
Cityinfo ** | cityinfo_get_all (void) |
Get an array with all cities available on the platform. | |
void | cityinfo_free_all (Cityinfo **cities) |
Free an array of pointers to Cityinfo structure. |
#define MAX_ELEMENTS_NUMBER 20 |
Maximum number of elements for split functions.
This valu is used when user pass -1 as a elements number - what means he do not know how many elements could be there.
gchar* cityinfo_get_name | ( | const Cityinfo * | city | ) |
Get city name from the Cityinfo structure.
city | Cityinfo structure from which we want to get information. |
gchar* cityinfo_get_code | ( | const Cityinfo * | city | ) |
Get country code from the Cityinfo structure.
city | Cityinfo structure from which we want to get information. |
gchar* cityinfo_get_country | ( | const Cityinfo * | city | ) |
Get country name from the Cityinfo structure.
city | Cityinfo structure from which we want to get information. |
gchar* cityinfo_get_zone | ( | const Cityinfo * | city | ) |
Get timezone name from the Cityinfo structure.
city | Cityinfo structure from which we want to get information. |
gchar* cityinfo_get_locale | ( | const Cityinfo * | city | ) |
Get locale used in particular city.
city | Cityinfo structure from which we want to get information. |
gdouble cityinfo_get_xpos | ( | const Cityinfo * | city | ) |
Get x position of the city on the map.
city | Cityinfo structure from which we want to get information. |
gdouble cityinfo_get_ypos | ( | const Cityinfo * | city | ) |
Get y position of the city on the map.
city | Cityinfo structure from which we want to get information. |
gdouble cityinfo_get_lat | ( | const Cityinfo * | city | ) |
Get latitude of the city.
city | Cityinfo structure from which we want to get information. |
gdouble cityinfo_get_lng | ( | const Cityinfo * | city | ) |
Get longitude of the city.
city | Cityinfo structure from which we want to get information. |
gint cityinfo_get_id | ( | const Cityinfo * | city | ) |
Get the ID of particular city.
city | Cityinfo structure from which we want to get information. |
Cityinfo* cityinfo_new | ( | void | ) |
Create new structure.
Allocate a new empty Cityinfo structure.
void cityinfo_free | ( | Cityinfo * | city | ) |
Free Cityinfo structure.
Free an allocated Cityinfo structure.
city | The Cityinfo structure to be freed. |
Create duplication of particular Cityinfo structure.
Duplicate a Cityinfo structure. The newly created structure can be handled indepenently from the old one.
city | The source Cityinfo. |
void cityinfo_foreach | ( | CityinfoFunc | func, | |
gpointer | data | |||
) |
Make a defined action on each city in the database.
Runs a function against every entry of the database. The iteration will end if func returns FALSE.
func | The function | |
data | Misc data to the function |
Cityinfo* cityinfo_find_closest | ( | gdouble | x, | |
gdouble | y | |||
) |
Search for the nearest city to given point on the map.
Finds the nearest city to given coordinates on the map.
x | Searched x coordinate (0.0 - 1.0) | |
y | Searched y coordinate (0.0 - 1.0) |
Cityinfo* cityinfo_from_id | ( | gint | id | ) |
Find and return city with particular ID.
Get the whole Cityinfo structure from its ID number.
id | ID of the city You want to get informations about. |
Cityinfo** cityinfo_get_all | ( | void | ) |
Get an array with all cities available on the platform.
Returns all cities available on the platform. Returned data could be used indepenently and should be freed with function cityinfo_free_all() when it is not needed any more.
void cityinfo_free_all | ( | Cityinfo ** | cities | ) |
Free an array of pointers to Cityinfo structure.
Free all cities array returned from cityinfo_get_all() function.
cities | An array of pointers to cities. |