src/cityinfo.h

Go to the documentation of this file.
00001 
00023 #ifndef __CITIES_DATABASE_H__
00024 #define __CITIES_DATABASE_H__
00025 
00026 #include <glib.h>
00027 
00028 G_BEGIN_DECLS
00029 
00037 #define CITYINFO_WRONG_ID -1
00038 
00045 #define CITYINFO_WRONG_POS -1.0
00046 
00053 #define CITYINFO_WRONG_LAT_LNG -181.0
00054 
00056 typedef struct _Cityinfo Cityinfo;
00062 struct _Cityinfo {
00063         /* The example is of Europe/Helsinki, whose row on the flatfile db is:
00064            "68|osso_db_city_helsinki|FI|osso_db_country_finland|Europe/Helsinki"
00065            "|0.23|0.48|fi_FI@euro" */
00066         gchar *name;    
00067         gchar *code;    
00068         gchar *country; 
00069         gchar *zone;    
00070         gchar *locale;  
00071         gdouble lat;    
00072         gdouble lng;    
00073         gdouble x;      
00074         gdouble y;      
00075         gint id;        
00076 };
00077 
00078 
00087 typedef gboolean (*CityinfoFunc) (const Cityinfo* city, gpointer data);
00088 
00089 /* ==== get internal data of Cityinfo structure ==== */
00090 
00092 gchar* cityinfo_get_name (const Cityinfo* city);
00093 
00095 gchar* cityinfo_get_code (const Cityinfo* city);
00096 
00098 gchar* cityinfo_get_country (const Cityinfo* city);
00099 
00101 gchar* cityinfo_get_zone (const Cityinfo* city);
00102 
00104 gchar* cityinfo_get_locale (const Cityinfo* city);
00105 
00107 gdouble cityinfo_get_xpos (const Cityinfo* city);
00108 
00110 gdouble cityinfo_get_ypos (const Cityinfo* city);
00111 
00113 gdouble cityinfo_get_lat (const Cityinfo* city);
00114 
00116 gdouble cityinfo_get_lng (const Cityinfo* city);
00117 
00119 gint cityinfo_get_id (const Cityinfo* city);
00120 
00121 /* ==== do some action on Cityinfo structure or database ==== */
00122 
00124 Cityinfo* cityinfo_new (void);
00125 
00127 void cityinfo_free (Cityinfo* city);
00128 
00130 Cityinfo* cityinfo_clone (const Cityinfo* city);
00131 
00133 void cityinfo_foreach (CityinfoFunc func, gpointer data);
00134 
00136 Cityinfo* cityinfo_find_closest (gdouble x, gdouble y);
00137 
00139 Cityinfo* cityinfo_from_id (gint id);
00140 
00142 Cityinfo** cityinfo_get_all (void);
00143 
00145 void cityinfo_free_all (Cityinfo** cities);
00146 
00147 G_END_DECLS
00148 
00149 #endif

Generated on Tue Feb 24 16:21:34 2009 for libcityinfo by  doxygen 1.5.1