1 /** @file documentvaluelist.h
2 * @brief Iteration over values in a document.
4 /* Copyright (C) 2007,2008,2009,2011,2017 Olly Betts
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef XAPIAN_INCLUDED_DOCUMENTVALUELIST_H
22 #define XAPIAN_INCLUDED_DOCUMENTVALUELIST_H
24 #include "backends/valuelist.h"
26 #include "backends/documentinternal.h"
30 /// Iteration over values in a document.
31 class DocumentValueList
: public ValueList
{
32 /// Don't allow assignment.
33 void operator=(const DocumentValueList
&);
35 /// Don't allow copying.
36 DocumentValueList(const DocumentValueList
&);
38 /// Document internals we're iterating over.
39 Xapian::Internal::intrusive_ptr
<const Xapian::Document::Internal
> doc
;
41 /** Iterator over the map inside @a doc.
43 * If we haven't started yet, this will be set to: doc->values.end()
45 std::map
<Xapian::valueno
, std::string
>::const_iterator it
;
48 explicit DocumentValueList(const Xapian::Document::Internal
* doc_
)
49 : doc(doc_
), it(doc
->values
->end()) { }
51 Xapian::docid
get_docid() const;
53 std::string
get_value() const;
55 Xapian::valueno
get_valueno() const;
61 /// The parameter is actually a Xapian::valueno for this subclass.
62 void skip_to(Xapian::docid slot
);
64 std::string
get_description() const;
67 #endif // XAPIAN_INCLUDED_DOCUMENTVALUELIST_H