Modularized vehicle
[navit-package] / src / attr.h
1 #ifndef NAVIT_ATTR_H
2 #define NAVIT_ATTR_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 #ifndef ATTR_H
8 #define ATTR_H
9
10 enum item_type;
11
12 enum attr_type {
13 #define ATTR2(x,y) attr_##y=x,
14 #define ATTR(x) attr_##x,
15 #include "attr_def.h"
16 #undef ATTR2
17 #undef ATTR
18 };
19
20 #define AF_ONEWAY       (1<<0)
21 #define AF_ONEWAYREV    (1<<1)
22 #define AF_NOPASS       (AF_ONEWAY|AF_ONEWAYREV)
23 #define AF_ONEWAYMASK   (AF_ONEWAY|AF_ONEWAYREV)
24 #define AF_SEGMENTED    (1<<2)
25
26
27 struct attr {
28         enum attr_type type;
29         union {
30                 char *str;
31                 int num;
32                 struct item *item;
33                 enum item_type item_type;
34                 double * numd;
35                 struct color *color;
36                 struct coord_geo *coord_geo;
37                 struct navit *navit;
38                 struct callback *callback;
39                 struct log *log;
40         } u;
41 };
42
43 /* prototypes */
44 enum attr_type;
45 struct attr;
46 enum attr_type attr_from_name(const char *name);
47 char *attr_to_name(enum attr_type attr);
48 struct attr *attr_new_from_text(const char *name, const char *value);
49 struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
50 int attr_data_size(struct attr *attr);
51 void *attr_data_get(struct attr *attr);
52 void attr_data_set(struct attr *attr, void *data);
53 void attr_free(struct attr *attr);
54 /* end of prototypes */
55 #endif
56 #ifdef __cplusplus
57 }
58 #endif
59
60 #endif