Add methods for accessing rpmProblem data
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 19 Oct 2007 09:27:41 +0000 (12:27 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 19 Oct 2007 09:27:41 +0000 (12:27 +0300)
lib/rpmps.c
lib/rpmps.h

index 0908324..fce8b9d 100644 (file)
@@ -216,6 +216,36 @@ static inline int snprintf(char * buf, int nb, const char * fmt, ...)
 }
 #endif
 
+const char * rpmProblemGetPkgNEVR(const rpmProblem p)
+{
+    return (p->pkgNEVR);
+}
+
+const char * rpmProblemGetAltNEVR(const rpmProblem p)
+{
+    return (p->altNEVR);
+}
+
+fnpyKey rpmProblemGetKey(const rpmProblem p)
+{
+    return (p->key);
+}
+
+rpmProblemType rpmProblemGetType(const rpmProblem p)
+{
+    return (p->type);
+}
+
+const char * rpmProblemGetStr(const rpmProblem p)
+{
+    return (p->str1);
+}
+
+unsigned long rpmProblemGetLong(const rpmProblem p)
+{
+    return (p->ulong1);
+}
+
 const char * rpmProblemString(const rpmProblem prob)
 {
     const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "?pkgNEVR?");
index 35fc34e..350daa3 100644 (file)
@@ -70,6 +70,49 @@ struct rpmpsi_s {
 };
 
 /**
+ * Return package NEVR
+ * @param prob         rpm problem
+ * @return             package NEVR
+ */
+const char * rpmProblemGetPkgNEVR(const rpmProblem prob);
+/**
+ * Return related (e.g. through a dependency) package NEVR
+ * @param prob         rpm problem
+ * @return             related (e.g. through a dependency) package NEVR
+ */
+const char * rpmProblemGetAltNEVR(const rpmProblem prob);
+
+/**
+ * Return type of problem (dependency, diskpace etc)
+ * @param prob         rpm problem
+ * @return             type of problem
+ */
+
+rpmProblemType rpmProblemGetType(const rpmProblem prob);
+
+/**
+ * Return filename or python object address of a problem
+ * @param prob         rpm problem
+ * @return             filename or python object address
+ */
+fnpyKey rpmProblemGetKey(const rpmProblem prob);
+
+/**
+ * Return a generic data string from a problem
+ * @param prob         rpm problem
+ * @return             a generic data string
+ * @todo               needs a better name
+ */
+const char * rpmProblemGetStr(const rpmProblem prob);
+/**
+ * Return generic pointer/long attribute from a problem
+ * @param prob         rpm problem
+ * @return             a generic pointer/long attribute
+ * @todo               needs a better name
+ */
+unsigned long rpmProblemGetLong(const rpmProblem prob);
+
+/**
  * Return formatted string representation of a problem.
  * @param prob         rpm problem
  * @return             formatted string (malloc'd)