- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# include/xapian/valueiterator.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 2002,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 OM_HGUARD_OMVALUEITERATOR_H
    00027 #define OM_HGUARD_OMVALUEITERATOR_H
    00028
    00029 #include <iterator>
    00030 #include <string>
    00031 #include <xapian/types.h>
    00032 #include <xapian/document.h>
    00033 #include <xapian/visibility.h>
    00034
    00035 namespace Xapian {
    00036
    00039 class XAPIAN_VISIBILITY_DEFAULT ValueIterator {
    00040     private:
    00041         friend class Document;
    00042         friend bool operator==(const ValueIterator &a, const ValueIterator &b);
    00043         friend bool operator!=(const ValueIterator &a, const ValueIterator &b);
    00044
    00045         ValueIterator(Xapian::valueno index_, const Document & doc_)
    00046             : index(index_), doc(doc_) { }
    00047
    00048         Xapian::valueno index;
    00049         Document doc;
    00050
    00051     public:
    00055         ValueIterator() : index(0), doc() { }
    00056
    00057         ~ValueIterator() { }
    00058
    00060         ValueIterator(const ValueIterator &other) {
    00061             index = other.index;
    00062             doc = other.doc;
    00063         }
    00064
    00066         void operator=(const ValueIterator &other) {
    00067             index = other.index;
    00068             doc = other.doc;
    00069         }
    00070
    00072         ValueIterator & operator++() {
    00073             ++index;
    00074             return *this;
    00075         }
    00076
    00078         ValueIterator operator++(int) {
    00079             ValueIterator tmp = *this;
    00080             ++index;
    00081             return tmp;
    00082         }
    00083
    00085         const std::string & operator*() const;
    00086
    00088         const std::string * operator->() const;
    00089
    00091         Xapian::valueno get_valueno() const;
    00092
    00096         std::string get_description() const;
    00097
    00099
    00100         typedef std::input_iterator_tag iterator_category;
    00101         typedef std::string value_type;
    00102         typedef Xapian::valueno_diff difference_type;
    00103         typedef std::string * pointer;
    00104         typedef std::string & reference;
    00106 };
    00107
    00108 inline bool operator==(const ValueIterator &a, const ValueIterator &b)
    00109 {
    00110     return (a.index == b.index);
    00111 }
    00112
    00113 inline bool operator!=(const ValueIterator &a, const ValueIterator &b)
    00114 {
    00115     return (a.index != b.index);
    00116 }
    00117
    00118 }
    00119
    00120 #endif /* OM_HGUARD_OMVALUEITERATOR_H */