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
#include <xapian/positioniterator.h>
00035
00036
namespace Xapian {
00037
00038
class Database;
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
public:
00055
class Internal;
00057 Xapian::Internal::RefCntPtr<Internal> internal;
00058
00060
explicit TermIterator(Internal *internal_);
00061
00063
TermIterator();
00064
00066
~TermIterator();
00067
00071
TermIterator(
const TermIterator &other);
00072
00076
void operator=(
const TermIterator &other);
00077
00079 std::string
operator *() const;
00080
00081
TermIterator & operator++();
00082
00083
TermNameWrapper operator++(
int) {
00084 std::string tmp = **
this;
00085 operator++();
00086
return TermNameWrapper(tmp);
00087 }
00088
00092
void skip_to(
const std::string & tname);
00093
00096 Xapian::termcount
get_wdf() const;
00097
00100 Xapian::
doccount get_termfreq() const;
00101
00105
PositionIterator positionlist_begin() const;
00106
00110 PositionIterator positionlist_end()
const {
00111
return PositionIterator(NULL);
00112 }
00113
00117 std::string
get_description() const;
00118
00120
00121 typedef std::input_iterator_tag iterator_category;
00122 typedef std::string value_type;
00123 typedef Xapian::
termcount_diff difference_type;
00124 typedef std::string * pointer;
00125 typedef std::string & reference;
00127 };
00128
00129 inline
bool
00130 operator==(const
TermIterator &a, const
TermIterator &b)
00131 {
00132
return (a.internal.get() == b.internal.get());
00133 }
00134
00135
inline bool
00136
operator!=(
const TermIterator &a,
const TermIterator &b)
00137 {
00138
return !(a == b);
00139 }
00140
00141 }
00142
00143
#endif