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

TagcollConsumer.h

Go to the documentation of this file.
00001 #ifndef TAGCOLL_TAGCOLLCONSUMER_H 00002 #define TAGCOLL_TAGCOLLCONSUMER_H 00003 00004 /* 00005 * Consumer interface for a stream of tagged items 00006 * 00007 * Copyright (C) 2003 Enrico Zini <enrico@debian.org> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library 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 GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 #pragma interface 00025 00026 #include <tagcoll/OpSet.h> 00027 00028 #include <string> 00029 00030 namespace Tagcoll 00031 { 00032 00033 // Interface for classes interested in being fed the results of the tagged 00034 // collection file parser 00035 template<class ITEM = std::string, class TAG = std::string> 00036 class TagcollConsumer 00037 { 00038 public: 00039 // Process an untagged item 00040 virtual void consume(const ITEM& item) throw () = 0; 00041 00042 // Process a tagged item, with its tags 00043 virtual void consume(const ITEM& item, const OpSet<TAG>& tags) throw () = 0; 00044 00045 // Process a set of items, all with no tags 00046 virtual void consume(const OpSet<ITEM>& items) throw () 00047 { 00048 // Default implementation for consumer that have no special handling of 00049 // item groups 00050 for (typename OpSet<ITEM>::const_iterator i = items.begin(); 00051 i != items.end(); i++) 00052 consume(*i); 00053 } 00054 00055 // Process a set of items identically tagged, with their tags 00056 virtual void consume(const OpSet<ITEM>& items, const OpSet<TAG>& tags) throw () 00057 { 00058 // Default implementation for consumer that have no special handling of 00059 // item groups 00060 for (typename OpSet<ITEM>::const_iterator i = items.begin(); 00061 i != items.end(); i++) 00062 consume(*i, tags); 00063 } 00064 }; 00065 00066 }; 00067 00068 // vim:set ts=4 sw=4: 00069 #endif

Generated on Tue Aug 17 00:26:31 2004 for libtagcoll by doxygen 1.3.8