00001 #ifndef DEBTAGS_TAGDB_H
00002 #define DEBTAGS_TAGDB_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 <tagcoll/ParserBase.h>
00026 #include <tagcoll/TDBReadonlyDiskIndex.h>
00027 #include <debtags/Tag.h>
00028 #include <debtags/Serializer.h>
00029
00030 namespace Debtags
00031 {
00032 using namespace Tagcoll;
00033
00034 class Package;
00035
00039 template<class ITEM>
00040 class Tags : public TDBReadonlyDiskIndex<ITEM, Tag>
00041 {
00042 protected:
00043 Vocabulary voc;
00044 Converter<ITEM, std::string>& fromitem;
00045 Converter<Tag, std::string> fromtag;
00046 Converter<std::string, ITEM>& toitem;
00047 Converter<std::string, Tag> totag;
00048
00049 public:
00060 Tags(
00061 Converter<ITEM, std::string>& fromitem,
00062 Converter<std::string, ITEM>& toitem,
00063 bool editable = false);
00064 ~Tags() {}
00065
00069 const Vocabulary& vocabulary() const { return voc; }
00070 Vocabulary& vocabulary() { return voc; }
00078 static bool hasTagDatabase();
00079
00080
00085 void savePatch();
00086
00091 void savePatch(const PatchList<ITEM, Tag>& patch);
00092
00097 void sendPatch();
00098
00102 void sendPatch(const PatchList<ITEM, Tag>& patch);
00103
00104
00108 void outputSystem(Tagcoll::Consumer<std::string, std::string>& cons);
00109
00113 void outputSystem(Tagcoll::Consumer<ITEM, Tag>& cons);
00114
00119 void outputPatched(Tagcoll::Consumer<std::string, std::string>& cons);
00120
00125 void outputPatched(Tagcoll::Consumer<ITEM, Tag>& cons);
00126 };
00127
00128 };
00129
00130
00131 #endif