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

Environment.h

Go to the documentation of this file.
00001 #ifndef DEBTAGS_ENVIRONMENT_H
00002 #define DEBTAGS_ENVIRONMENT_H
00003 
00004 #pragma interface
00005 
00006 #include <tagcoll/Exception.h>
00007 #include <tagcoll/ParserBase.h>
00008 #include <debtags/Consumer.h>
00009 
00010 class pkgAcquireStatus;
00011 
00012 namespace Tagcoll
00013 {
00014 class Tag;
00015 class TagSet;
00016 };
00017 
00018 namespace Debtags
00019 {
00020 using namespace Tagcoll;
00021 
00022 class PackageDB;
00023 class Package;
00024 class PackageMatcher;
00025 class TagDB;
00026 class PackageImpl;
00027 class PackageSet;
00028 class Maintainer;
00029 class MaintainerSet;
00030 class Vocabulary;
00031 
00040 class Environment
00041 {
00042 protected:
00043     static Environment* instance;
00044 
00045     virtual void fillPackageData(Debtags::Package& name) const throw () = 0;
00046 
00047 public:
00048     // editable: if true, allow modifications to metadata (where implemented)
00049     // facet_only: if true, remove all tags without facets; if false, add a
00050     //   facet-name tag for each faceted tag
00051     static void init(bool editable = false, bool facet_only = true) throw (SystemException, ConsistencyCheckException);
00052     static Environment& get() throw () { return *instance; }
00053 
00054     // Returns the path to the current tag vocabulary
00055     virtual const std::string& path_vocabulary() const throw () = 0;
00056 
00057     // Check if the tag database has been created (i.e. if debtags update has been run)
00058     virtual bool hasTagDatabase() throw () = 0;
00059 
00060     // Return a PackageSet with all packages
00061     virtual const PackageSet& packages() const throw () = 0;
00062 
00063     // Return a MaintainerSet with all maintainers
00064     virtual const MaintainerSet& maintainers() const throw () = 0;
00065 
00066     // Return the APT Package Database access class
00067     virtual const PackageDB& packageDB() const throw () = 0;
00068 
00069     // Return the Debtags Database access class
00070     virtual const TagDB& tagDB() const throw () = 0;
00071     virtual TagDB& tagDB() throw () = 0;
00072 
00073     // Return the Debtags Vocabulary access class
00074     virtual Vocabulary& vocabulary() const throw () = 0;
00075 
00076 
00077     // Get the Package object given the package name
00078     virtual Package getPackage(const std::string& name) const throw () = 0;
00079 
00080     // Get the Maintainer object given the package name
00081     virtual Maintainer getMaintainer(const std::string& name) const throw () = 0;
00082 
00083 
00084     // Output the whole package list to `cons'
00085     virtual void output(PackageConsumer& cons) const throw () = 0;
00086 
00087     // Output the filtered package list to `cons'
00088     virtual void output(PackageConsumer& cons, PackageMatcher& filter) const throw () = 0;
00089 
00090 
00091     // Output list of packages related to `pivot' to `cons'
00092     virtual void outputRelated(PackageConsumer& cons, const Package& pivot, int distance = 1) const throw () = 0;
00093 
00094     // Output list of packages related to the specific tagset to `cons'
00095     virtual void outputRelated(PackageConsumer& cons, const TagSet& ts, int distance = 1) const throw () = 0;
00096 
00097 
00098     // Update the Debtags database
00099     virtual void updateDebtagsDatabase() throw (ConsistencyCheckException) = 0;
00100 
00101     // Update the Debtags database, tracking status updates
00102     virtual void updateDebtagsDatabase(pkgAcquireStatus*) throw (ConsistencyCheckException) = 0;
00103 
00104     friend class PackageImpl;
00105 };
00106 
00107 };
00108 
00109 // vim:set ts=4 sw=4:
00110 #endif

Generated on Sat Mar 19 19:46:42 2005 for libdebtags by  doxygen 1.4.1