2 * @brief Iteration over values in a document.
4 /* Copyright (C) 2008,2009,2011,2013 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
23 #include "documentvaluelist.h"
25 #include "backends/document.h"
28 #include "unicode/description_append.h"
30 #include "xapian/error.h"
35 DocumentValueList::get_docid() const
37 throw Xapian::InvalidOperationError("get_docid() isn't valid when iterating over values in a document");
41 DocumentValueList::get_valueno() const
48 DocumentValueList::get_value() const
55 DocumentValueList::at_end() const
57 return it
== doc
->values
.end();
61 DocumentValueList::next()
63 if (it
== doc
->values
.end()) {
64 it
= doc
->values
.begin();
71 DocumentValueList::skip_to(Xapian::docid slot
)
73 it
= doc
->values
.lower_bound(slot
);
77 DocumentValueList::get_description() const
79 string desc
= "DocumentValueList(";
82 desc
+= str(get_valueno());
84 description_append(desc
, get_value());