navit  0.5.3-trunk
xmlconfig.h File Reference
#include "config.h"
#include "ezxml.h"

Go to the source code of this file.

Data Structures

struct  object_func
 Basic functions for Navit objects. More...
 
struct  navit_object
 

Macros

#define USE_EZXML   1
 
#define XML_ATTR_DISTANCE   2
 
#define G_MARKUP_ERROR   0
 
#define G_MARKUP_ERROR_INVALID_CONTENT   0
 
#define G_MARKUP_ERROR_PARSE   0
 
#define G_MARKUP_ERROR_UNKNOWN_ELEMENT   0
 
#define HAS_OBJECT_FUNC(x)   ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log || (x) == attr_speech || (x) == attr_navigation || (x) == attr_route || (x) == attr_traffic)
 
#define NAVIT_OBJECT   struct object_func *func; int refcount; struct attr **attrs;
 

Typedefs

typedef void * xml_context
 
typedef void *(* object_func_new) (struct attr *parent, struct attr **attrs)
 
typedef int(* object_func_get_attr) (void *, enum attr_type type, struct attr *attr, struct attr_iter *iter)
 
typedef struct attr_iter *(* object_func_iter_new) (void *)
 
typedef void(* object_func_iter_destroy) (struct attr_iter *)
 
typedef int(* object_func_set_attr) (void *, struct attr *attr)
 
typedef int(* object_func_add_attr) (void *, struct attr *attr)
 
typedef int(* object_func_remove_attr) (void *, struct attr *attr)
 
typedef int(* object_func_init) (void *)
 
typedef void(* object_func_destroy) (void *)
 
typedef void *(* object_func_dup) (void *)
 
typedef void *(* object_func_ref) (void *)
 
typedef void *(* object_func_unref) (void *)
 
typedef GError xmlerror
 

Functions

int navit_object_set_methods (void *in, int in_size, void *out, int out_size)
 
struct navit_objectnavit_object_new (struct attr **attrs, struct object_func *func, int size)
 
struct navit_objectnavit_object_ref (struct navit_object *obj)
 
void * navit_object_unref (struct navit_object *obj)
 
struct attr_iternavit_object_attr_iter_new (void *unused)
 
void navit_object_attr_iter_destroy (struct attr_iter *iter)
 
int navit_object_get_attr (struct navit_object *obj, enum attr_type type, struct attr *attr, struct attr_iter *iter)
 Generic get function. More...
 
void navit_object_callbacks (struct navit_object *obj, struct attr *attr)
 
int navit_object_set_attr (struct navit_object *obj, struct attr *attr)
 
int navit_object_add_attr (struct navit_object *obj, struct attr *attr)
 
int navit_object_remove_attr (struct navit_object *obj, struct attr *attr)
 
void navit_object_destroy (struct navit_object *obj)
 
struct object_funcobject_func_lookup (enum attr_type type)
 
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. More...
 
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. More...
 
gboolean config_load (const char *filename, xmlerror **error)
 

Variables

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
 

Macro Definition Documentation

◆ G_MARKUP_ERROR

#define G_MARKUP_ERROR   0

◆ G_MARKUP_ERROR_INVALID_CONTENT

#define G_MARKUP_ERROR_INVALID_CONTENT   0

◆ G_MARKUP_ERROR_PARSE

#define G_MARKUP_ERROR_PARSE   0

◆ G_MARKUP_ERROR_UNKNOWN_ELEMENT

#define G_MARKUP_ERROR_UNKNOWN_ELEMENT   0

◆ HAS_OBJECT_FUNC

#define HAS_OBJECT_FUNC (   x)    ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log || (x) == attr_speech || (x) == attr_navigation || (x) == attr_route || (x) == attr_traffic)

◆ NAVIT_OBJECT

#define NAVIT_OBJECT   struct object_func *func; int refcount; struct attr **attrs;

◆ USE_EZXML

#define USE_EZXML   1

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

◆ XML_ATTR_DISTANCE

#define XML_ATTR_DISTANCE   2

Typedef Documentation

◆ object_func_add_attr

typedef int(* object_func_add_attr) (void *, struct attr *attr)

◆ object_func_destroy

typedef void(* object_func_destroy) (void *)

◆ object_func_dup

typedef void*(* object_func_dup) (void *)

◆ object_func_get_attr

typedef int(* object_func_get_attr) (void *, enum attr_type type, struct attr *attr, struct attr_iter *iter)

◆ object_func_init

typedef int(* object_func_init) (void *)

◆ object_func_iter_destroy

typedef void(* object_func_iter_destroy) (struct attr_iter *)

◆ object_func_iter_new

typedef struct attr_iter*(* object_func_iter_new) (void *)

◆ object_func_new

typedef void*(* object_func_new) (struct attr *parent, struct attr **attrs)

◆ object_func_ref

typedef void*(* object_func_ref) (void *)

◆ object_func_remove_attr

typedef int(* object_func_remove_attr) (void *, struct attr *attr)

◆ object_func_set_attr

typedef int(* object_func_set_attr) (void *, struct attr *attr)

◆ object_func_unref

typedef void*(* object_func_unref) (void *)

◆ xml_context

typedef void* xml_context

◆ xmlerror

typedef GError xmlerror

Function Documentation

◆ config_load()

gboolean config_load ( const char *  filename,
xmlerror **  error 
)
  • Load and parse the master config file
  • Parameters
    filenameFQFN of the file
  • Parameters
    errorptr to error details, if any
  • Returns
    boolean TRUE or FALSE (if error detected)

References attr_create_hash(), attr_destroy_hash(), dbg, xmlstate::document, xmlstate::element, filename, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, xmldocument::href, initStatic(), item_create_hash(), item_destroy_hash(), lvl_debug, parse_file(), and xmldocument::user_data.

Referenced by config_load_py(), and main_real().

◆ navit_object_add_attr()

◆ navit_object_attr_iter_destroy()

void navit_object_attr_iter_destroy ( struct attr_iter iter)

References attr_iter::iter.

Referenced by config_attr_iter_destroy().

◆ navit_object_attr_iter_new()

struct attr_iter* navit_object_attr_iter_new ( void *  unused)

Referenced by config_attr_iter_new().

◆ navit_object_callbacks()

void navit_object_callbacks ( struct navit_object obj,
struct attr attr 
)

◆ navit_object_destroy()

void navit_object_destroy ( struct navit_object obj)

References attr_list_free().

Referenced by speech_destroy(), and traffic_new().

◆ navit_object_get_attr()

int navit_object_get_attr ( struct navit_object obj,
enum attr_type  type,
struct attr attr,
struct attr_iter iter 
)

Generic get function.

This function searches an attribute list for an attribute of a given type and stores it in the

Definition: attr.h:157

parameter. Internally it calls attr_generic_get_attr(struct attr **, struct attr **, enum attr_type, struct attr *, struct attr_iter *) to retrieve the attribute; see its documentation for details.

Searching for attr_any or attr_any_xml is supported.

An iterator can be specified to get multiple attributes of the same type: The first call will return the first match; each subsequent call with the same iterator will return the next match. If no more matching attributes are found in either of them, false is returned.

Parameters
objThe object to return an attribute for. This can be any Navit object type, but the parameter should be cast to
struct navit_object *
Definition: xmlconfig.h:122
to avoid compiler warnings.
typeThe attribute type to search for. Searching for
attr_any
or
attr_any_xml
is possible.
attrPoints to a
struct attr
which will receive the attribute
iterAn iterator to receive multiple attributes of the same type with subsequent calls. If
NULL
, the first matching attribute will be retrieved.
Returns
True if a matching attribute was found, false if not.

References attr_generic_get_attr(), attr_iter::iter, and type.

Referenced by navigation_get_attr(), navit_get_attr(), and osd_get_attr().

◆ navit_object_new()

struct navit_object* navit_object_new ( struct attr **  attrs,
struct object_func func,
int  size 
)

◆ navit_object_ref()

◆ navit_object_remove_attr()

int navit_object_remove_attr ( struct navit_object obj,
struct attr attr 
)

◆ navit_object_set_attr()

◆ navit_object_set_methods()

int navit_object_set_methods ( void *  in,
int  in_size,
void *  out,
int  out_size 
)

References size.

Referenced by osd_set_methods().

◆ navit_object_unref()

void* navit_object_unref ( struct navit_object obj)

References attr_to_name(), dbg, and lvl_debug.

Referenced by layer_set_attr_do().

◆ object_func_lookup()

◆ xml_parse_file()

int xml_parse_file ( char *  filename,
void *  data,
void(*)(xml_context *, const char *, const char **, const char **, void *, GError **)  start,
void(*)(xml_context *, const char *, void *, GError **)  end,
void(*)(xml_context *, const char *, gsize, void *, GError **)  text 
)

Parses an XML file.

Parameters
filenameThe XML file to parse
dataPoints to a user-defined data structure which will be passed to each of the callbacks passed in the following arguments
startCallback which will be called when an open tag is encountered
endCallback which will be called when a close tag is encountered
textCallback which will be called when character data is encountered
Returns
True on success, false on failure.

References data, dbg, filename, lvl_debug, lvl_error, parse_node_text(), attr::text, and xml_parse_text().

Referenced by traffic_get_messages_from_xml_file().

◆ xml_parse_text()

int xml_parse_text ( const char *  document,
void *  data,
void(*)(xml_context *, const char *, const char **, const char **, void *, GError **)  start,
void(*)(xml_context *, const char *, void *, GError **)  end,
void(*)(xml_context *, const char *, gsize, void *, GError **)  text 
)

Parses XML text.

Parameters
documentThe XML data to parse
dataPoints to a user-defined data structure which will be passed to each of the callbacks passed in the following arguments
startCallback which will be called when an open tag is encountered
endCallback which will be called when a close tag is encountered
textCallback which will be called when character data is encountered
Returns
True on success, false on failure.

References context, data, dbg, lvl_error, parse_node_text(), attr::str, and attr::text.

Referenced by gui_internal_html_parse_text(), traffic_get_messages_from_xml_string(), and xml_parse_file().

Variable Documentation

◆ traffic_func