Code

core: Add the store writer plugin type.
[sysdb.git] / src / core / store-private.h
index d2ea3f9a08c9f443584a4d021df97e02d1638111..97e8a6c2fcce7fff076b2f0275ead0a2ae42306a 100644 (file)
@@ -108,6 +108,7 @@ typedef struct {
  */
 
 enum {
+       TYPED_EXPR  = -3, /* obj type stored in data.data.integer */
        ATTR_VALUE  = -2, /* attr name stored in data.data.string */
        FIELD_VALUE = -1, /* field type stored in data.data.integer */
        /*  0: const value (stored in data) */
@@ -125,6 +126,13 @@ struct sdb_store_expr {
 
        sdb_data_t data;
 };
+#define EXPR_TO_STRING(e) \
+       (((e)->type == TYPED_EXPR) ? "<typed>" \
+               : ((e)->type == ATTR_VALUE) ? "attribute" \
+               : ((e)->type == FIELD_VALUE) ? SDB_FIELD_TO_NAME((e)->data.data.integer) \
+               : ((e)->type == 0) ? "<constant>" \
+               : ((e)->type > 0) ? SDB_DATA_OP_TO_STRING((e)->type) \
+               : "<unknown>")
 
 /*
  * matchers