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

TagToString.h

Go to the documentation of this file.
00001 #ifndef TAGCOLL_TAG_TO_STRING_H 00002 #define TAGCOLL_TAG_TO_STRING_H 00003 00004 /* 00005 * 2-way conversion between a collection tagged with strings to a collection 00006 * tagged with Tagcoll::Tag 00007 * 00008 * Copyright (C) 2003 Enrico Zini <enrico@debian.org> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 #pragma interface 00026 00027 #include <tagcoll/TagcollConsumer.h> 00028 #include <tagcoll/OpSet.h> 00029 #include <tagcoll/Tag.h> 00030 00031 namespace Tagcoll 00032 { 00033 00034 template<class T> 00035 class StringsToTags : public TagcollConsumer<T, std::string> 00036 { 00037 protected: 00038 FacetSet& vocab; 00039 TagcollConsumer<T, Tag>* consumer; 00040 00041 public: 00042 StringsToTags(FacetSet& vocab) throw () : vocab(vocab), consumer(0) {} 00043 StringsToTags(FacetSet& vocab, TagcollConsumer<T, Tag>* consumer) throw () 00044 : vocab(vocab), consumer(consumer) {} 00045 virtual ~StringsToTags() throw () {} 00046 00047 TagcollConsumer<T, Tag>* getConsumer() throw () { return consumer; } 00048 void setConsumer(TagcollConsumer<T, Tag>* consumer) throw () { this->consumer = consumer; } 00049 00050 // Consume data to be filtered 00051 virtual void consume(const T& item) throw (); 00052 virtual void consume(const T& item, const OpSet<std::string>& tags) throw (); 00053 virtual void consume(const OpSet<T>& items) throw (); 00054 virtual void consume(const OpSet<T>& items, const OpSet<std::string>& tags) throw (); 00055 }; 00056 00057 template<class T> 00058 class TagsToStrings : public TagcollConsumer<T, Tag> 00059 { 00060 protected: 00061 TagcollConsumer<T, std::string>* consumer; 00062 00063 public: 00064 TagsToStrings() throw () : consumer(0) {} 00065 TagsToStrings(TagcollConsumer<T, std::string>* consumer) throw () : consumer(consumer) {} 00066 virtual ~TagsToStrings() throw () {} 00067 00068 TagcollConsumer<T, std::string>* getConsumer() throw () { return consumer; } 00069 void setConsumer(TagcollConsumer<T, std::string>* consumer) throw () { this->consumer = consumer; } 00070 00071 // Consume data to be filtered 00072 virtual void consume(const T& item) throw (); 00073 virtual void consume(const T& item, const OpSet<Tag>& tags) throw (); 00074 virtual void consume(const OpSet<T>& items) throw (); 00075 virtual void consume(const OpSet<T>& items, const OpSet<Tag>& tags) throw (); 00076 }; 00077 00078 }; 00079 00080 // vim:set ts=4 sw=4: 00081 #endif

Generated on Sun Aug 15 14:14:31 2004 for libtagcoll by doxygen 1.3.8