diff options
author | Aaron Seigo <aseigo@kde.org> | 2015-12-23 11:48:59 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2015-12-23 11:48:59 +0100 |
commit | b0d831910d0615dea94bec77dc46c8c2e415545c (patch) | |
tree | 54fe14fabebb3366a0fd362af756ac05721ff85f /akonadi2_cli | |
parent | 071f4ef0122a8bfceeda9a10b41e85ad9a34a28d (diff) | |
download | sink-b0d831910d0615dea94bec77dc46c8c2e415545c.tar.gz sink-b0d831910d0615dea94bec77dc46c8c2e415545c.zip |
shove output through state
Diffstat (limited to 'akonadi2_cli')
-rw-r--r-- | akonadi2_cli/state.cpp | 17 | ||||
-rw-r--r-- | akonadi2_cli/state.h | 9 |
2 files changed, 24 insertions, 2 deletions
diff --git a/akonadi2_cli/state.cpp b/akonadi2_cli/state.cpp index bb21e0e..80a2d3a 100644 --- a/akonadi2_cli/state.cpp +++ b/akonadi2_cli/state.cpp | |||
@@ -20,9 +20,24 @@ | |||
20 | #include "state.h" | 20 | #include "state.h" |
21 | 21 | ||
22 | #include <QDebug> | 22 | #include <QDebug> |
23 | #include <QDir> | 23 | #include <QTextStream> |
24 | 24 | ||
25 | State::State() | 25 | State::State() |
26 | : m_outStream(stdout) | ||
26 | { | 27 | { |
27 | } | 28 | } |
28 | 29 | ||
30 | void State::print(const QString &message) | ||
31 | { | ||
32 | m_outStream << message; | ||
33 | } | ||
34 | |||
35 | void State::printLine(const QString &message) | ||
36 | { | ||
37 | m_outStream << message << "\n"; | ||
38 | } | ||
39 | |||
40 | void State::printError(const QString &error, int code) | ||
41 | { | ||
42 | m_outStream << "ERROR " << code << ": " << error << "\n"; | ||
43 | } | ||
diff --git a/akonadi2_cli/state.h b/akonadi2_cli/state.h index 10b2318..4fd2935 100644 --- a/akonadi2_cli/state.h +++ b/akonadi2_cli/state.h | |||
@@ -19,11 +19,18 @@ | |||
19 | 19 | ||
20 | #pragma once | 20 | #pragma once |
21 | 21 | ||
22 | #include <QStringList> | 22 | #include <QTextStream> |
23 | 23 | ||
24 | class State | 24 | class State |
25 | { | 25 | { |
26 | public: | 26 | public: |
27 | State(); | 27 | State(); |
28 | |||
29 | void print(const QString &string); | ||
30 | void printLine(const QString &string); | ||
31 | void printError(const QString &string, int errorCode = 0); | ||
32 | |||
33 | private: | ||
34 | QTextStream m_outStream; | ||
28 | }; | 35 | }; |
29 | 36 | ||