Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

/include/xapian/termiterator.h

Go to the documentation of this file.
00001 
00004 /* ----START-LICENCE----
00005  * Copyright 1999,2000,2001 BrightStation PLC
00006  * Copyright 2002 Ananova Ltd
00007  * Copyright 2003,2004 Olly Betts
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License as
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022  * USA
00023  * -----END-LICENCE-----
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 
00042 class TermIterator {
00043     private:
00044         // friend classes which need to be able to construct us
00045         friend class Database;
00046         friend class Document;
00047 
00048     public:
00049         class Internal;
00051         Xapian::Internal::RefCntPtr<Internal> internal;
00052 
00053         friend bool operator==(const TermIterator &a, const TermIterator &b);
00054 
00055     public:
00056         // FIXME: better if this was private...
00057         explicit TermIterator(Internal *internal_);
00058 
00060         TermIterator();
00061 
00063         ~TermIterator();
00064 
00068         TermIterator(const TermIterator &other);
00069 
00073         void operator=(const TermIterator &other);
00074 
00075         std::string operator *() const;
00076 
00077         TermIterator & operator++();
00078 
00079         void operator++(int);
00080 
00081         // extra method, not required for an input_iterator
00082         void skip_to(const std::string & tname);
00083 
00084         Xapian::termcount get_wdf() const;
00085         Xapian::doccount get_termfreq() const;
00086 
00087         // allow iteration of positionlist for current document
00088         PositionIterator positionlist_begin();
00089         PositionIterator positionlist_end();
00090     
00094         std::string get_description() const;
00095 
00097 
00098         typedef std::input_iterator_tag iterator_category;
00099         typedef std::string value_type;
00100         typedef Xapian::termcount_diff difference_type;
00101         typedef std::string * pointer;
00102         typedef std::string & reference;
00104 };
00105 
00106 inline bool
00107 operator==(const TermIterator &a, const TermIterator &b)
00108 {
00109     return (a.internal.get() == b.internal.get());
00110 }
00111 
00112 inline bool
00113 operator!=(const TermIterator &a, const TermIterator &b)
00114 {
00115     return !(a == b);
00116 }
00117 
00118 }
00119 
00120 #endif /* XAPIAN_INCLUDED_TERMITERATOR_H */

Documentation for Xapian (version 0.8.0).
Generated on 20 Apr 2004 by Doxygen 1.2.15.