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
00049
00050
00051 static void init(bool editable = false, bool facet_only = true) throw (SystemException, ConsistencyCheckException);
00052 static Environment& get() throw () { return *instance; }
00053
00054
00055 virtual const std::string& path_vocabulary() const throw () = 0;
00056
00057
00058 virtual bool hasTagDatabase() throw () = 0;
00059
00060
00061 virtual const PackageSet& packages() const throw () = 0;
00062
00063
00064 virtual const MaintainerSet& maintainers() const throw () = 0;
00065
00066
00067 virtual const PackageDB& packageDB() const throw () = 0;
00068
00069
00070 virtual const TagDB& tagDB() const throw () = 0;
00071 virtual TagDB& tagDB() throw () = 0;
00072
00073
00074 virtual Vocabulary& vocabulary() const throw () = 0;
00075
00076
00077
00078 virtual Package getPackage(const std::string& name) const throw () = 0;
00079
00080
00081 virtual Maintainer getMaintainer(const std::string& name) const throw () = 0;
00082
00083
00084
00085 virtual void output(PackageConsumer& cons) const throw () = 0;
00086
00087
00088 virtual void output(PackageConsumer& cons, PackageMatcher& filter) const throw () = 0;
00089
00090
00091
00092 virtual void outputRelated(PackageConsumer& cons, const Package& pivot, int distance = 1) const throw () = 0;
00093
00094
00095 virtual void outputRelated(PackageConsumer& cons, const TagSet& ts, int distance = 1) const throw () = 0;
00096
00097
00098
00099 virtual void updateDebtagsDatabase() throw (ConsistencyCheckException) = 0;
00100
00101
00102 virtual void updateDebtagsDatabase(pkgAcquireStatus*) throw (ConsistencyCheckException) = 0;
00103
00104 friend class PackageImpl;
00105 };
00106
00107 };
00108
00109
00110 #endif