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

Tags.h

Go to the documentation of this file.
00001 #ifndef DEBTAGS_TAGDB_H
00002 #define DEBTAGS_TAGDB_H
00003 
00004 /*
00005  * System tag database
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 <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 // vim:set ts=4 sw=4:
00131 #endif

Generated on Sat Sep 10 03:47:41 2005 for libdebtags by  doxygen 1.4.4