From a767b85be312c06791b57abb1c9640b88a82b134 Mon Sep 17 00:00:00 2001 From: Justin Karneges Date: Fri, 1 Jun 2007 07:05:47 +0000 Subject: [PATCH] getters, formatting svn path=/trunk/kdesupport/qca/; revision=670363 --- include/QtCrypto/qca_support.h | 36 +++++++++++++++++++++------------- src/support/console.cpp | 29 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/include/QtCrypto/qca_support.h b/include/QtCrypto/qca_support.h index 7fa6caeb..243e3574 100644 --- a/include/QtCrypto/qca_support.h +++ b/include/QtCrypto/qca_support.h @@ -235,6 +235,10 @@ public: Console(Type type, ChannelMode cmode, TerminalMode tmode, QObject *parent = 0); ~Console(); + Type type() const; + ChannelMode channelMode() const; + TerminalMode terminalMode() const; + static bool isStdinRedirected(); static bool isStdoutRedirected(); @@ -272,6 +276,9 @@ public: bool start(Console *console, SecurityMode mode = SecurityDisabled); void stop(); + Console *console() const; + SecurityMode securityMode() const; + // normal i/o QByteArray read(int bytes = -1); void write(const QByteArray &a); @@ -330,18 +337,19 @@ class AbstractLogDevice; /** A simple logging system - This class provides a simple but flexible approach to logging information that - may be used for debugging or system operation diagnostics. + This class provides a simple but flexible approach to logging information + that may be used for debugging or system operation diagnostics. - There is a single %Logger for each application that uses %QCA. You do not need - to create this %Logger yourself - %QCA automatically creates it on startup. You - can get access to the %Logger using the global QCA::logger() method. + There is a single %Logger for each application that uses %QCA. You do not + need to create this %Logger yourself - %QCA automatically creates it on + startup. You can get access to the %Logger using the global QCA::logger() + method. - By default the Logger just accepts all messages (binary and text). If you want to - get access to those messages, you need to subclass AbstractLogDevice, and register - your subclass (using registerLogDevice()). You can then take whatever action is - appropriate (e.g. show to the user using the GUI, log to a file or send to standard - error). + By default the Logger just accepts all messages (binary and text). If you + want to get access to those messages, you need to subclass + AbstractLogDevice, and register your subclass (using registerLogDevice()). + You can then take whatever action is appropriate (e.g. show to the user + using the GUI, log to a file or send to standard error). */ class QCA_EXPORT Logger : public QObject { @@ -371,7 +379,7 @@ public: \return Current level */ - inline Logger::Severity level () const { return m_logLevel; } + inline Logger::Severity level() const { return m_logLevel; } /** Set the current logging level @@ -380,7 +388,7 @@ public: Only severities less or equal than the log level one will be logged */ - void setLevel (Logger::Severity level); + void setLevel(Logger::Severity level); /** Log a message to all available log devices @@ -457,7 +465,7 @@ public: override this method in your subclass to do whatever logging is required */ - virtual void logTextMessage( const QString &message, enum Logger::Severity severity ); + virtual void logTextMessage(const QString &message, enum Logger::Severity severity); /** Log a binary blob @@ -466,7 +474,7 @@ public: override this method in your subclass to do whatever logging is required */ - virtual void logBinaryMessage( const QByteArray &blob, Logger::Severity severity ); + virtual void logBinaryMessage(const QByteArray &blob, Logger::Severity severity); protected: /** diff --git a/src/support/console.cpp b/src/support/console.cpp index ce007308..c6d66e6a 100644 --- a/src/support/console.cpp +++ b/src/support/console.cpp @@ -340,6 +340,7 @@ public: bool started; Console::Type type; + Console::ChannelMode cmode; Console::TerminalMode mode; ConsoleThread *thread; ConsoleReference *ref; @@ -423,6 +424,7 @@ Console::Console(Type type, ChannelMode cmode, TerminalMode tmode, QObject *pare d = new ConsolePrivate(this); d->type = type; + d->cmode = cmode; Q_PIPE_ID in = INVALID_Q_PIPE_ID; Q_PIPE_ID out = INVALID_Q_PIPE_ID; @@ -490,6 +492,21 @@ Console::~Console() g_stdio_console = 0; } +Console::Type Console::type() const +{ + return d->type; +} + +Console::ChannelMode Console::channelMode() const +{ + return d->cmode; +} + +Console::TerminalMode Console::terminalMode() const +{ + return d->mode; +} + bool Console::isStdinRedirected() { #ifdef Q_OS_WIN @@ -552,6 +569,7 @@ public: Console *console; ConsoleThread *thread; + ConsoleReference::SecurityMode smode; QTimer lateTrigger; bool late_read, late_close; @@ -614,6 +632,7 @@ bool ConsoleReference::start(Console *console, SecurityMode mode) } // enable security? it will last for this active session only + d->smode = mode; if(mode == SecurityEnabled) d->thread->setSecurityEnabled(true); @@ -654,6 +673,16 @@ void ConsoleReference::stop() d->console = 0; } +Console *ConsoleReference::console() const +{ + return d->console; +} + +ConsoleReference::SecurityMode ConsoleReference::securityMode() const +{ + return d->smode; +} + QByteArray ConsoleReference::read(int bytes) { return d->thread->read(bytes);