summaryrefslogtreecommitdiffstats
path: root/akonadish/repl/replStates.h
diff options
context:
space:
mode:
Diffstat (limited to 'akonadish/repl/replStates.h')
-rw-r--r--akonadish/repl/replStates.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/akonadish/repl/replStates.h b/akonadish/repl/replStates.h
new file mode 100644
index 0000000..a0d3f90
--- /dev/null
+++ b/akonadish/repl/replStates.h
@@ -0,0 +1,87 @@
1/*
2 * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#pragma once
21
22#include <QState>
23
24class QSocketNotifier;
25
26class ReadState : public QState
27{
28 Q_OBJECT
29
30public:
31 ReadState(QState *parent = 0);
32
33Q_SIGNALS:
34 void command(const QString &command);
35 void exitRequested();
36
37protected:
38 void onEntry(QEvent *event);
39 virtual const char *prompt() const;
40};
41
42class UnfinishedReadState : public ReadState
43{
44 Q_OBJECT
45
46public:
47 UnfinishedReadState(QState *parent = 0);
48
49protected:
50 const char *prompt() const;
51};
52
53class EvalState : public QState
54{
55 Q_OBJECT
56
57public:
58 EvalState(QState *parent = 0);
59
60Q_SIGNALS:
61 void completed();
62 void continueInput();
63 void output(const QString &output);
64
65protected:
66 void onEntry(QEvent *event);
67
68private:
69 void complete();
70
71 QString m_partial;
72};
73
74class PrintState : public QState
75{
76 Q_OBJECT
77
78public:
79 PrintState(QState *parent = 0);
80
81Q_SIGNALS:
82 void completed();
83
84protected:
85 void onEntry(QEvent *event);
86};
87