include/xapian/termiterator.h

Go to the documentation of this file.
00001 
00004 /* Copyright 1999,2000,2001 BrightStation PLC
00005  * Copyright 2002 Ananova Ltd
00006  * Copyright 2003,2004,2005,2006,2007,2008 Olly Betts
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00021  * USA
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/derefwrapper.h>
00032 #include <xapian/types.h>
00033 #include <xapian/positioniterator.h>
00034 #include <xapian/visibility.h>
00035 
00036 namespace Xapian {
00037 
00038 class Database;
00039 
00042 class XAPIAN_VISIBILITY_DEFAULT TermIterator {
00043     public:
00044         class Internal;
00046         Xapian::Internal::RefCntPtr<Internal> internal;
00047 
00049         explicit TermIterator(Internal *internal_);
00050 
00052         TermIterator();
00053 
00055         ~TermIterator();
00056 
00060         TermIterator(const TermIterator &other);
00061 
00065         void operator=(const TermIterator &other);
00066 
00068         std::string operator *() const;
00069 
00070         TermIterator & operator++();
00071 
00072         DerefStringWrapper_ operator++(int) {
00073             std::string term(**this);
00074             operator++();
00075             return DerefStringWrapper_(term);
00076         }
00077 
00081         void skip_to(const std::string & tname);
00082 
00088         Xapian::termcount get_wdf() const;
00089 
00094         Xapian::doccount get_termfreq() const;
00095 
00098         Xapian::termcount positionlist_count() const;
00099 
00103         PositionIterator positionlist_begin() const;
00104 
00108         PositionIterator positionlist_end() const {
00109             return PositionIterator(NULL);
00110         }
00111 
00113         std::string get_description() const;
00114 
00116 
00117         typedef std::input_iterator_tag iterator_category;
00118         typedef std::string value_type;
00119         typedef Xapian::termcount_diff difference_type;
00120         typedef std::string * pointer;
00121         typedef std::string & reference;
00123 };
00124 
00125 inline bool
00126 operator==(const TermIterator &a, const TermIterator &b)
00127 {
00128     return (a.internal.get() == b.internal.get());
00129 }
00130 
00131 inline bool
00132 operator!=(const TermIterator &a, const TermIterator &b)
00133 {
00134     return !(a == b);
00135 }
00136 
00137 }
00138 
00139 #endif /* XAPIAN_INCLUDED_TERMITERATOR_H */

Documentation for Xapian (version 1.1.1).
Generated on 10 Jun 2009 by Doxygen 1.5.2.