Add:Core:Added c style command evaluation for more flexible osds
[navit-package] / navit / attr.h
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 Library 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 Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License 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 #ifndef NAVIT_ATTR_H
21 #define NAVIT_ATTR_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 #ifndef ATTR_H
27 #define ATTR_H
28
29 #include "projection.h"
30
31 enum item_type;
32
33 enum attr_type {
34 #define ATTR2(x,y) attr_##y=x,
35 #define ATTR(x) attr_##x,
36 #include "attr_def.h"
37 #undef ATTR2
38 #undef ATTR
39 };
40
41 #define AF_ONEWAY       (1<<0)
42 #define AF_ONEWAYREV    (1<<1)
43 #define AF_NOPASS       (AF_ONEWAY|AF_ONEWAYREV)
44 #define AF_ONEWAYMASK   (AF_ONEWAY|AF_ONEWAYREV)
45 #define AF_SEGMENTED    (1<<2)
46 #define AF_ROUNDABOUT (1<<3)
47
48 struct attr {
49         enum attr_type type;
50         union {
51                 char *str;
52                 void *data;
53                 int num;
54                 struct item *item;
55                 enum item_type item_type;
56                 enum projection projection;
57                 double * numd;
58                 struct color *color;
59                 struct coord_geo *coord_geo;
60                 struct navit *navit;
61                 struct callback *callback;
62                 struct callback_list *callback_list;
63                 struct vehicle *vehicle;
64                 struct layout *layout;
65                 struct layer *layer;
66                 struct map *map;
67                 struct mapset *mapset;
68                 struct log *log;
69                 struct route *route;
70                 struct navigation *navigation;
71                 struct coord *coord;
72                 struct pcoord *pcoord;
73                 struct gui *gui;
74                 struct graphics *graphics;
75                 struct tracking *tracking;
76                 struct itemgra *itemgra;
77                 struct plugin *plugin;
78                 struct plugins *plugins;
79                 struct polygon *polygon;
80                 struct polyline *polyline;
81                 struct circle *circle;
82                 struct text *text;
83                 struct icon *icon;
84                 struct image *image;
85                 struct arrows *arrows;
86                 struct element *element;
87                 struct speech *speech;
88                 struct cursor *cursor;
89                 struct range {
90                         short min, max;
91                 } range;
92                 int *dash;
93                 enum item_type *item_types;
94                 long long *num64;
95         } u;
96 };
97
98 /* prototypes */
99 enum attr_type;
100 struct attr;
101 struct attr_iter;
102 struct map;
103 enum attr_type attr_from_name(const char *name);
104 char *attr_to_name(enum attr_type attr);
105 struct attr *attr_new_from_text(const char *name, const char *value);
106 char *attr_to_text(struct attr *attr, struct map *map, int pretty);
107 struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
108 int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter);
109 struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr);
110 struct attr **attr_generic_add_attr(struct attr **attrs, struct attr *attr);
111 int attr_data_size(struct attr *attr);
112 void *attr_data_get(struct attr *attr);
113 void attr_data_set(struct attr *attr, void *data);
114 void attr_data_set_le(struct attr * attr, void * data);
115 void attr_free(struct attr *attr);
116 struct attr *attr_dup(struct attr *attr);
117 void attr_list_free(struct attr **attrs);
118 struct attr **attr_list_dup(struct attr **attrs);
119 /* end of prototypes */
120 #endif
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif