00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef XAPIAN_INCLUDED_POSTINGITERATOR_H
00025 #define XAPIAN_INCLUDED_POSTINGITERATOR_H
00026
00027 #include <iterator>
00028 #include <string>
00029
00030 #include <xapian/base.h>
00031 #include <xapian/types.h>
00032 #include <xapian/positioniterator.h>
00033 #include <xapian/visibility.h>
00034
00035 namespace Xapian {
00036
00037 class Database;
00038
00042 class DocIDWrapper {
00043 private:
00044 docid did;
00045 public:
00046 explicit DocIDWrapper(docid did_) : did(did_) { }
00047 docid operator*() const { return did; }
00048 };
00049
00052 class XAPIAN_VISIBILITY_DEFAULT PostingIterator {
00053 public:
00054 class Internal;
00056 Xapian::Internal::RefCntPtr<Internal> internal;
00057
00058 private:
00059 friend class Database;
00060
00061 explicit PostingIterator(Internal *internal_);
00062
00063 public:
00064 friend bool operator==(const PostingIterator &a,
00065 const PostingIterator &b);
00066
00068 PostingIterator();
00069
00071 ~PostingIterator();
00072
00076 PostingIterator(const PostingIterator &other);
00077
00081 void operator=(const PostingIterator &other);
00082
00083 PostingIterator & operator++();
00084
00085 DocIDWrapper operator++(int) {
00086 Xapian::docid tmp = **this;
00087 operator++();
00088 return DocIDWrapper(tmp);
00089 }
00090
00094 void skip_to(Xapian::docid did);
00095
00097 Xapian::docid operator *() const;
00098
00108 Xapian::termcount get_doclength() const;
00109
00113 Xapian::termcount get_wdf() const;
00114
00118 PositionIterator positionlist_begin() const;
00119
00123 PositionIterator positionlist_end() const {
00124 return PositionIterator(NULL);
00125 }
00126
00127
00128
00129
00130
00131
00133 std::string get_description() const;
00134
00136
00137 typedef std::input_iterator_tag iterator_category;
00138 typedef Xapian::docid value_type;
00139 typedef Xapian::doccount_diff difference_type;
00140 typedef Xapian::docid * pointer;
00141 typedef Xapian::docid & reference;
00143 };
00144
00146 inline bool operator==(const PostingIterator &a, const PostingIterator &b)
00147 {
00148 return (a.internal.get() == b.internal.get());
00149 }
00150
00152 inline bool operator!=(const PostingIterator &a, const PostingIterator &b)
00153 {
00154 return !(a == b);
00155 }
00156
00157 }
00158
00159 #endif