00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef OM_HGUARD_OMVALUEITERATOR_H
00027 #define OM_HGUARD_OMVALUEITERATOR_H
00028
00029 #include <iterator>
00030 #include <string>
00031 #include <xapian/types.h>
00032 #include <xapian/document.h>
00033 #include <xapian/visibility.h>
00034
00035 namespace Xapian {
00036
00039 class XAPIAN_VISIBILITY_DEFAULT ValueIterator {
00040 private:
00041 friend class Document;
00042 friend bool operator==(const ValueIterator &a, const ValueIterator &b);
00043 friend bool operator!=(const ValueIterator &a, const ValueIterator &b);
00044
00045 ValueIterator(Xapian::valueno index_, const Document & doc_)
00046 : index(index_), doc(doc_) { }
00047
00048 Xapian::valueno index;
00049 Document doc;
00050
00051 public:
00055 ValueIterator() : index(0), doc() { }
00056
00057 ~ValueIterator() { }
00058
00060 ValueIterator(const ValueIterator &other) {
00061 index = other.index;
00062 doc = other.doc;
00063 }
00064
00066 void operator=(const ValueIterator &other) {
00067 index = other.index;
00068 doc = other.doc;
00069 }
00070
00072 ValueIterator & operator++() {
00073 ++index;
00074 return *this;
00075 }
00076
00078 ValueIterator operator++(int) {
00079 ValueIterator tmp = *this;
00080 ++index;
00081 return tmp;
00082 }
00083
00085 const std::string & operator*() const;
00086
00088 const std::string * operator->() const;
00089
00091 Xapian::valueno get_valueno() const;
00092
00096 std::string get_description() const;
00097
00099
00100 typedef std::input_iterator_tag iterator_category;
00101 typedef std::string value_type;
00102 typedef Xapian::valueno_diff difference_type;
00103 typedef std::string * pointer;
00104 typedef std::string & reference;
00106 };
00107
00108 inline bool operator==(const ValueIterator &a, const ValueIterator &b)
00109 {
00110 return (a.index == b.index);
00111 }
00112
00113 inline bool operator!=(const ValueIterator &a, const ValueIterator &b)
00114 {
00115 return (a.index != b.index);
00116 }
00117
00118 }
00119
00120 #endif