/[zanavi_public1]/navit/navit/attr.h
ZANavi

Contents of /navit/navit/attr.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 40 - (show annotations) (download)
Wed Mar 4 14:00:54 2015 UTC (9 years ago) by zoff99
File MIME type: text/plain
File size: 8609 byte(s)
new market version, lots of fixes
1 /**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
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 /**
21 * Navit, a modular navigation system.
22 * Copyright (C) 2005-2008 Navit Team
23 *
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU Library General Public License
26 * version 2 as published by the Free Software Foundation.
27 *
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU Library General Public License for more details.
32 *
33 * You should have received a copy of the GNU Library General Public
34 * License along with this program; if not, write to the
35 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
36 * Boston, MA 02110-1301, USA.
37 */
38
39 #ifndef NAVIT_ATTR_H
40 #define NAVIT_ATTR_H
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 #include "projection.h"
47
48 enum item_type;
49
50 enum attr_type {
51 #define ATTR2(x,y) attr_##y=x,
52 #define ATTR(x) attr_##x,
53 #include "attr_def.h"
54 #undef ATTR2
55 #undef ATTR
56 };
57
58 #define NAVIT_AF_ONEWAY (1<<0)
59 #define NAVIT_AF_ONEWAYREV (1<<1)
60 #define NAVIT_AF_NOPASS (NAVIT_AF_ONEWAY|NAVIT_AF_ONEWAYREV)
61 #define NAVIT_AF_ONEWAYMASK (NAVIT_AF_ONEWAY|NAVIT_AF_ONEWAYREV)
62 #define NAVIT_AF_SEGMENTED (1<<2)
63 #define NAVIT_AF_ROUNDABOUT (1<<3)
64 #define NAVIT_AF_ROUNDABOUT_VALID (1<<4)
65 #define NAVIT_AF_ONEWAY_EXCEPTION (1<<5)
66 #define NAVIT_AF_SPEED_LIMIT (1<<6)
67 // -----------------------------------------------------
68 #define NAVIT_AF_RESERVED1 (1<<7) // ----> still unsued, free !!
69 // -----------------------------------------------------
70 #define NAVIT_AF_SIZE_OR_WEIGHT_LIMIT (1<<8)
71 #define NAVIT_AF_THROUGH_TRAFFIC_LIMIT (1<<9)
72 #define NAVIT_AF_TOLL (1<<10)
73 #define NAVIT_AF_SEASONAL (1<<11)
74 #define NAVIT_AF_UNPAVED (1<<12)
75 // -----------------------------------------------------
76 // #define NAVIT_AF_FORD (1<<13) // ----> still unsued, free !!
77 #define NAVIT_AF_BICYCLE_TRACK (1<<13) // NEW !!
78 // -----------------------------------------------------
79 #define NAVIT_AF_UNDERGROUND (1<<14)
80 #define NAVIT_AF_BRIDGE (1<<15) // NEW !!
81 #define NAVIT_AF_ONEWAY_BICYCLE_NO (1<<16) // NEW !!
82 #define NAVIT_AF_ONEWAY_BICYCLE_YES (1<<17) // NEW !!
83 #define NAVIT_AF_BICYCLE_LANE (1<<18) // NEW !!
84 #define NAVIT_AF_DANGEROUS_GOODS (1<<19)
85 #define NAVIT_AF_EMERGENCY_VEHICLES (1<<20)
86 #define NAVIT_AF_TRANSPORT_TRUCK (1<<21)
87 #define NAVIT_AF_DELIVERY_TRUCK (1<<22)
88 #define NAVIT_AF_PUBLIC_BUS (1<<23)
89 #define NAVIT_AF_TAXI (1<<24)
90 #define NAVIT_AF_HIGH_OCCUPANCY_CAR (1<<25)
91 #define NAVIT_AF_CAR (1<<26) // 0x04 000 000
92 #define NAVIT_AF_MOTORCYCLE (1<<27) // 0x08 000 000
93 #define NAVIT_AF_MOPED (1<<28) // 0x10 000 000
94 #define NAVIT_AF_HORSE (1<<29) // 0x20 000 000
95 #define NAVIT_AF_BIKE (1<<30) // 0x40 000 000
96 #define NAVIT_AF_PEDESTRIAN (1<<31) // 0x80 000 000
97
98 #define NAVIT_AF_PBH (NAVIT_AF_PEDESTRIAN|NAVIT_AF_BIKE|NAVIT_AF_HORSE)
99 #define NAVIT_AF_MOTORIZED_FAST (NAVIT_AF_MOTORCYCLE|NAVIT_AF_CAR|NAVIT_AF_HIGH_OCCUPANCY_CAR|NAVIT_AF_TAXI|NAVIT_AF_PUBLIC_BUS|NAVIT_AF_DELIVERY_TRUCK|NAVIT_AF_TRANSPORT_TRUCK|NAVIT_AF_EMERGENCY_VEHICLES)
100 #define NAVIT_AF_ALL (NAVIT_AF_PBH|NAVIT_AF_MOPED|NAVIT_AF_MOTORIZED_FAST)
101
102
103 #define NAVIT_AF_DG_ANY (1<<0)
104 #define NAVIT_AF_DG_WATER_HARMFUL (1<<1)
105 #define NAVIT_AF_DG_EXPLOSIVE (1<<2)
106 #define NAVIT_AF_DG_FLAMMABLE (1<<3)
107
108 /* Values for attributes that could carry relative values */
109 #define ATTR_REL_MAXABS 0x40000000 // 0x40 000 000 // (1<<30)
110 #define ATTR_REL_RELSHIFT 0x60000000 // 0x60 000 000 // (1<<30) + (1<<29)
111
112 enum attr_position_valid {
113 attr_position_valid_invalid,
114 attr_position_valid_static,
115 attr_position_valid_extrapolated_time,
116 attr_position_valid_extrapolated_spatial,
117 attr_position_valid_valid,
118 };
119
120 #define ATTR_IS_INT(x) ((x) >= attr_type_int_begin && (x) <= attr_type_int_end)
121 #define ATTR_IS_DOUBLE(x) ((x) >= attr_type_double_begin && (x) <= attr_type_double_end)
122 #define ATTR_IS_STRING(x) ((x) >= attr_type_string_begin && (x) <= attr_type_string_end)
123 #define ATTR_IS_OBJECT(x) ((x) >= attr_type_object_begin && (x) <= attr_type_object_end)
124 #define ATTR_IS_ITEM(x) ((x) >= attr_type_item_begin && (x) <= attr_type_item_end)
125 #define ATTR_IS_COORD_GEO(x) ((x) >= attr_type_coord_geo_begin && (x) <= attr_type_coord_geo_end)
126 #define ATTR_IS_NUMERIC(x) (ATTR_IS_INT(x) || ATTR_IS_DOUBLE(x))
127 #define ATTR_IS_COLOR(x) ((x) >= attr_type_color_begin && (x) <= attr_type_color_end)
128 #define ATTR_IS_PCOORD(x) ((x) >= attr_type_pcoord_begin && (x) <= attr_type_pcoord_end)
129 #define ATTR_IS_COORD(x) ((x) >= attr_type_coord_begin && (x) <= attr_type_coord_end)
130 #define ATTR_IS_GROUP(x) ((x) >= attr_type_group_begin && (x) <= attr_type_group_end)
131
132 #define ATTR_DEF_STR(x,y) (&(struct attr){attr_##x,{y}})
133 #define ATTR_DEF_INT(x,y) (&(struct attr){attr_##x,{(char *)(y)}})
134 #define ATTR_DEF_ITEMS(x,...) (&(struct attr){attr_##x,{(char *)((enum item_type[]){__VA_ARGS__ , type_none})}})
135 #define ATTR_LIST(...) (struct attr *[]) { __VA_ARGS__, NULL}
136
137 struct attr {
138 enum attr_type type;
139 union {
140 char *str;
141 void *data;
142 long num;
143 struct item *item;
144 enum item_type item_type;
145 enum projection projection;
146 double * numd;
147 struct color *color;
148 struct coord_geo *coord_geo;
149 struct navit *navit;
150 struct callback *callback;
151 struct callback_list *callback_list;
152 struct vehicle *vehicle;
153 struct layout *layout;
154 struct layer *layer;
155 struct map *map;
156 struct mapset *mapset;
157 struct log *log;
158 struct route *route;
159 struct navigation *navigation;
160 struct coord *coord;
161 struct pcoord *pcoord;
162 struct gui *gui;
163 struct graphics *graphics;
164 struct tracking *tracking;
165 struct itemgra *itemgra;
166 struct plugin *plugin;
167 struct plugins *plugins;
168 struct polygon *polygon;
169 struct polyline *polyline;
170 struct circle *circle;
171 struct text *text;
172 struct icon *icon;
173 struct image *image;
174 struct arrows *arrows;
175 struct element *element;
176 struct speech *speech;
177 struct cursor *cursor;
178 struct displaylist *displaylist;
179 struct transformation *transformation;
180 struct vehicleprofile *vehicleprofile;
181 struct roadprofile *roadprofile;
182 struct bookmarks *bookmarks;
183 struct range {
184 short min, max;
185 } range;
186 int *dash;
187 enum item_type *item_types;
188 enum attr_type *attr_types;
189 long long *num64;
190 struct attr *attrs;
191 } u;
192 };
193
194 struct attr_iter;
195 /* prototypes */
196 enum attr_type attr_from_name(const char *name);
197 char *attr_to_name(enum attr_type attr);
198 struct attr *attr_new_from_text(const char *name, const char *value);
199 char *attr_to_text(struct attr *attr, struct map *map, int pretty);
200 struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
201 int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter);
202 struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr);
203 struct attr **attr_generic_add_attr(struct attr **attrs, struct attr *attr);
204 struct attr **attr_generic_remove_attr(struct attr **attrs, struct attr *attr);
205 enum attr_type attr_type_begin(enum attr_type type);
206 int attr_data_size(struct attr *attr);
207 void *attr_data_get(struct attr *attr);
208 void attr_data_set(struct attr *attr, void *data);
209 void attr_data_set_le(struct attr *attr, void *data);
210 void attr_free(struct attr *attr);
211 void attr_dup_content(struct attr *src, struct attr *dst);
212 struct attr *attr_dup(struct attr *attr);
213 void attr_list_free(struct attr **attrs);
214 struct attr **attr_list_dup(struct attr **attrs);
215 int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret);
216 int attr_types_contains(enum attr_type *types, enum attr_type type);
217 int attr_types_contains_default(enum attr_type *types, enum attr_type type, int deflt);
218
219 char *flags_to_text(int flags);
220
221 /* end of prototypes */
222 #ifdef __cplusplus
223 }
224 #endif
225
226 #endif

   
Visit the ZANavi Wiki