From 494c56e94ae9bbdcec46b746dc6837de42c890b7 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 19 Oct 2007 12:27:41 +0300 Subject: [PATCH] Add methods for accessing rpmProblem data --- lib/rpmps.c | 30 ++++++++++++++++++++++++++++++ lib/rpmps.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/lib/rpmps.c b/lib/rpmps.c index 0908324..fce8b9d 100644 --- a/lib/rpmps.c +++ b/lib/rpmps.c @@ -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?"); diff --git a/lib/rpmps.h b/lib/rpmps.h index 35fc34e..350daa3 100644 --- a/lib/rpmps.h +++ b/lib/rpmps.h @@ -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) -- 2.7.4