Code

store: Removed sdb_store_matcher_tostring().
[sysdb.git] / src / include / core / store.h
index e3b3387151ef38b66ec7f32f745304abaff10391..2624194955c3ed9ebee454fec4e83dc017e0c8ec 100644 (file)
@@ -320,7 +320,8 @@ sdb_store_expr_fieldvalue(int field);
 /*
  * sdb_store_expr_attrvalue:
  * Creates an expression which evaluates to the value of the specified
- * attribute of a stored object.
+ * attribute of a stored object. Evaluates to a NULL value if the attribute
+ * does not exist.
  *
  * Returns:
  *  - an expression object on success
@@ -406,10 +407,25 @@ sdb_store_attr_matcher(const char *name, const char *value, _Bool re);
 
 /*
  * sdb_store_isnull_matcher:
- * Creates a matcher matching "missing" attributes.
+ * Creates a matcher matching NULL values.
  */
 sdb_store_matcher_t *
-sdb_store_isnull_matcher(const char *attr_name);
+sdb_store_isnull_matcher(sdb_store_expr_t *expr);
+
+/*
+ * sdb_store_isnnull_matcher:
+ * Creates a matcher matching non-NULL values.
+ */
+sdb_store_matcher_t *
+sdb_store_isnnull_matcher(sdb_store_expr_t *expr);
+
+/*
+ * sdb_store_child_matcher:
+ * Creates a matcher matching an object's children of the specified type. It
+ * matches if *any* of those children match 'm'.
+ */
+sdb_store_matcher_t *
+sdb_store_child_matcher(int type, sdb_store_matcher_t *m);
 
 /*
  * sdb_store_lt_matcher, sdb_store_le_matcher, sdb_store_eq_matcher,
@@ -437,10 +453,59 @@ sdb_store_cmp_le(sdb_store_expr_t *left, sdb_store_expr_t *right);
 sdb_store_matcher_t *
 sdb_store_cmp_eq(sdb_store_expr_t *left, sdb_store_expr_t *right);
 sdb_store_matcher_t *
+sdb_store_cmp_ne(sdb_store_expr_t *left, sdb_store_expr_t *right);
+sdb_store_matcher_t *
 sdb_store_cmp_ge(sdb_store_expr_t *left, sdb_store_expr_t *right);
 sdb_store_matcher_t *
 sdb_store_cmp_gt(sdb_store_expr_t *left, sdb_store_expr_t *right);
 
+/*
+ * sdb_store_in_matcher:
+ * Creates a matcher which matches if the right value evaluates to an array
+ * value and the left value is included in that array. See sdb_data_inarray
+ * for more details.
+ */
+sdb_store_matcher_t *
+sdb_store_in_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
+
+/*
+ * sdb_store_regex_matcher:
+ * Creates a matcher which matches the string value the left expression
+ * evaluates to against the regular expression the right expression evaluates
+ * to. The right expression may either be a constant value regular expression
+ * or string or a dynamic value evaluating to a string. In the latter case,
+ * the string is compiled to a regex every time the matcher is executed.
+ */
+sdb_store_matcher_t *
+sdb_store_regex_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
+
+/*
+ * sdb_store_nregex_matcher:
+ * Creates a regex matcher just like sdb_store_regex_matcher except that it
+ * matches in case the regular expression does not match.
+ */
+sdb_store_matcher_t *
+sdb_store_nregex_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right);
+
+/*
+ * sdb_store_matcher_op_cb:
+ * Callback constructing a matcher operator.
+ */
+typedef sdb_store_matcher_t *(*sdb_store_matcher_op_cb)
+       (sdb_store_expr_t *, sdb_store_expr_t *);
+
+/*
+ * sdb_store_parse_matcher_op:
+ * Parse a matcher operator and return a constructor for the respective
+ * matcher.
+ *
+ * Returns:
+ *  - matcher operator constructor on success
+ *  - NULL else
+ */
+sdb_store_matcher_op_cb
+sdb_store_parse_matcher_op(const char *op);
+
 /*
  * sdb_store_parse_object_type_plural:
  * Parse the type name (plural) of a stored object.
@@ -528,14 +593,6 @@ int
 sdb_store_matcher_matches(sdb_store_matcher_t *m, sdb_store_obj_t *obj,
                sdb_store_matcher_t *filter);
 
-/*
- * sdb_store_matcher_tostring:
- * Format a matcher object as string. This is meant for logging or debugging
- * purposes.
- */
-char *
-sdb_store_matcher_tostring(sdb_store_matcher_t *m, char *buf, size_t buflen);
-
 /*
  * sdb_store_lookup_cb:
  * Lookup callback. It is called for each matching object when looking up data