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

include/om/ompostlistiterator.h

Go to the documentation of this file.
00001 
00004 /* ----START-LICENCE----
00005  * Copyright 1999,2000,2001 BrightStation PLC
00006  * Copyright 2002 Ananova Ltd
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021  * USA
00022  * -----END-LICENCE-----
00023  */
00024 
00025 #ifndef OM_HGUARD_OMPOSTLISTITERATOR_H
00026 #define OM_HGUARD_OMPOSTLISTITERATOR_H
00027 
00028 #include <iterator>
00029 #include "om/omtypes.h"
00030 
00031 class OmDatabase;
00032 class OmPositionListIterator;
00033 
00034 class OmPostListIterator {
00035     public:
00036         class Internal;
00038         Internal *internal;
00039 
00040     private:
00041         friend class OmDatabase; // So OmDatabase can construct us
00042 
00043         OmPostListIterator(Internal *internal_);
00044 
00045     public:
00046         friend bool operator==(const OmPostListIterator &a,
00047                                const OmPostListIterator &b);
00048 
00050         OmPostListIterator();
00051 
00053         ~OmPostListIterator();
00054 
00058         OmPostListIterator(const OmPostListIterator &other);
00059 
00063         void operator=(const OmPostListIterator &other);
00064 
00065         OmPostListIterator & operator++();
00066 
00067         void operator++(int);
00068 
00069         // extra method, not required for an input_iterator
00070         void skip_to(om_docid did);
00071 
00072 // Get the weight of the posting at the current position: will
00073 // need to set a weight object for this to work.
00074 // om_weight get_weight() const;
00075 
00077         om_docid operator *() const;
00078 
00088         om_doclength get_doclength() const;
00089 
00093         om_termcount get_wdf() const;
00094 
00095         // allow iteration of positionlist for current term
00096         OmPositionListIterator positionlist_begin();
00097         OmPositionListIterator positionlist_end();
00098 
00099         // Don't expose these methods here.  A container iterator doesn't
00100         // provide a method to find the size of the container...
00101         // om_doccount get_termfreq() const;
00102         // om_termcount get_collection_freq() const;
00103 
00107         std::string get_description() const;
00108 
00110 
00111         typedef std::input_iterator_tag iterator_category;
00112         typedef om_docid value_type;
00113         typedef om_doccount_diff difference_type;
00114         typedef om_docid * pointer;
00115         typedef om_docid & reference;
00117 };
00118 
00119 inline bool operator!=(const OmPostListIterator &a,
00120                        const OmPostListIterator &b)
00121 {
00122     return !(a == b);
00123 }
00124 
00125 #endif /* OM_HGUARD_OMPOSTLISTITERATOR_H */

Documentation for Xapian (version 0.6.1).
Generated on 7 Dec 2002 by Doxygen 1.2.15.