diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-05-26 09:11:14 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-05-26 09:11:14 +0000 |
commit | d682d5332453abba45258ec600350c694e81c362 (patch) | |
tree | 763356612efe21dc622e878dceba00ab290742d9 /navit | |
parent | 36f26d925884091ee4866295dfd64eaf6f86e93b (diff) | |
download | navit-d682d5332453abba45258ec600350c694e81c362.tar.gz |
Add:Core:Converted navigation to new scheme
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5509 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/navigation.c | 27 | ||||
-rw-r--r-- | navit/xmlconfig.c | 3 | ||||
-rw-r--r-- | navit/xmlconfig.h | 4 |
3 files changed, 27 insertions, 7 deletions
diff --git a/navit/navigation.c b/navit/navigation.c index fcec55d2a..e7b5774de 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -61,6 +61,7 @@ struct suffix { }; struct navigation { + NAVIT_OBJECT struct route *route; struct map *map; struct item_hash *hash; @@ -165,7 +166,7 @@ navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr * return 0; break; default: - return 0; + return navit_object_get_attr((struct navit_object *)this_, type, attr, iter); } attr->type=type; return 1; @@ -177,10 +178,11 @@ navigation_set_attr(struct navigation *this_, struct attr *attr) switch (attr->type) { case attr_speech: this_->speech=attr->u.speech; - return 1; + break; default: - return 0; + break; } + return navit_object_set_attr((struct navit_object *)this_, attr); } @@ -189,7 +191,7 @@ navigation_new(struct attr *parent, struct attr **attrs) { int i,j; struct attr * attr; - struct navigation *ret=g_new0(struct navigation, 1); + struct navigation *ret=(struct navigation *)navit_object_new(attrs, &navigation_func, sizeof(struct navigation)); ret->hash=item_hash_new(); ret->callback=callback_list_new(); ret->callback_speech=callback_list_new(); @@ -2390,3 +2392,20 @@ navigation_init(void) { plugin_register_map_type("navigation", navigation_map_new); } + +struct object_func navigation_func = { + attr_navigation, + (object_func_new)navigation_new, + (object_func_get_attr)navit_object_get_attr, + (object_func_iter_new)navit_object_attr_iter_new, + (object_func_iter_destroy)navit_object_attr_iter_destroy, + (object_func_set_attr)navit_object_set_attr, + (object_func_add_attr)navit_object_add_attr, + (object_func_remove_attr)navit_object_remove_attr, + (object_func_init)NULL, + (object_func_destroy)navigation_destroy, + (object_func_dup)NULL, + (object_func_ref)navit_object_ref, + (object_func_unref)navit_object_unref, +}; + diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c index a4fd2e5bf..e4c2b91ae 100644 --- a/navit/xmlconfig.c +++ b/navit/xmlconfig.c @@ -267,7 +267,6 @@ static struct object_func object_funcs[] = { { attr_icon, NEW(icon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, { attr_image, NEW(image_new)}, { attr_itemgra, NEW(itemgra_new), NULL, NULL, NULL, NULL, ADD(itemgra_add_attr)}, - { attr_navigation, NEW(navigation_new), GET(navigation_get_attr)}, { attr_plugins, NEW(plugins_new), NULL, NULL, NULL, NULL, NULL, NULL, INIT(plugins_init)}, { attr_plugin, NEW(plugin_new)}, { attr_polygon, NEW(polygon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, @@ -295,6 +294,8 @@ object_func_lookup(enum attr_type type) return &maps_func; case attr_mapset: return &mapset_func; + case attr_navigation: + return &navigation_func; case attr_navit: return &navit_func; case attr_profile_option: diff --git a/navit/xmlconfig.h b/navit/xmlconfig.h index 3f2ff3436..e2e43813d 100644 --- a/navit/xmlconfig.h +++ b/navit/xmlconfig.h @@ -54,9 +54,9 @@ struct object_func { void *(*unref)(void *); }; -extern 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; +extern 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; -#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) +#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) #define NAVIT_OBJECT struct object_func *func; int refcount; struct attr **attrs; struct navit_object { |