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
00095 Xapian::termcount get_wdf() const;
00096
00099 Xapian::doccount get_termfreq() const;
00100
00103 Xapian::termcount positionlist_count() const;
00104
00108 PositionIterator positionlist_begin() const;
00109
00113 PositionIterator positionlist_end() const {
00114 return PositionIterator(NULL);
00115 }
00116
00120 std::string get_description() const;
00121
00123
00124 typedef std::input_iterator_tag iterator_category;
00125 typedef std::string value_type;
00126 typedef Xapian::termcount_diff difference_type;
00127 typedef std::string * pointer;
00128 typedef std::string & reference;
00130 };
00131
00132 inline bool
00133 operator==(const TermIterator &a, const TermIterator &b)
00134 {
00135 return (a.internal.get() == b.internal.get());
00136 }
00137
00138 inline bool
00139 operator!=(const TermIterator &a, const TermIterator &b)
00140 {
00141 return !(a == b);
00142 }
00143
00144 }
00145
00146 #endif