diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-10 21:48:13 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-10 21:48:13 +0000 |
commit | 594989b31be5a6b4b8e333948c326311bdbfc709 (patch) | |
tree | 0792455e09b3d6235a604ee90d2fe7c53b7092f6 /navit/roadprofile.c | |
parent | 1b97cd37c1edcdb41fd1f0fce8e3a9c90b743a13 (diff) | |
download | navit-594989b31be5a6b4b8e333948c326311bdbfc709.tar.gz |
Add:Core:Further work on vehicleprofile_options
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5407 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/roadprofile.c')
-rw-r--r-- | navit/roadprofile.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/navit/roadprofile.c b/navit/roadprofile.c index 99037728e..0c70eb483 100644 --- a/navit/roadprofile.c +++ b/navit/roadprofile.c @@ -20,6 +20,7 @@ #include <glib.h> #include "debug.h" #include "item.h" +#include "xmlconfig.h" #include "roadprofile.h" static void @@ -46,8 +47,10 @@ roadprofile_new(struct attr *parent, struct attr **attrs) struct roadprofile *this_; struct attr **attr; this_=g_new0(struct roadprofile, 1); + this_->func=&roadprofile_func; + navit_object_ref((struct navit_object *)this_); + this_->attrs=attr_list_dup(attrs); - this_->maxspeed=0; for (attr=attrs;*attr; attr++) roadprofile_set_attr_do(this_, *attr); return this_; @@ -84,7 +87,7 @@ roadprofile_remove_attr(struct roadprofile *this_, struct attr *attr) struct attr_iter * roadprofile_attr_iter_new(void) { - return g_new0(void *,1); + return (struct attr_iter *)g_new0(void *,1); } void @@ -92,3 +95,37 @@ roadprofile_attr_iter_destroy(struct attr_iter *iter) { g_free(iter); } + +struct roadprofile * +roadprofile_dup(struct roadprofile *this_) +{ + struct roadprofile *ret=g_new(struct roadprofile, 1); + *ret=*this_; + ret->refcount=1; + ret->attrs=attr_list_dup(this_->attrs); + return ret; +} + +void +roadprofile_destroy(struct roadprofile *this_) +{ + attr_list_free(this_->attrs); + g_free(this_); +} + + +struct object_func roadprofile_func = { + attr_roadprofile, + (object_func_new)roadprofile_new, + (object_func_get_attr)roadprofile_get_attr, + (object_func_iter_new)roadprofile_attr_iter_new, + (object_func_iter_destroy)roadprofile_attr_iter_destroy, + (object_func_set_attr)roadprofile_set_attr, + (object_func_add_attr)roadprofile_add_attr, + (object_func_remove_attr)roadprofile_remove_attr, + (object_func_init)NULL, + (object_func_destroy)roadprofile_destroy, + (object_func_dup)roadprofile_dup, + (object_func_ref)navit_object_ref, + (object_func_unref)navit_object_unref, +}; |