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

include/om/ompostlistiterator.h

00001 /* ompostlistiterator.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_OMPOSTLISTITERATOR_H
00025 #define OM_HGUARD_OMPOSTLISTITERATOR_H
00026 
00027 #include <iterator>
00028 #include "om/omtypes.h"
00029 
00030 class OmDatabase;
00031 class OmPositionListIterator;
00032 
00033 class OmPostListIterator {
00034     public:
00035         class Internal;
00037         Internal *internal;
00038 
00039     private:
00040         friend class OmDatabase; // So OmDatabase can construct us
00041 
00042         OmPostListIterator(Internal *internal_);
00043 
00044     public:
00045         friend bool operator==(const OmPostListIterator &a,
00046                                const OmPostListIterator &b);
00047 
00049         OmPostListIterator();
00050 
00052         ~OmPostListIterator();
00053 
00057         OmPostListIterator(const OmPostListIterator &other);
00058 
00062         void operator=(const OmPostListIterator &other);
00063 
00064         OmPostListIterator & operator++();
00065 
00066         void operator++(int);
00067 
00068         // extra method, not required for an input_iterator
00069         void skip_to(om_docid did);
00070 
00071 // Get the weight of the posting at the current position: will
00072 // need to set a weight object for this to work.
00073 // om_weight get_weight() const;
00074 
00076         om_docid operator *() const;
00077 
00087         om_doclength get_doclength() const;
00088 
00092         om_termcount get_wdf() const;
00093 
00094         // allow iteration of positionlist for current term
00095         OmPositionListIterator positionlist_begin();
00096         OmPositionListIterator positionlist_end();
00097 
00098         // Don't expose these methods here.  A container iterator doesn't
00099         // provide a method to find the size of the container...
00100         // om_doccount get_termfreq() const;
00101         // om_termcount get_collection_freq() const;
00102 
00106         std::string get_description() const;
00107 
00109 
00110         typedef std::input_iterator_tag iterator_category;
00111         typedef om_docid value_type;
00112         typedef om_doccount_diff difference_type;
00113         typedef om_docid * pointer;
00114         typedef om_docid & reference;
00116 };
00117 
00118 inline bool operator!=(const OmPostListIterator &a,
00119                        const OmPostListIterator &b)
00120 {
00121     return !(a == b);
00122 }
00123 
00124 #endif /* OM_HGUARD_OMPOSTLISTITERATOR_H */

Documentation for Xapian (version 0.5.5).
Generated on 4 Dec 2002 by Doxygen 1.2.15.