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_TERMITERATOR_H
00025 #define XAPIAN_INCLUDED_TERMITERATOR_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 TermNameWrapper {
00043 private:
00044 std::string tname;
00045 public:
00046 explicit TermNameWrapper(const std::string & tname_) : tname(tname_) { }
00047 const std::string & operator*() const { return tname; }
00048 };
00049
00052 class XAPIAN_VISIBILITY_DEFAULT TermIterator {
00053 public:
00054 class Internal;
00056 Xapian::Internal::RefCntPtr<Internal> internal;
00057
00059 explicit TermIterator(Internal *internal_);
00060
00062 TermIterator();
00063
00065 ~TermIterator();
00066
00070 TermIterator(const TermIterator &other);
00071
00075 void operator=(const TermIterator &other);
00076
00078 std::string operator *() const;
00079
00080 TermIterator & operator++();
00081
00082 TermNameWrapper operator++(int) {
00083 std::string tmp = **this;
00084 operator++();
00085 return TermNameWrapper(tmp);
00086 }
00087
00091 void skip_to(const std::string & tname);
00092
00098 Xapian::termcount get_wdf() const;
00099
00104 Xapian::doccount get_termfreq() const;
00105
00108 Xapian::termcount positionlist_count() const;
00109
00113 PositionIterator positionlist_begin() const;
00114
00118 PositionIterator positionlist_end() const {
00119 return PositionIterator(NULL);
00120 }
00121
00123 std::string get_description() const;
00124
00126
00127 typedef std::input_iterator_tag iterator_category;
00128 typedef std::string value_type;
00129 typedef Xapian::termcount_diff difference_type;
00130 typedef std::string * pointer;
00131 typedef std::string & reference;
00133 };
00134
00135 inline bool
00136 operator==(const TermIterator &a, const TermIterator &b)
00137 {
00138 return (a.internal.get() == b.internal.get());
00139 }
00140
00141 inline bool
00142 operator!=(const TermIterator &a, const TermIterator &b)
00143 {
00144 return !(a == b);
00145 }
00146
00147 }
00148
00149 #endif