Fix:Core:Renamed src to navit for cleanup of includes
[navit-package] / navit / item.h
1 #ifndef NAVIT_ITEM_H
2 #define NAVIT_ITEM_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 enum item_type {
9 #define ITEM2(x,y) type_##y=x,
10 #define ITEM(x) type_##x,
11 #include "item_def.h"
12 #undef ITEM2
13 #undef ITEM
14 };
15
16 #include "attr.h"
17
18 #define item_is_equal_id(a,b) ((a).id_hi == (b).id_hi && (a).id_lo == (b).id_lo)
19 #define item_is_equal(a,b) (item_is_equal_id(a,b) && (a).map == (b).map)
20
21 struct coord;
22
23 struct item_methods {
24         void (*item_coord_rewind)(void *priv_data);
25         int (*item_coord_get)(void *priv_data, struct coord *c, int count);
26         void (*item_attr_rewind)(void *priv_data);
27         int (*item_attr_get)(void *priv_data, enum attr_type attr_type, struct attr *attr);
28         int (*item_coord_is_segment)(void *priv_data);
29 };
30
31 struct item {
32         enum item_type type;
33         int id_hi;
34         int id_lo;
35         struct map *map;
36         struct item_methods *meth;      
37         void *priv_data;
38 };
39
40 /* prototypes */
41 enum attr_type;
42 enum item_type;
43 struct attr;
44 struct coord;
45 struct item;
46 struct item_hash;
47 void item_coord_rewind(struct item *it);
48 int item_coord_get(struct item *it, struct coord *c, int count);
49 /* does the next returned coordinate mark a segment */
50 int item_coord_is_segment(struct item *it);
51 void item_attr_rewind(struct item *it);
52 int item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr);
53 struct item *item_new(char *type, int zoom);
54 enum item_type item_from_name(const char *name);
55 char *item_to_name(enum item_type item);
56 struct item_hash *item_hash_new(void);
57 void item_hash_insert(struct item_hash *h, struct item *item, void *val);
58 int item_hash_remove(struct item_hash *h, struct item *item);
59 void *item_hash_lookup(struct item_hash *h, struct item *item);
60 void item_hash_destroy(struct item_hash *h);
61 /* end of prototypes */
62
63
64 #ifdef __cplusplus
65 }
66 /* __cplusplus */
67 #endif
68
69 /* NAVIT_ITEM_H */
70 #endif