[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [akonadi-next/feature/new_cli] akonadi2_cli: shove output through state
From:       Aaron Seigo <aseigo () kde ! org>
Date:       2015-12-23 11:09:12
Message-ID: E1aBhI8-0008IN-OU () scm ! kde ! org
[Download RAW message or body]

Git commit b0d831910d0615dea94bec77dc46c8c2e415545c by Aaron Seigo.
Committed on 23/12/2015 at 10:48.
Pushed by aseigo into branch 'feature/new_cli'.

shove output through state

M  +16   -1    akonadi2_cli/state.cpp
M  +8    -1    akonadi2_cli/state.h

http://commits.kde.org/akonadi-next/b0d831910d0615dea94bec77dc46c8c2e415545c

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 @@
 #include "state.h"
 
 #include <QDebug>
-#include <QDir>
+#include <QTextStream>
 
 State::State()
+    : m_outStream(stdout)
 {
 }
 
+void State::print(const QString &message)
+{
+    m_outStream << message;
+}
+
+void State::printLine(const QString &message)
+{
+    m_outStream << message << "\n";
+}
+
+void State::printError(const QString &error, int code)
+{
+    m_outStream << "ERROR " << code << ": " << error << "\n";
+}
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 @@
 
 #pragma once
 
-#include <QStringList>
+#include <QTextStream>
 
 class State
 {
 public:
     State();
+
+    void print(const QString &string);
+    void printLine(const QString &string);
+    void printError(const QString &string, int errorCode = 0);
+
+private:
+    QTextStream m_outStream;
 };
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic