Fix:Core:Made graphics more flexible
[navit-package] / navit / attr.h
index ff2919f..b6db5a7 100644 (file)
@@ -23,8 +23,6 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-#ifndef ATTR_H
-#define ATTR_H
 
 #include "projection.h"
 
@@ -38,12 +36,53 @@ enum attr_type {
 #undef ATTR
 };
 
-#define AF_ONEWAY      (1<<0)
-#define AF_ONEWAYREV   (1<<1)
-#define AF_NOPASS      (AF_ONEWAY|AF_ONEWAYREV)
-#define AF_ONEWAYMASK  (AF_ONEWAY|AF_ONEWAYREV)
-#define AF_SEGMENTED   (1<<2)
-#define AF_ROUNDABOUT (1<<3)
+#define AF_ONEWAY              (1<<0)
+#define AF_ONEWAYREV           (1<<1)
+#define AF_NOPASS              (AF_ONEWAY|AF_ONEWAYREV)
+#define AF_ONEWAYMASK          (AF_ONEWAY|AF_ONEWAYREV)
+#define AF_SEGMENTED           (1<<2)
+#define AF_ROUNDABOUT          (1<<3)
+#define AF_ROUNDABOUT_VALID    (1<<4)
+#define AF_ONEWAY_EXCEPTION    (1<<5)
+#define AF_SPEED_LIMIT         (1<<6)
+#define AF_TRUCK_SPEED_LIMIT   (1<<7)
+#define AF_SIZE_OR_WEIGHT_LIMIT        (1<<8)
+#define AF_THROUGH_TRAFFIC     (1<<9)
+#define AF_TOLL                        (1<<10)
+#define AF_SEASONAL            (1<<11)
+#define AF_UNPAVED             (1<<12)
+#define AF_DANGEROUS_GOODS     (1<<19)
+#define AF_EMERGENCY_VEHICLES  (1<<20)
+#define AF_TRANSPORT_TRUCK     (1<<21)
+#define AF_DELIVERY_TRUCK      (1<<22)
+#define AF_PUBLIC_BUS          (1<<23)
+#define AF_TAXI                        (1<<24) 
+#define AF_HIGH_OCCUPANCY_CAR  (1<<25) 
+#define AF_CAR                 (1<<26) 
+#define AF_MOTORCYCLE          (1<<27) 
+#define AF_MOPED               (1<<28) 
+#define AF_HORSE               (1<<29) 
+#define AF_BIKE                        (1<<30) 
+#define AF_PEDESTRIAN          (1<<31) 
+
+/* Values for attributes that could carry relative values */
+#define ATTR_REL_MAXABS                        0x40000000
+#define ATTR_REL_RELSHIFT              0x60000000
+
+enum attr_position_valid {
+       attr_position_valid_invalid,
+       attr_position_valid_static,
+       attr_position_valid_extrapolated_time,
+       attr_position_valid_extrapolated_spatial,
+       attr_position_valid_valid,
+};
+
+#define ATTR_IS_INT(x) ((x) >= attr_type_int_begin && (x) <= attr_type_int_end)
+#define ATTR_IS_DOUBLE(x) ((x) >= attr_type_double_begin && (x) <= attr_type_double_end)
+#define ATTR_IS_STRING(x) ((x) >= attr_type_string_begin && (x) <= attr_type_string_end)
+#define ATTR_IS_OBJECT(x) ((x) >= attr_type_object_begin && (x) <= attr_type_object_end)
+#define ATTR_IS_COORD_GEO(x) ((x) >= attr_type_coord_geo_begin && (x) <= attr_type_coord_geo_end)
+#define ATTR_IS_NUMERIC(x) (ATTR_IS_INT(x) || ATTR_IS_DOUBLE(x))
 
 struct attr {
        enum attr_type type;
@@ -86,20 +125,22 @@ struct attr {
                struct element *element;
                struct speech *speech;
                struct cursor *cursor;
+               struct displaylist *displaylist;
+               struct transformation *transformation;
+               struct vehicleprofile *vehicleprofile;
+               struct roadprofile *roadprofile;
                struct range {
                        short min, max;
                } range;
                int *dash;
                enum item_type *item_types;
+               enum attr_type *attr_types;
                long long *num64;
        } u;
 };
 
-/* prototypes */
-enum attr_type;
-struct attr;
 struct attr_iter;
-struct map;
+/* prototypes */
 enum attr_type attr_from_name(const char *name);
 char *attr_to_name(enum attr_type attr);
 struct attr *attr_new_from_text(const char *name, const char *value);
@@ -108,16 +149,20 @@ struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type
 int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter);
 struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr);
 struct attr **attr_generic_add_attr(struct attr **attrs, struct attr *attr);
+struct attr **attr_generic_remove_attr(struct attr **attrs, struct attr *attr);
+enum attr_type attr_type_begin(enum attr_type type);
 int attr_data_size(struct attr *attr);
 void *attr_data_get(struct attr *attr);
 void attr_data_set(struct attr *attr, void *data);
-void attr_data_set_le(struct attr * attr, void * data);
+void attr_data_set_le(struct attr *attr, void *data);
 void attr_free(struct attr *attr);
 struct attr *attr_dup(struct attr *attr);
 void attr_list_free(struct attr **attrs);
 struct attr **attr_list_dup(struct attr **attrs);
+int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret);
+int attr_types_contains(enum attr_type *types, enum attr_type type);
+int attr_types_contains_default(enum attr_type *types, enum attr_type type, int deflt);
 /* end of prototypes */
-#endif
 #ifdef __cplusplus
 }
 #endif