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 XAPIAN_INCLUDED_TERMITERATOR_H
00027 #define XAPIAN_INCLUDED_TERMITERATOR_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
00043 class TermNameWrapper {
00044 private:
00045 std::string tname;
00046 public:
00047 TermNameWrapper(const std::string & tname_) : tname(tname_) { }
00048 std::string operator*() const { return tname; }
00049 };
00050
00053 class TermIterator {
00054 private:
00055
00056 friend class Database;
00057 friend class Document;
00058
00059 public:
00060 class Internal;
00062 Xapian::Internal::RefCntPtr<Internal> internal;
00063
00064 friend bool operator==(const TermIterator &a, const TermIterator &b);
00065
00066 public:
00067
00068 explicit TermIterator(Internal *internal_);
00069
00071 TermIterator();
00072
00074 ~TermIterator();
00075
00079 TermIterator(const TermIterator &other);
00080
00084 void operator=(const TermIterator &other);
00085
00086 std::string operator *() const;
00087
00088 TermIterator & operator++();
00089
00090 TermNameWrapper operator++(int) {
00091 std::string tmp = **this;
00092 operator++();
00093 return TermNameWrapper(tmp);
00094 }
00095
00096
00097 void skip_to(const std::string & tname);
00098
00099 Xapian::termcount get_wdf() const;
00100 Xapian::doccount get_termfreq() const;
00101
00102
00103 PositionIterator positionlist_begin();
00104 PositionIterator positionlist_end();
00105
00109 std::string get_description() const;
00110
00112
00113 typedef std::input_iterator_tag iterator_category;
00114 typedef std::string value_type;
00115 typedef Xapian::termcount_diff difference_type;
00116 typedef std::string * pointer;
00117 typedef std::string & reference;
00119 };
00120
00121 inline bool
00122 operator==(const TermIterator &a, const TermIterator &b)
00123 {
00124 return (a.internal.get() == b.internal.get());
00125 }
00126
00127 inline bool
00128 operator!=(const TermIterator &a, const TermIterator &b)
00129 {
00130 return !(a == b);
00131 }
00132
00133 }
00134
00135 #endif