Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

include/om/omtermlistiterator.h

00001 /* omtermlistiterator.h
00002  *
00003  * ----START-LICENCE----
00004  * Copyright 1999,2000,2001 BrightStation PLC
00005  * Copyright 2002 Ananova Ltd
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as
00009  * published by the Free Software Foundation; either version 2 of the
00010  * License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00020  * USA
00021  * -----END-LICENCE-----
00022  */
00023 
00024 #ifndef OM_HGUARD_OMTERMLISTITERATOR_H
00025 #define OM_HGUARD_OMTERMLISTITERATOR_H
00026 
00027 #include <iterator>
00028 #include "om/omtypes.h"
00029 
00030 class OmDatabase;
00031 class OmPositionListIterator;
00032 
00035 class OmTermIterator {
00036     private:
00037         // friend classes which need to be able to construct us
00038         friend class OmDatabase;
00039         friend class OmDocument;
00040 
00041     public:
00042         class Internal;
00044         Internal *internal;
00045 
00046         friend bool operator==(const OmTermIterator &a,
00047                                const OmTermIterator &b);
00048 
00049     public:
00050         // FIXME: better if this was private...
00051         OmTermIterator(Internal *internal_);
00052 
00054         OmTermIterator();
00055 
00057         ~OmTermIterator();
00058 
00062         OmTermIterator(const OmTermIterator &other);
00063 
00067         void operator=(const OmTermIterator &other);
00068 
00069         om_termname operator *() const;
00070 
00071         OmTermIterator & operator++();
00072 
00073         void operator++(int);
00074 
00075         // extra method, not required for an input_iterator
00076         void skip_to(const om_termname & tname);
00077 
00078         om_termcount get_wdf() const;
00079         om_doccount get_termfreq() const;
00080 
00081         // allow iteration of positionlist for current document
00082         OmPositionListIterator positionlist_begin();
00083         OmPositionListIterator positionlist_end();
00084     
00088         std::string get_description() const;
00089 
00091 
00092         typedef std::input_iterator_tag iterator_category;
00093         typedef om_termname value_type;
00094         typedef om_termcount_diff difference_type;
00095         typedef om_termname * pointer;
00096         typedef om_termname & reference;
00098 };
00099 
00100 inline bool
00101 operator!=(const OmTermIterator &a, const OmTermIterator &b)
00102 {
00103     return !(a == b);
00104 }
00105 
00106 #endif /* OM_HGUARD_OMTERMLISTITERATOR_H */

Documentation for Xapian (version 0.6.0).
Generated on 26 Nov 2002 by Doxygen 1.2.15.