navit 0.5.3-trunk
Loading...
Searching...
No Matches
xmlconfig.h
Go to the documentation of this file.
1
20#ifndef NAVIT_XMLCONFIG_H
21#define NAVIT_XMLCONFIG_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include "attr.h" // for attr
28#include "attr_type_def.h" // for attr_type
29#include "config.h" // for HAVE_GLIB
30#include "navit.h" // for attr_iter, NAVIT_OBJECT
31#include <glib.h> // for GError, GMarkupParseContext, gboolean
32struct attr_iter;
33
34#ifndef USE_EZXML
35# ifdef HAVE_GLIB
36# define USE_EZXML 0
37# else
38# define USE_EZXML 1
39# endif
40#endif
41
42#if !USE_EZXML
43# define XML_ATTR_DISTANCE 1
44typedef GMarkupParseContext xml_context;
45#else
46# include "ezxml.h"
47# define XML_ATTR_DISTANCE 2
48# undef G_MARKUP_ERROR
49# undef G_MARKUP_ERROR_INVALID_CONTENT
50# undef G_MARKUP_ERROR_PARSE
51# undef G_MARKUP_ERROR_UNKNOWN_ELEMENT
52# define G_MARKUP_ERROR 0
53# define G_MARKUP_ERROR_INVALID_CONTENT 0
54# define G_MARKUP_ERROR_PARSE 0
55# define G_MARKUP_ERROR_UNKNOWN_ELEMENT 0
56typedef void *xml_context;
57#endif
58
59typedef void *(*object_func_new)(struct attr *parent, struct attr **attrs);
60typedef int (*object_func_get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter);
61typedef struct attr_iter *(*object_func_iter_new)(void *);
62typedef void (*object_func_iter_destroy)(struct attr_iter *);
63typedef int (*object_func_set_attr)(void *, struct attr *attr);
64typedef int (*object_func_add_attr)(void *, struct attr *attr);
65typedef int (*object_func_remove_attr)(void *, struct attr *attr);
66typedef int (*object_func_init)(void *);
67typedef void (*object_func_destroy)(void *);
68typedef void *(*object_func_dup)(void *);
69typedef void *(*object_func_ref)(void *);
70typedef void *(*object_func_unref)(void *);
71
86 void *(*create)(struct attr *parent, struct attr **attrs);
87 int (*get_attr)(void *, enum attr_type type, struct attr *attr,
88 struct attr_iter *iter);
91 struct attr_iter *(*iter_new)(void *);
94 void (*iter_destroy)(struct attr_iter *);
97 int (*set_attr)(void *, struct attr *attr);
100 int (*add_attr)(void *, struct attr *attr);
103 int (*remove_attr)(void *, struct attr *attr);
106 int (*init)(void *);
108 void (*destroy)(void *);
111 void *(*dup)(void *);
112 void *(*ref)(void *);
115 void *(*unref)(void *);
118};
119
123
124#define HAS_OBJECT_FUNC(x) \
125 ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo \
126 || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile \
127 || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option \
128 || (x) == attr_script || (x) == attr_log || (x) == attr_speech || (x) == attr_navigation || (x) == attr_route \
129 || (x) == attr_traffic)
130
133};
134
135int navit_object_set_methods(void *in, int in_size, void *out, int out_size);
136struct navit_object *navit_object_new(struct attr **attrs, struct object_func *func, int size);
137struct navit_object *navit_object_ref(struct navit_object *obj);
138void *navit_object_unref(struct navit_object *obj);
139struct attr_iter *navit_object_attr_iter_new(void *unused);
141int navit_object_get_attr(struct navit_object *obj, enum attr_type type, struct attr *attr, struct attr_iter *iter);
142void navit_object_callbacks(struct navit_object *obj, struct attr *attr);
143int navit_object_set_attr(struct navit_object *obj, struct attr *attr);
144int navit_object_add_attr(struct navit_object *obj, struct attr *attr);
145int navit_object_remove_attr(struct navit_object *obj, struct attr *attr);
146void navit_object_destroy(struct navit_object *obj);
147
148typedef GError xmlerror;
149
150/* prototypes */
151enum attr_type;
153int xml_parse_file(char *filename, void *data,
154 void (*start)(xml_context *, const char *, const char **, const char **, void *, GError **),
155 void (*end)(xml_context *, const char *, void *, GError **),
156 void (*text)(xml_context *, const char *, gsize, void *, GError **));
157int xml_parse_text(const char *document, void *data,
158 void (*start)(xml_context *, const char *, const char **, const char **, void *, GError **),
159 void (*end)(xml_context *, const char *, void *, GError **),
160 void (*text)(xml_context *, const char *, gsize, void *, GError **));
161gboolean config_load(const char *filename, xmlerror **error);
162// static void xinclude(GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values,
163// struct xmldocument *doc_old, xmlerror **error);
164
165/* end of prototypes */
166
167#ifdef __cplusplus
168}
169#endif
170
171#endif
attr_type
Definition attr_type_def.h:11
error
Definition command.c:93
struct object_func config_func
Definition config_.c:149
char data
Definition garmin_img.c:2
char filename[8]
Definition garmin_img.c:1
char type[3]
Definition garmin_img.c:2
int size
Definition garmin_img.c:3
struct object_func navit_func
Definition navit.c:210
struct object_func layer_func
Definition layout.c:715
struct object_func layout_func
Definition layout.c:698
struct object_func log_func
Definition log.c:541
struct object_func map_func
Definition map.c:674
struct object_func maps_func
Definition maps.c:87
struct object_func mapset_func
Definition mapset.c:381
struct object_func navigation_func
Definition navigation.c:4328
#define NAVIT_OBJECT
Definition navit.h:23
struct object_func osd_func
Definition osd.c:465
struct navit struct traffic_methods struct attr ** attrs
Definition plugin_def.h:36
struct object_func profile_option_func
Definition profile_option.c:43
struct object_func roadprofile_func
Definition roadprofile.c:93
struct object_func route_func
Definition route.c:4334
struct object_func script_func
Definition script.c:90
struct object_func speech_func
Definition speech.c:139
Definition config_.c:47
void * iter
Definition config_.c:48
Definition attr.h:138
Definition xmlconfig.h:131
Basic functions for Navit objects.
Definition xmlconfig.h:84
void(* iter_destroy)(struct attr_iter *)
Definition xmlconfig.h:94
int(* add_attr)(void *, struct attr *attr)
Definition xmlconfig.h:100
int(* get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition xmlconfig.h:87
int(* remove_attr)(void *, struct attr *attr)
Definition xmlconfig.h:103
void(* destroy)(void *)
Definition xmlconfig.h:108
enum attr_type type
Definition xmlconfig.h:85
int(* set_attr)(void *, struct attr *attr)
Definition xmlconfig.h:97
int(* init)(void *)
Definition xmlconfig.h:106
Definition gpx2navit_txt.h:50
struct object_func tracking_func
Definition track.c:43
struct object_func vehicle_func
Definition vehicle.c:82
struct object_func vehicleprofile_func
Definition vehicleprofile.c:275
int navit_object_set_attr(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1370
struct object_func * object_func_lookup(enum attr_type type)
Definition xmlconfig.c:248
int navit_object_remove_attr(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1399
void(* object_func_iter_destroy)(struct attr_iter *)
Definition xmlconfig.h:62
int(* object_func_remove_attr)(void *, struct attr *attr)
Definition xmlconfig.h:65
gboolean config_load(const char *filename, xmlerror **error)
Definition xmlconfig.c:1259
int navit_object_get_attr(struct navit_object *obj, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Generic get function.
Definition xmlconfig.c:1361
struct navit_object * navit_object_new(struct attr **attrs, struct object_func *func, int size)
Definition xmlconfig.c:1298
void navit_object_callbacks(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1365
int(* object_func_init)(void *)
Definition xmlconfig.h:66
int navit_object_set_methods(void *in, int in_size, void *out, int out_size)
Definition xmlconfig.c:1283
void navit_object_attr_iter_destroy(struct attr_iter *iter)
Definition xmlconfig.c:1332
struct attr_iter * navit_object_attr_iter_new(void *unused)
Definition xmlconfig.c:1328
void * xml_context
Definition xmlconfig.h:56
void * navit_object_unref(struct navit_object *obj)
Definition xmlconfig.c:1313
int xml_parse_text(const char *document, void *data, void(*start)(xml_context *, const char *, const char **, const char **, void *, GError **), void(*end)(xml_context *, const char *, void *, GError **), void(*text)(xml_context *, const char *, gsize, void *, GError **))
Parses XML text.
Definition xmlconfig.c:1111
int navit_object_add_attr(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1377
int(* object_func_add_attr)(void *, struct attr *attr)
Definition xmlconfig.h:64
struct object_func map_func mapset_func navit_func osd_func tracking_func vehicle_func maps_func layout_func roadprofile_func vehicleprofile_func layer_func config_func profile_option_func script_func log_func speech_func navigation_func route_func traffic_func
Definition traffic.c:5958
void(* object_func_destroy)(void *)
Definition xmlconfig.h:67
struct navit_object * navit_object_ref(struct navit_object *obj)
Definition xmlconfig.c:1307
int(* object_func_set_attr)(void *, struct attr *attr)
Definition xmlconfig.h:63
GError xmlerror
Definition xmlconfig.h:148
int(* object_func_get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition xmlconfig.h:60
void navit_object_destroy(struct navit_object *obj)
Definition xmlconfig.c:1413
int xml_parse_file(char *filename, void *data, void(*start)(xml_context *, const char *, const char **, const char **, void *, GError **), void(*end)(xml_context *, const char *, void *, GError **), void(*text)(xml_context *, const char *, gsize, void *, GError **))
Parses an XML file.
Definition xmlconfig.c:1063