Imported Upstream version 0.6.36
[platform/upstream/libsolv.git] / src / dataiterator.h
index 0c1c849..3133686 100644 (file)
@@ -7,7 +7,7 @@
 
 /*
  * dataiterator.h
- * 
+ *
  */
 
 #ifndef LIBSOLV_DATAITERATOR_H
 #include "pooltypes.h"
 #include "pool.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct _Repo;
 
 typedef struct _KeyValue {
   Id id;
   const char *str;
-  int num;
-  int num2;
+  unsigned int num;
+  unsigned int num2;
 
   int entry;   /* array entry, starts with 0 */
   int eof;     /* last entry reached */
@@ -30,6 +34,8 @@ typedef struct _KeyValue {
   struct _KeyValue *parent;
 } KeyValue;
 
+#define SOLV_KV_NUM64(kv) (((unsigned long long)((kv)->num2)) << 32 | (kv)->num)
+
 /* search matcher flags */
 #define SEARCH_STRINGMASK              15
 #define SEARCH_STRING                  1
@@ -59,13 +65,37 @@ typedef struct _KeyValue {
 /* dataiterator internal */
 #define SEARCH_THISSOLVID              (1<<31)
 
+/*
+ * Datamatcher: match a string against a query
+ */
 typedef struct _Datamatcher {
-  int flags;
-  const char *match;
-  void *matchdata;
+  int flags;           /* see matcher flags above */
+  const char *match;   /* the query string */
+  void *matchdata;     /* e.g. compiled regexp */
   int error;
 } Datamatcher;
 
+int  datamatcher_init(Datamatcher *ma, const char *match, int flags);
+void datamatcher_free(Datamatcher *ma);
+int  datamatcher_match(Datamatcher *ma, const char *str);
+int  datamatcher_checkbasename(Datamatcher *ma, const char *str);
+
+
+/*
+ * Dataiterator
+ *
+ * Iterator like interface to 'search' functionality
+ *
+ * Dataiterator is per-pool, additional filters can be applied
+ * to limit the search domain. See dataiterator_init below.
+ *
+ * Use these like:
+ *    Dataiterator di;
+ *    dataiterator_init(&di, repo->pool, repo, 0, 0, "bla", SEARCH_SUBSTRING);
+ *    while (dataiterator_step(&di))
+ *      dosomething(di.solvid, di.key, di.kv);
+ *    dataiterator_free(&di);
+ */
 typedef struct _Dataiterator
 {
   int state;
@@ -106,31 +136,22 @@ typedef struct _Dataiterator
   } parents[3];
   int nparents;
 
-} Dataiterator;
+  /* vertical data */
+  unsigned char *vert_ddp;
+  Id vert_off;
+  Id vert_len;
+  Id vert_storestate;
 
-int  datamatcher_init(Datamatcher *ma, const char *match, int flags);
-void datamatcher_free(Datamatcher *ma);
-int  datamatcher_match(Datamatcher *ma, const char *str);
+  /* strdup data */
+  char *dupstr;
+  int dupstrn;
+
+} Dataiterator;
 
-/*
- * Dataiterator
- * 
- * Iterator like interface to 'search' functionality
- * 
- * Dataiterator is per-pool, additional filters can be applied
- * to limit the search domain. See dataiterator_init below.
- * 
- * Use these like:
- *    Dataiterator di;
- *    dataiterator_init(&di, repo->pool, repo, 0, 0, "bla", SEARCH_SUBSTRING);
- *    while (dataiterator_step(&di))
- *      dosomething(di.solvid, di.key, di.kv);
- *    dataiterator_free(&di);
- */
 
 /*
  * Initialize dataiterator
- * 
+ *
  * di:      Pointer to Dataiterator to be initialized
  * pool:    Search domain for the iterator
  * repo:    if non-null, limit search to this repo
@@ -158,10 +179,15 @@ void dataiterator_jump_to_repo(Dataiterator *di, struct _Repo *repo);
 void dataiterator_entersub(Dataiterator *di);
 void dataiterator_clonepos(Dataiterator *di, Dataiterator *from);
 void dataiterator_seek(Dataiterator *di, int whence);
+void dataiterator_strdup(Dataiterator *di);
 
 #define DI_SEEK_STAY    (1 << 16)
 #define DI_SEEK_CHILD   1
 #define DI_SEEK_PARENT  2
 #define DI_SEEK_REWIND  3
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBSOLV_DATAITERATOR_H */