00001 #ifndef PACKAGEDB_H
00002 #define PACKAGEDB_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <tagcoll/Exception.h>
00025 #include <apt-pkg/pkgrecords.h>
00026 #include <string>
00027
00028 class pkgTagSection;
00029
00030 namespace Debtags {
00031
00032 class PackageDBException : public ContextException
00033 {
00034 public:
00035 PackageDBException(const std::string& context) throw ()
00036 : ContextException(context) {}
00037 ~PackageDBException() throw () {}
00038
00039 virtual const char* type() const throw ()
00040 {
00041 return "PackageDBException";
00042 }
00043 };
00044
00045 class PackageDBImpl;
00046
00047 class PkgRecordConsumer
00048 {
00049 public:
00050 virtual void operator()(pkgRecords::Parser&) = 0;
00051 };
00052
00053 class PackageDB
00054 {
00055 protected:
00056 PackageDBImpl* impl;
00057
00058 public:
00059 PackageDB() throw (PackageDBException);
00060 PackageDB(const PackageDB& f) throw ();
00061 ~PackageDB() throw ();
00062 PackageDB& operator=(const PackageDB& f) throw ();
00063
00064 bool hasPackage(const std::string& pkg) const throw ();
00065
00066 std::string getPackageRecord(const std::string& pkg) const throw (PackageDBException);
00067 void getPackageRecord(const std::string& pkg, pkgTagSection& section) const
00068 throw (PackageDBException);
00069
00070 int getState(const std::string& pkg) const throw (PackageDBException);
00071
00072 void iterateAll(PkgRecordConsumer& consume) const throw (PackageDBException);
00073 };
00074
00075 };
00076
00077
00078 #endif