Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

PackageDB.h

Go to the documentation of this file.
00001 #ifndef PACKAGEDB_H
00002 #define PACKAGEDB_H
00003 
00004 /*
00005  * Wrapper around libapt-pkg
00006  *
00007  * Copyright (C) 2003  Enrico Zini <enrico@debian.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 // vim:set ts=4 sw=4:
00078 #endif

Generated on Sat Mar 19 11:35:23 2005 for libdebtags by  doxygen 1.4.1