summaryrefslogtreecommitdiffstats
path: root/akonadi2_cli
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2015-12-23 11:48:59 +0100
committerAaron Seigo <aseigo@kde.org>2015-12-23 11:48:59 +0100
commitb0d831910d0615dea94bec77dc46c8c2e415545c (patch)
tree54fe14fabebb3366a0fd362af756ac05721ff85f /akonadi2_cli
parent071f4ef0122a8bfceeda9a10b41e85ad9a34a28d (diff)
downloadsink-b0d831910d0615dea94bec77dc46c8c2e415545c.tar.gz
sink-b0d831910d0615dea94bec77dc46c8c2e415545c.zip
shove output through state
Diffstat (limited to 'akonadi2_cli')
-rw-r--r--akonadi2_cli/state.cpp17
-rw-r--r--akonadi2_cli/state.h9
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
25State::State() 25State::State()
26 : m_outStream(stdout)
26{ 27{
27} 28}
28 29
30void State::print(const QString &message)
31{
32 m_outStream << message;
33}
34
35void State::printLine(const QString &message)
36{
37 m_outStream << message << "\n";
38}
39
40void 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
24class State 24class State
25{ 25{
26public: 26public:
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
33private:
34 QTextStream m_outStream;
28}; 35};
29 36