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

/include/xapian/postingiterator.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  * Copyright 2003 Olly Betts
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License as
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program 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
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022  * USA
00023  * -----END-LICENCE-----
00024  */
00025 
00026 #ifndef XAPIAN_INCLUDED_POSTINGITERATOR_H
00027 #define XAPIAN_INCLUDED_POSTINGITERATOR_H
00028 
00029 #include <iterator>
00030 #include <string>
00031 
00032 #include <xapian/base.h>
00033 #include <xapian/types.h>
00034 
00035 namespace Xapian {
00036 
00037 class Database;
00038 class PositionIterator;
00039 
00040 class PostingIterator {
00041     public:
00042         class Internal;
00044         Xapian::Internal::RefCntPtr<Internal> internal;
00045 
00046     private:
00047         friend class Database; // So Database can construct us
00048 
00049         PostingIterator(Internal *internal_);
00050 
00051     public:
00052         friend bool operator==(const PostingIterator &a,
00053                                const PostingIterator &b);
00054 
00056         //PostingIterator();
00057 
00059         ~PostingIterator();
00060 
00064         PostingIterator(const PostingIterator &other);
00065 
00069         void operator=(const PostingIterator &other);
00070 
00071         PostingIterator & operator++();
00072 
00073         void operator++(int);
00074 
00075         // extra method, not required for an input_iterator
00076         void skip_to(Xapian::docid did);
00077 
00078 // Get the weight of the posting at the current position: will
00079 // need to set a weight object for this to work.
00080 // Xapian::weight get_weight() const;
00081 
00083         Xapian::docid operator *() const;
00084 
00094         Xapian::doclength get_doclength() const;
00095 
00099         Xapian::termcount get_wdf() const;
00100 
00101         // allow iteration of positionlist for current term
00102         PositionIterator positionlist_begin();
00103         PositionIterator positionlist_end();
00104 
00105         // Don't expose these methods here.  A container iterator doesn't
00106         // provide a method to find the size of the container...
00107         // Xapian::doccount get_termfreq() const;
00108         // Xapian::termcount get_collection_freq() const;
00109 
00113         std::string get_description() const;
00114 
00116 
00117         typedef std::input_iterator_tag iterator_category;
00118         typedef Xapian::docid value_type;
00119         typedef Xapian::doccount_diff difference_type;
00120         typedef Xapian::docid * pointer;
00121         typedef Xapian::docid & reference;
00123 };
00124 
00126 inline bool operator==(const PostingIterator &a, const PostingIterator &b)
00127 {
00128     return (a.internal.get() == b.internal.get());
00129 }
00130 
00132 inline bool operator!=(const PostingIterator &a, const PostingIterator &b)
00133 {
00134     return !(a == b);
00135 }
00136 
00137 }
00138 
00139 #endif /* XAPIAN_INCLUDED_POSTINGITERATOR_H */

Documentation for Xapian (version 0.7.2).
Generated on 8 Aug 2003 by Doxygen 1.2.15.