#ifdef __cplusplus
extern "C" {
#endif
-#ifndef ATTR_H
-#define ATTR_H
#include "projection.h"
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;
union {
} 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);
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);
+void attr_dup_content(struct attr *src, struct attr *dst);
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