Add:Core:First steps in making routing work for various profiles
[navit-package] / navit / vehicleprofile.c
1 /**
2  * Navit, a modular navigation system.
3  * Copyright (C) 2005-2008 Navit Team
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * version 2 as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19
20 #include <glib.h>
21 #include <string.h>
22 #include "debug.h"
23 #include "item.h"
24 #include "vehicleprofile.h"
25
26 struct vehicleprofile {
27         struct attr **attrs;
28 };
29
30 struct vehicleprofile *
31 vehicleprofile_new(struct attr *parent, struct attr **attrs)
32 {
33         struct vehicleprofile *this_;
34         struct attr *type_attr;
35         if (! (type_attr=attr_search(attrs, NULL, attr_name))) {
36                 return NULL;
37         }
38         this_=g_new0(struct vehicleprofile, 1);
39         this_->attrs=attr_list_dup(attrs);
40         return this_;
41 }
42
43 int
44 vehicleprofile_get_attr(struct vehicleprofile *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
45 {
46         return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
47 }
48
49 int
50 vehicleprofile_set_attr(struct vehicleprofile *this_, struct attr *attr)
51 {
52         this_->attrs=attr_generic_set_attr(this_->attrs, attr);
53         return 1;
54 }
55
56 int
57 vehicleprofile_add_attr(struct vehicleprofile *this_, struct attr *attr)
58 {
59         this_->attrs=attr_generic_add_attr(this_->attrs, attr);
60         return 1;
61 }
62
63 int
64 vehicleprofile_remove_attr(struct vehicleprofile *this_, struct attr *attr)
65 {
66         this_->attrs=attr_generic_remove_attr(this_->attrs, attr);
67         return 1;
68 }
69