00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef XAPIAN_INCLUDED_VALUEITERATOR_H
00023 #define XAPIAN_INCLUDED_VALUEITERATOR_H
00024
00025 #include <iterator>
00026 #include <string>
00027
00028 #include <xapian/base.h>
00029 #include <xapian/derefwrapper.h>
00030 #include <xapian/types.h>
00031 #include <xapian/visibility.h>
00032
00033 namespace Xapian {
00034
00036 class ValueIteratorEnd_ { };
00037
00039 class XAPIAN_VISIBILITY_DEFAULT ValueIterator {
00040 public:
00042 class Internal;
00044 Xapian::Internal::RefCntPtr<Internal> internal;
00045
00047 explicit ValueIterator(Internal *internal_);
00048
00050 ValueIterator(const ValueIterator & o);
00051
00053 ValueIterator(const ValueIteratorEnd_ &);
00054
00056 ValueIterator & operator=(const ValueIterator & o);
00057
00059 ValueIterator & operator=(const ValueIteratorEnd_ &);
00060
00066 ValueIterator();
00067
00069 ~ValueIterator();
00070
00072 std::string operator*() const;
00073
00075 ValueIterator & operator++();
00076
00078 DerefStringWrapper_ operator++(int) {
00079 std::string value(**this);
00080 operator++();
00081 return DerefStringWrapper_(value);
00082 }
00083
00089 Xapian::docid get_docid() const;
00090
00097 Xapian::valueno get_valueno() const;
00098
00115 void skip_to(Xapian::docid docid_or_slot);
00116
00139 bool check(Xapian::docid docid);
00140
00142 std::string get_description() const;
00143
00154
00156 typedef std::input_iterator_tag iterator_category;
00158 typedef std::string value_type;
00160 typedef Xapian::doccount_diff difference_type;
00162 typedef std::string * pointer;
00164 typedef std::string & reference;
00165
00166 };
00167
00168 inline bool
00169 operator==(const ValueIterator &a, const ValueIterator &b)
00170 {
00171
00172
00173 return a.internal.get() == b.internal.get();
00174 }
00175
00176 inline bool
00177 operator==(const ValueIterator &a, const ValueIteratorEnd_ &)
00178 {
00179 return a.internal.get() == NULL;
00180 }
00181
00182 inline bool
00183 operator==(const ValueIteratorEnd_ &a, const ValueIterator &b)
00184 {
00185 return b == a;
00186 }
00187
00188 inline bool
00189 operator==(const ValueIteratorEnd_ &, const ValueIteratorEnd_ &)
00190 {
00191 return true;
00192 }
00193
00194 inline bool
00195 operator!=(const ValueIterator &a, const ValueIterator &b)
00196 {
00197 return !(a == b);
00198 }
00199
00200 inline bool
00201 operator!=(const ValueIterator &a, const ValueIteratorEnd_ &b)
00202 {
00203 return !(a == b);
00204 }
00205
00206 inline bool
00207 operator!=(const ValueIteratorEnd_ &a, const ValueIterator &b)
00208 {
00209 return !(a == b);
00210 }
00211
00212 inline bool
00213 operator!=(const ValueIteratorEnd_ &a, const ValueIteratorEnd_ &b)
00214 {
00215 return !(a == b);
00216 }
00217
00218 }
00219
00220 #endif // XAPIAN_INCLUDED_VALUEITERATOR_H