39 #include "qca_export.h"
43 #include <QMetaObject>
46 #include <QStringList>
49 #include <QVariantList>
101 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
104 QCA_EXPORT QByteArray methodReturnType(
const QMetaObject *obj,
105 const QByteArray &method,
151 const QByteArray &method,
152 const QVariantList &args,
154 Qt::ConnectionType type = Qt::AutoConnection);
330 call(
QObject *obj,
const QByteArray &method,
const QVariantList &args = QVariantList(),
bool *ok =
nullptr);
352 friend class Private;
448 friend class Private;
504 friend class Private;
508 class ConsolePrivate;
509 class ConsoleReferencePrivate;
677 friend class ConsolePrivate;
757 QByteArray
read(
int bytes = -1);
837 friend class ConsoleReferencePrivate;
838 ConsoleReferencePrivate *d;
935 friend class Private;
1046 friend class Global;
1055 QStringList m_loggerNames;
An abstract log device.
Definition: qca_support.h:1068
QString name() const
The name of this log device.
AbstractLogDevice(const QString &name, QObject *parent=nullptr)
Create a new message logger.
virtual void logBinaryMessage(const QByteArray &blob, Logger::Severity severity)
Log a binary blob.
virtual void logTextMessage(const QString &message, Logger::Severity severity)
Log a message.
Console prompt handler.
Definition: qca_support.h:864
void getChar()
Obtain one character from the user.
QChar resultChar() const
Obtain the result of the user input.
void waitForFinished()
Block waiting for user input.
void finished()
Emitted when the user input activity has been completed.
void getHidden(const QString &promptStr)
Allow the user to enter data without it being echo'd to the terminal.
SecureArray result() const
Obtain the result of the user input.
ConsolePrompt(QObject *parent=nullptr)
Standard constructor.
Manager for a Console.
Definition: qca_support.h:693
SecurityMode securityMode() const
The security mode setting for the Console object managed by this object.
void outputClosed()
Emitted when the console output is closed.
void bytesWritten(int bytes)
Emitted when bytes are written to the Console.
void closeOutput()
Close the write channel.
void stop()
Stop processing, and release the Console.
ConsoleReference(QObject *parent=nullptr)
Standard constructor.
int bytesToWrite() const
The number of bytes remaining to be written to the Console being managed.
void write(const QByteArray &a)
Write data to the Console.
SecurityMode
The security setting to use for the Console being managed.
Definition: qca_support.h:700
void writeSecure(const SecureArray &a)
Write secure data to the Console.
int bytesAvailable() const
The number of bytes available to read from the Console being managed.
QByteArray read(int bytes=-1)
Read data from the Console.
Console * console() const
The Console object managed by this object.
SecureArray readSecure(int bytes=-1)
Read secure data from the Console.
void readyRead()
Emitted when there are bytes available to read from the Console being managed.
void inputClosed()
Emitted when the console input is closed.
bool start(Console *console, SecurityMode mode=SecurityDisabled)
Set the Console object to be managed, and start processing.
QCA Console system
Definition: qca_support.h:561
static Console * ttyInstance()
The current terminal-type console object.
Type
The type of console object.
Definition: qca_support.h:568
@ Tty
physical console
Definition: qca_support.h:569
Console(Type type, ChannelMode cmode, TerminalMode tmode, QObject *parent=nullptr)
Standard constructor.
ChannelMode
The type of I/O to use with the console object.
Definition: qca_support.h:576
@ Read
Read only (equivalent to stdin)
Definition: qca_support.h:577
ChannelMode channelMode() const
The ChannelMode of this Console object.
QByteArray bytesLeftToRead()
Obtain remaining data from the Console, awaiting a read operation.
Type type() const
The Type of this Console object.
QByteArray bytesLeftToWrite()
Obtain remaining data from the Console, awaiting a write operation.
void release()
Release the Console.
TerminalMode
The nature of the console operation.
Definition: qca_support.h:585
@ Default
use default terminal settings
Definition: qca_support.h:586
static bool isStdinRedirected()
Test whether standard input is redirected.
static Console * stdioInstance()
The current stdio-type console object.
TerminalMode terminalMode() const
The TerminalMode of this Console object.
static bool isStdoutRedirected()
Test whether standard output is redirected.
Support class to monitor a directory for activity.
Definition: qca_support.h:410
QString dirName() const
The name of the directory that is being monitored.
DirWatch(const QString &dir=QString(), QObject *parent=nullptr)
Standard constructor.
void changed()
The changed signal is emitted when the directory is changed (e.g. modified by addition or deletion of...
void setDirName(const QString &dir)
Change the directory being monitored.
Support class to monitor a file for activity.
Definition: qca_support.h:468
FileWatch(const QString &file=QString(), QObject *parent=nullptr)
Standard constructor.
QString fileName() const
The name of the file that is being monitored.
void setFileName(const QString &file)
Change the file being monitored.
void changed()
The changed signal is emitted when the file is changed (e.g.
A simple logging system.
Definition: qca_support.h:963
QStringList currentLogDevices() const
Get a list of the names of all registered log devices.
Severity level() const
Get the current logging level.
Definition: qca_support.h:990
void registerLogDevice(AbstractLogDevice *logger)
Add an AbstractLogDevice subclass to the existing list of loggers.
Severity
The severity of the message.
Definition: qca_support.h:973
void logBinaryMessage(const QByteArray &blob, Severity=Information)
Log a binary blob to all available log devices.
void setLevel(Severity level)
Set the current logging level.
void unregisterLogDevice(const QString &loggerName)
Remove an AbstractLogDevice subclass from the existing list of loggers.
void logTextMessage(const QString &message, Severity=Information)
Log a message to all available log devices.
Secure array of bytes.
Definition: qca_tools.h:317
Convenience class to run a thread and interact with it synchronously.
Definition: qca_support.h:280
QCA_EXPORT bool invokeMethodWithVariants(QObject *obj, const QByteArray &method, const QVariantList &args, QVariant *ret, Qt::ConnectionType type=Qt::AutoConnection)
Convenience method to invoke a method by name, using a variant list of arguments.
virtual void atStart()=0
Reimplement this to perform your initialization.
QVariant call(QObject *obj, const QByteArray &method, const QVariantList &args=QVariantList(), bool *ok=nullptr)
Calls a slot of an object in the thread.
void run() override
Starts the event loop and calls atStart and atStop as necessary.
QCA_EXPORT int methodReturnType(const QMetaObject *obj, const QByteArray &method, const QList< QByteArray > &argTypes)
Convenience method to determine the return type of a method.
void stop()
Stops the event loop of the thread, calls atStop() in the thread, and instructs the thread to finish.
SyncThread(QObject *parent=nullptr)
Standard constructor.
virtual void atEnd()=0
Reimplement this to perform your deinitialization.
void start()
Starts the thread, begins the event loop the thread, and then calls atStart() in the thread.
~SyncThread() override
Calls stop() and then destructs.
Enable synchronization between two threads.
Definition: qca_support.h:362
bool waitForCondition(int msecs=-1)
Call to pause execution in this thread.
void conditionMet()
Call to continue execution in the paused thread.
Synchronizer(QObject *parent)
Standard constructor.
QCA - the Qt Cryptographic Architecture.
Definition: qca_basic.h:41
QCA_EXPORT Logger * logger()
Return a reference to the QCA Logger, which is used for diagnostics and error recording.