Document our supported rpmdb indexes in the API via an enum of their own
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 22 Oct 2010 07:17:55 +0000 (10:17 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 22 Oct 2010 07:17:55 +0000 (10:17 +0300)
- Now that our indexes are actually hardwired in the code we can
  properly separate rpmtag vs db index names.
- Defined similarly to rpmTags, with rpmDbiTag being the "true enum"
  and rpmDbiTagVal the integral type they present. As many of the
  indexes are defined via RPMTAG values (and need to remain that
  way to avoid breaking every single API user) we need to have a
  compatible type with rpmTags.
- These would logically belong to rpmdb.h but keeping in rpmtag.h
  to have them available "everywhere", we can't go including rpmdb.h
  from rpmtag.h so keeping them here avoids potential unnecessary breakage.

lib/rpmtag.h
lib/rpmtypes.h

index ae9f7b9..5f7ee17 100644 (file)
@@ -8,12 +8,6 @@ extern "C" {
 #endif
 
 /**
- * Pseudo-tags used by the rpmdb and rpmgi iterator API's.
- */
-#define        RPMDBI_PACKAGES         0       /* Installed package headers. */
-#define        RPMDBI_LABEL            2       /* Fingerprint search marker. */
-
-/**
  * Header private tags.
  * @note General use tags should start at 1000 (RPM's tag space starts there).
  */
@@ -309,6 +303,26 @@ typedef enum rpmTag_e {
 
 #define        RPMTAG_EXTERNAL_TAG             1000000
 
+/** \ingroup rpmtag
+ * Rpm database index tags.
+ */
+typedef enum rpmDbiTag_e {
+    RPMDBI_PACKAGES            = 0,    /* Installed package headers. */
+    RPMDBI_LABEL               = 2,    /* NEVRA label pseudo index */
+    RPMDBI_NAME                        = RPMTAG_NAME,
+    RPMDBI_BASENAMES           = RPMTAG_BASENAMES,
+    RPMDBI_GROUP               = RPMTAG_GROUP,
+    RPMDBI_REQUIRENAME         = RPMTAG_REQUIRENAME,
+    RPMDBI_PROVIDENAME         = RPMTAG_PROVIDENAME,
+    RPMDBI_CONFLICTNAME                = RPMTAG_CONFLICTNAME,
+    RPMDBI_OBSOLETENAME                = RPMTAG_OBSOLETENAME,
+    RPMDBI_TRIGGERNAME         = RPMTAG_TRIGGERNAME,
+    RPMDBI_DIRNAMES            = RPMTAG_DIRNAMES,
+    RPMDBI_INSTALLTID          = RPMTAG_INSTALLTID,
+    RPMDBI_SIGMD5              = RPMTAG_SIGMD5,
+    RPMDBI_SHA1HEADER          = RPMTAG_SHA1HEADER,
+} rpmDbiTag;
+
 /** \ingroup signature
  * Tags found in signature header from package.
  */
index 936546a..c72bb54 100644 (file)
@@ -28,6 +28,7 @@ typedef int32_t               rpm_tag_t;
 typedef uint32_t       rpm_tagtype_t;
 typedef uint32_t       rpm_count_t;
 typedef rpm_tag_t      rpmTagVal;
+typedef rpm_tag_t      rpmDbiTagVal;
 
 typedef void *         rpm_data_t;
 typedef const void *   rpm_constdata_t;