Navit SVN

/work/compile/navit/src/navit/xmlconfig.h

00001 
00020 #ifndef NAVIT_XMLCONFIG_H
00021 #define NAVIT_XMLCONFIG_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 typedef void *(*object_func_new)(struct attr *parent, struct attr **attrs);
00028 typedef int (*object_func_get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter);
00029 typedef struct attr_iter *(*object_func_iter_new)(void *);
00030 typedef void (*object_func_iter_destroy)(struct attr_iter *);
00031 typedef int (*object_func_set_attr)(void *, struct attr *attr);
00032 typedef int (*object_func_add_attr)(void *, struct attr *attr);
00033 typedef int (*object_func_remove_attr)(void *, struct attr *attr);
00034 typedef int (*object_func_init)(void *);
00035 typedef void (*object_func_destroy)(void *);
00036 typedef void *(*object_func_dup)(void *);
00037 typedef void *(*object_func_ref)(void *);
00038 typedef void *(*object_func_unref)(void *);
00039 
00040 
00041 struct object_func {
00042         enum attr_type type;
00043         void *(*create)(struct attr *parent, struct attr **attrs);
00044         int (*get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter);
00045         struct attr_iter *(*iter_new)(void *);
00046         void (*iter_destroy)(struct attr_iter *);
00047         int (*set_attr)(void *, struct attr *attr);
00048         int (*add_attr)(void *, struct attr *attr);
00049         int (*remove_attr)(void *, struct attr *attr);
00050         int (*init)(void *);
00051         void (*destroy)(void *);
00052         void *(*dup)(void *);
00053         void *(*ref)(void *);
00054         void *(*unref)(void *);
00055 };
00056 
00057 extern struct object_func map_func, mapset_func, navit_func, tracking_func, vehicle_func;
00058 
00059 #define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_trackingo || (x) == attr_vehicle)
00060 
00061 struct navit_object {
00062         struct object_func *func;
00063         int refcount;
00064 };
00065 
00066 
00067 typedef GError xmlerror;
00068 
00069 extern const int xml_attr_distance;
00070 
00071 /* prototypes */
00072 enum attr_type;
00073 struct object_func *object_func_lookup(enum attr_type type);
00074 void xml_parse_text(const char *document, void *data, void (*start)(void *, const char *, const char **, const char **, void *, void *), void (*end)(void *, const char *, void *, void *), void (*text)(void *, const char *, int, void *, void *));
00075 gboolean config_load(const char *filename, xmlerror **error);
00076 //static void xinclude(GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values, struct xmldocument *doc_old, xmlerror **error);
00077 
00078 /* end of prototypes */
00079 
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083 
00084 #endif