Better reporting
[vng.git] / InterviewCursor.h
blobee103a62854bd1691655eab38b1d3274b04b2d51
1 /*
2 * This file is part of the vng project
3 * Copyright (C) 2008 Thomas Zander <tzander@trolltech.com>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef INTERVIEWCURSOR_H
20 #define INTERVIEWCURSOR_H
22 #include "Configuration.h"
24 #include <QString>
26 class InterviewCursor {
27 public:
28 enum Scope {
29 ItemScope,
30 BlockScope,
31 FullRange
34 InterviewCursor();
35 virtual ~InterviewCursor();
37 void setConfiguration(Configuration &config) {
38 m_config = &config;
41 /**
42 * Moves the cursor forward in the list.
43 * returns the new index.
44 * Moving the cursor past the last item will make isValid() return false.
46 virtual int forward(Scope scope = ItemScope, bool skipAnswered = true) = 0;
48 /**
49 * Moves the cursor backwards in the list.
50 * returns the new index.
51 * This method can not move the cursor to be before the first item.
53 virtual int back(Scope scope = ItemScope) = 0;
54 virtual void setResponse(bool response, Scope scope = ItemScope) = 0;
55 virtual QString currentText() const = 0;
57 /**
58 * Returns true if the item the cursor is on is a valid one. The cursor can point to an invalid item when there
59 * are no items in the document, or when the cursor moved past the end of the list.
61 virtual bool isValid() const = 0;
63 /**
64 * Returns the amount of items in the list, or -1 if the amount is not fully determined yet.
65 * @see forceCount()
67 virtual int count() = 0;
69 /**
70 * Will force a count of all items, potentially blocking for extended times while counting.
71 * Afterwards the count() method will return a valid count.
73 virtual void forceCount() = 0;
75 virtual QString helpMessage() const = 0;
77 protected:
78 Configuration *m_config;
81 #endif