mirror of
https://github.com/QuasarApp/qca.git
synced 2025-04-26 19:44:32 +00:00
qca_export,tools,qpipe.h,support,provider,core,qca.h,textfilter and
private headers have been de-indented 1 tab and their documentation formatting have been made consistent svn path=/trunk/kdesupport/qca/; revision=670321
This commit is contained in:
parent
24c38e3217
commit
ff8b982fb6
File diff suppressed because it is too large
Load Diff
@ -47,448 +47,447 @@
|
||||
#include "qca_export.h"
|
||||
#include "qca_tools.h"
|
||||
|
||||
namespace QCA
|
||||
namespace QCA {
|
||||
|
||||
QCA_EXPORT QByteArray methodReturnType(const QMetaObject *obj, const QByteArray &method, const QList<QByteArray> argTypes);
|
||||
QCA_EXPORT bool invokeMethodWithVariants(QObject *obj, const QByteArray &method, const QVariantList &args, QVariant *ret, Qt::ConnectionType type = Qt::AutoConnection);
|
||||
|
||||
class QCA_EXPORT SyncThread : public QThread
|
||||
{
|
||||
QCA_EXPORT QByteArray methodReturnType(const QMetaObject *obj, const QByteArray &method, const QList<QByteArray> argTypes);
|
||||
QCA_EXPORT bool invokeMethodWithVariants(QObject *obj, const QByteArray &method, const QVariantList &args, QVariant *ret, Qt::ConnectionType type = Qt::AutoConnection);
|
||||
Q_OBJECT
|
||||
public:
|
||||
SyncThread(QObject *parent = 0);
|
||||
~SyncThread();
|
||||
|
||||
class QCA_EXPORT SyncThread : public QThread
|
||||
void start();
|
||||
void stop();
|
||||
QVariant call(QObject *obj, const QByteArray &method, const QVariantList &args = QVariantList(), bool *ok = 0);
|
||||
|
||||
protected:
|
||||
virtual void atStart() = 0;
|
||||
virtual void atEnd() = 0;
|
||||
|
||||
// reimplemented
|
||||
virtual void run();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(SyncThread)
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
class QCA_EXPORT Synchronizer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Synchronizer(QObject *parent);
|
||||
~Synchronizer();
|
||||
|
||||
bool waitForCondition(int msecs = -1);
|
||||
void conditionMet();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Synchronizer)
|
||||
|
||||
class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
class QCA_EXPORT DirWatch : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DirWatch(const QString &dir = QString(), QObject *parent = 0);
|
||||
~DirWatch();
|
||||
|
||||
QString dirName() const;
|
||||
void setDirName(const QString &dir);
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DirWatch)
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
/**
|
||||
Support class to monitor a file for activity
|
||||
|
||||
%FileWatch monitors a specified file for any changes. When
|
||||
the file changes, the changed() signal is emitted.
|
||||
*/
|
||||
class QCA_EXPORT FileWatch : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
Standard constructor
|
||||
|
||||
\param file the name of the file to watch. If not
|
||||
in this object, you can set it using setFileName()
|
||||
\param parent the parent object for this object
|
||||
*/
|
||||
explicit FileWatch(const QString &file = QString(), QObject *parent = 0);
|
||||
~FileWatch();
|
||||
|
||||
/**
|
||||
The name of the file that is being monitored
|
||||
*/
|
||||
QString fileName() const;
|
||||
|
||||
/**
|
||||
Change the file being monitored
|
||||
|
||||
\param file the name of the file to monitor
|
||||
*/
|
||||
void setFileName(const QString &file);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
The changed signal is emitted when the file is
|
||||
changed (e.g. modified, deleted)
|
||||
*/
|
||||
void changed();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(FileWatch)
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
class ConsolePrivate;
|
||||
class ConsoleReferencePrivate;
|
||||
class ConsoleReference;
|
||||
|
||||
// QCA Console system
|
||||
//
|
||||
// QCA provides an API for asynchronous, event-based access to
|
||||
// the console and stdin/stdout, as these facilities are
|
||||
// otherwise not portable. The primary use of this system within
|
||||
// QCA is for passphrase prompting in command-line applications,
|
||||
// using the tty console type.
|
||||
//
|
||||
// How it works: Create a Console object for the type of console
|
||||
// desired, and then use ConsoleReference to act on the console.
|
||||
// Only one ConsoleReference may operate on a Console at a time.
|
||||
//
|
||||
// A Console object overtakes either the physical console (tty
|
||||
// type) or stdin/stdout (stdio type). Only one of each type
|
||||
// may be created at a time.
|
||||
//
|
||||
// Whenever code is written that needs a tty or stdio object, the
|
||||
// code should first call one of the static methods (ttyInstance
|
||||
// or stdioInstance) to see if a console object for the desired
|
||||
// type exists already. If the object exists, use it. If it does
|
||||
// not exist, the rule is that the relevant code should create the
|
||||
// object, use the object, and then destroy the object when the
|
||||
// operation is completed.
|
||||
//
|
||||
// By following the above rule, you can write code that utilizes
|
||||
// a console without the application having to create some master
|
||||
// console object for you. Of course, if the application has
|
||||
// created a console then it will be used.
|
||||
//
|
||||
// Why make a master console object? The primary reason is that it
|
||||
// is not guaranteed that all I/O will survive creation and
|
||||
// destruction of a console object. If you are using the stdio
|
||||
// type, then you probably want a long-lived console object. It
|
||||
// is possible to capture unprocessed I/O by calling
|
||||
// bytesLeftToRead or bytesLeftToWrite. However, it is not
|
||||
// expected that general console-needing code will call these
|
||||
// functions when utilizing a temporary console. Thus, an
|
||||
// application developer would need to create his own console
|
||||
// object, invoke the console-needing code, and then do his own
|
||||
// extraction of the unprocessed I/O if necessary. Another reason
|
||||
// to extract unprocessed I/O is if you need to switch from
|
||||
// QCA::Console back to standard functions (e.g. fgets).
|
||||
//
|
||||
class QCA_EXPORT Console : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SyncThread(QObject *parent = 0);
|
||||
~SyncThread();
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
QVariant call(QObject *obj, const QByteArray &method, const QVariantList &args = QVariantList(), bool *ok = 0);
|
||||
|
||||
protected:
|
||||
virtual void atStart() = 0;
|
||||
virtual void atEnd() = 0;
|
||||
|
||||
// reimplemented
|
||||
virtual void run();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(SyncThread)
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
Tty, // physical console
|
||||
Stdio // stdin/stdout
|
||||
};
|
||||
|
||||
class QCA_EXPORT Synchronizer : public QObject
|
||||
enum ChannelMode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Synchronizer(QObject *parent);
|
||||
~Synchronizer();
|
||||
|
||||
bool waitForCondition(int msecs = -1);
|
||||
void conditionMet();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Synchronizer)
|
||||
|
||||
class Private;
|
||||
Private *d;
|
||||
Read, // stdin
|
||||
ReadWrite // stdin + stdout
|
||||
};
|
||||
|
||||
class QCA_EXPORT DirWatch : public QObject
|
||||
enum TerminalMode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DirWatch(const QString &dir = QString(), QObject *parent = 0);
|
||||
~DirWatch();
|
||||
Default, // use default terminal settings
|
||||
Interactive // char-by-char input, no echo
|
||||
};
|
||||
|
||||
QString dirName() const;
|
||||
void setDirName(const QString &dir);
|
||||
Console(Type type, ChannelMode cmode, TerminalMode tmode, QObject *parent = 0);
|
||||
~Console();
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
static bool isStdinRedirected();
|
||||
static bool isStdoutRedirected();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DirWatch)
|
||||
static Console *ttyInstance();
|
||||
static Console *stdioInstance();
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
// call release() to get access to unempty buffers
|
||||
void release();
|
||||
QByteArray bytesLeftToRead();
|
||||
QByteArray bytesLeftToWrite();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Console)
|
||||
|
||||
friend class ConsolePrivate;
|
||||
ConsolePrivate *d;
|
||||
|
||||
friend class ConsoleReference;
|
||||
};
|
||||
|
||||
// note: only one ConsoleReference object can be active at a time
|
||||
class QCA_EXPORT ConsoleReference : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum SecurityMode
|
||||
{
|
||||
SecurityDisabled,
|
||||
SecurityEnabled
|
||||
};
|
||||
|
||||
ConsoleReference(QObject *parent = 0);
|
||||
~ConsoleReference();
|
||||
|
||||
bool start(Console *console, SecurityMode mode = SecurityDisabled);
|
||||
void stop();
|
||||
|
||||
// normal i/o
|
||||
QByteArray read(int bytes = -1);
|
||||
void write(const QByteArray &a);
|
||||
|
||||
// secure i/o
|
||||
SecureArray readSecure(int bytes = -1);
|
||||
void writeSecure(const SecureArray &a);
|
||||
|
||||
// close write channel (only if writing enabled)
|
||||
void closeOutput();
|
||||
|
||||
int bytesAvailable() const;
|
||||
int bytesToWrite() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void readyRead();
|
||||
void bytesWritten(int bytes);
|
||||
void inputClosed();
|
||||
void outputClosed();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ConsoleReference)
|
||||
|
||||
friend class ConsoleReferencePrivate;
|
||||
ConsoleReferencePrivate *d;
|
||||
|
||||
friend class Console;
|
||||
};
|
||||
|
||||
class QCA_EXPORT ConsolePrompt : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConsolePrompt(QObject *parent = 0);
|
||||
~ConsolePrompt();
|
||||
|
||||
void getHidden(const QString &promptStr);
|
||||
void getEnter();
|
||||
void waitForFinished();
|
||||
|
||||
SecureArray result() const;
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ConsolePrompt)
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
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.
|
||||
|
||||
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).
|
||||
*/
|
||||
class QCA_EXPORT Logger : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
The severity of the message
|
||||
|
||||
This information may be used by the log device to determine
|
||||
what the appropriate action is.
|
||||
*/
|
||||
enum Severity
|
||||
{
|
||||
Quiet = 0, ///< Quiet: turn of logging
|
||||
Emergency = 1, ///< Emergency: system is unusable
|
||||
Alert = 2, ///< Alert: action must be taken immediately
|
||||
Critical = 3, ///< Critical: critical conditions
|
||||
Error = 4, ///< Error: error conditions
|
||||
Warning = 5, ///< Warning: warning conditions
|
||||
Notice = 6, ///< Notice: normal but significant condition
|
||||
Information = 7, ///< Informational: informational messages
|
||||
Debug = 8 ///< Debug: debug-level messages
|
||||
};
|
||||
|
||||
/**
|
||||
Support class to monitor a file for activity
|
||||
Get the current logging level
|
||||
|
||||
%FileWatch monitors a specified file for any changes. When
|
||||
the file changes, the changed() signal is emitted.
|
||||
\return Current level
|
||||
*/
|
||||
class QCA_EXPORT FileWatch : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
Standard constructor
|
||||
inline Logger::Severity level () const { return m_logLevel; }
|
||||
|
||||
\param file the name of the file to watch. If not
|
||||
in this object, you can set it using setFileName()
|
||||
\param parent the parent object for this object
|
||||
*/
|
||||
explicit FileWatch(const QString &file = QString(), QObject *parent = 0);
|
||||
~FileWatch();
|
||||
/**
|
||||
Set the current logging level
|
||||
|
||||
/**
|
||||
The name of the file that is being monitored
|
||||
*/
|
||||
QString fileName() const;
|
||||
\param level new logging level
|
||||
|
||||
/**
|
||||
Change the file being monitored
|
||||
Only severities less or equal than the log level one will be logged
|
||||
*/
|
||||
void setLevel (Logger::Severity level);
|
||||
|
||||
\param file the name of the file to monitor
|
||||
*/
|
||||
void setFileName(const QString &file);
|
||||
/**
|
||||
Log a message to all available log devices
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
The changed signal is emitted when the file is
|
||||
changed (e.g. modified, deleted)
|
||||
*/
|
||||
void changed();
|
||||
\param message the text to log
|
||||
*/
|
||||
void logTextMessage(const QString &message, Severity = Information);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(FileWatch)
|
||||
/**
|
||||
Log a binary blob to all available log devices
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
};
|
||||
\param blob the information to log
|
||||
|
||||
class ConsolePrivate;
|
||||
class ConsoleReferencePrivate;
|
||||
class ConsoleReference;
|
||||
\note how this is handled is quite logger specific. For
|
||||
example, it might be logged as a binary, or it might be
|
||||
encoded in some way
|
||||
*/
|
||||
void logBinaryMessage(const QByteArray &blob, Severity = Information);
|
||||
|
||||
// QCA Console system
|
||||
//
|
||||
// QCA provides an API for asynchronous, event-based access to
|
||||
// the console and stdin/stdout, as these facilities are
|
||||
// otherwise not portable. The primary use of this system within
|
||||
// QCA is for passphrase prompting in command-line applications,
|
||||
// using the tty console type.
|
||||
//
|
||||
// How it works: Create a Console object for the type of console
|
||||
// desired, and then use ConsoleReference to act on the console.
|
||||
// Only one ConsoleReference may operate on a Console at a time.
|
||||
//
|
||||
// A Console object overtakes either the physical console (tty
|
||||
// type) or stdin/stdout (stdio type). Only one of each type
|
||||
// may be created at a time.
|
||||
//
|
||||
// Whenever code is written that needs a tty or stdio object, the
|
||||
// code should first call one of the static methods (ttyInstance
|
||||
// or stdioInstance) to see if a console object for the desired
|
||||
// type exists already. If the object exists, use it. If it does
|
||||
// not exist, the rule is that the relevant code should create the
|
||||
// object, use the object, and then destroy the object when the
|
||||
// operation is completed.
|
||||
//
|
||||
// By following the above rule, you can write code that utilizes
|
||||
// a console without the application having to create some master
|
||||
// console object for you. Of course, if the application has
|
||||
// created a console then it will be used.
|
||||
//
|
||||
// Why make a master console object? The primary reason is that it
|
||||
// is not guaranteed that all I/O will survive creation and
|
||||
// destruction of a console object. If you are using the stdio
|
||||
// type, then you probably want a long-lived console object. It
|
||||
// is possible to capture unprocessed I/O by calling
|
||||
// bytesLeftToRead or bytesLeftToWrite. However, it is not
|
||||
// expected that general console-needing code will call these
|
||||
// functions when utilizing a temporary console. Thus, an
|
||||
// application developer would need to create his own console
|
||||
// object, invoke the console-needing code, and then do his own
|
||||
// extraction of the unprocessed I/O if necessary. Another reason
|
||||
// to extract unprocessed I/O is if you need to switch from
|
||||
// QCA::Console back to standard functions (e.g. fgets).
|
||||
//
|
||||
class QCA_EXPORT Console : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
Tty, // physical console
|
||||
Stdio // stdin/stdout
|
||||
};
|
||||
/**
|
||||
Add an AbstractLogDevice subclass to the existing list of loggers
|
||||
|
||||
enum ChannelMode
|
||||
{
|
||||
Read, // stdin
|
||||
ReadWrite // stdin + stdout
|
||||
};
|
||||
\param logger the LogDevice to add
|
||||
*/
|
||||
void registerLogDevice(AbstractLogDevice *logger);
|
||||
|
||||
enum TerminalMode
|
||||
{
|
||||
Default, // use default terminal settings
|
||||
Interactive // char-by-char input, no echo
|
||||
};
|
||||
/**
|
||||
Remove an AbstractLogDevice subclass from the existing list of loggers
|
||||
|
||||
Console(Type type, ChannelMode cmode, TerminalMode tmode, QObject *parent = 0);
|
||||
~Console();
|
||||
\param loggerName the name of the LogDevice to remove
|
||||
|
||||
static bool isStdinRedirected();
|
||||
static bool isStdoutRedirected();
|
||||
\note If there are several log devices with the same name, all will be removed.
|
||||
*/
|
||||
void unregisterLogDevice(const QString &loggerName);
|
||||
|
||||
static Console *ttyInstance();
|
||||
static Console *stdioInstance();
|
||||
/**
|
||||
Get a list of the names of all registered log devices
|
||||
*/
|
||||
QStringList currentLogDevices() const;
|
||||
|
||||
// call release() to get access to unempty buffers
|
||||
void release();
|
||||
QByteArray bytesLeftToRead();
|
||||
QByteArray bytesLeftToWrite();
|
||||
private:
|
||||
Q_DISABLE_COPY(Logger)
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Console)
|
||||
friend class Global;
|
||||
|
||||
friend class ConsolePrivate;
|
||||
ConsolePrivate *d;
|
||||
/**
|
||||
Create a new message logger
|
||||
*/
|
||||
Logger();
|
||||
|
||||
friend class ConsoleReference;
|
||||
};
|
||||
~Logger();
|
||||
|
||||
// note: only one ConsoleReference object can be active at a time
|
||||
class QCA_EXPORT ConsoleReference : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum SecurityMode
|
||||
{
|
||||
SecurityDisabled,
|
||||
SecurityEnabled
|
||||
};
|
||||
QStringList m_loggerNames;
|
||||
QList<AbstractLogDevice*> m_loggers;
|
||||
Severity m_logLevel;
|
||||
};
|
||||
|
||||
ConsoleReference(QObject *parent = 0);
|
||||
~ConsoleReference();
|
||||
/**
|
||||
An abstract log device
|
||||
*/
|
||||
class QCA_EXPORT AbstractLogDevice : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
The name of this log device
|
||||
*/
|
||||
QString name() const;
|
||||
|
||||
bool start(Console *console, SecurityMode mode = SecurityDisabled);
|
||||
void stop();
|
||||
/**
|
||||
Log a message
|
||||
|
||||
// normal i/o
|
||||
QByteArray read(int bytes = -1);
|
||||
void write(const QByteArray &a);
|
||||
The default implementation does nothing - you should
|
||||
override this method in your subclass to do whatever
|
||||
logging is required
|
||||
*/
|
||||
virtual void logTextMessage( const QString &message, enum Logger::Severity severity );
|
||||
|
||||
// secure i/o
|
||||
SecureArray readSecure(int bytes = -1);
|
||||
void writeSecure(const SecureArray &a);
|
||||
/**
|
||||
Log a binary blob
|
||||
|
||||
// close write channel (only if writing enabled)
|
||||
void closeOutput();
|
||||
The default implementation does nothing - you should
|
||||
override this method in your subclass to do whatever
|
||||
logging is required
|
||||
*/
|
||||
virtual void logBinaryMessage( const QByteArray &blob, Logger::Severity severity );
|
||||
|
||||
int bytesAvailable() const;
|
||||
int bytesToWrite() const;
|
||||
protected:
|
||||
/**
|
||||
Create a new message logger
|
||||
|
||||
Q_SIGNALS:
|
||||
void readyRead();
|
||||
void bytesWritten(int bytes);
|
||||
void inputClosed();
|
||||
void outputClosed();
|
||||
\param name the name of this log device
|
||||
\param parent the parent for this logger
|
||||
*/
|
||||
explicit AbstractLogDevice(const QString &name, QObject *parent = 0);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ConsoleReference)
|
||||
virtual ~AbstractLogDevice() = 0;
|
||||
|
||||
friend class ConsoleReferencePrivate;
|
||||
ConsoleReferencePrivate *d;
|
||||
private:
|
||||
Q_DISABLE_COPY(AbstractLogDevice)
|
||||
|
||||
friend class Console;
|
||||
};
|
||||
class Private;
|
||||
Private *d;
|
||||
|
||||
class QCA_EXPORT ConsolePrompt : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConsolePrompt(QObject *parent = 0);
|
||||
~ConsolePrompt();
|
||||
QString m_name;
|
||||
};
|
||||
|
||||
void getHidden(const QString &promptStr);
|
||||
void getEnter();
|
||||
void waitForFinished();
|
||||
|
||||
SecureArray result() const;
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ConsolePrompt)
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
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.
|
||||
|
||||
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).
|
||||
*/
|
||||
class QCA_EXPORT Logger : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
The severity of the message
|
||||
|
||||
This information may be used by the log device to determine
|
||||
what the appropriate action is.
|
||||
*/
|
||||
enum Severity
|
||||
{
|
||||
Quiet = 0, ///< Quiet: turn of logging
|
||||
Emergency = 1, ///< Emergency: system is unusable
|
||||
Alert = 2, ///< Alert: action must be taken immediately
|
||||
Critical = 3, ///< Critical: critical conditions
|
||||
Error = 4, ///< Error: error conditions
|
||||
Warning = 5, ///< Warning: warning conditions
|
||||
Notice = 6, ///< Notice: normal but significant condition
|
||||
Information = 7, ///< Informational: informational messages
|
||||
Debug = 8 ///< Debug: debug-level messages
|
||||
};
|
||||
|
||||
/**
|
||||
Get the current logging level
|
||||
|
||||
\return Current level
|
||||
*/
|
||||
inline Logger::Severity level () const {
|
||||
return m_logLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
Set the current logging level
|
||||
|
||||
\param level new logging level
|
||||
|
||||
Only severities less or equal than the log level one will be logged
|
||||
*/
|
||||
void setLevel (Logger::Severity level);
|
||||
|
||||
/**
|
||||
Log a message to all available log devices
|
||||
|
||||
\param message the text to log
|
||||
*/
|
||||
void logTextMessage(const QString &message, Severity = Information);
|
||||
|
||||
/**
|
||||
Log a binary blob to all available log devices
|
||||
|
||||
\param blob the information to log
|
||||
|
||||
\note how this is handled is quite logger specific. For
|
||||
example, it might be logged as a binary, or it might be
|
||||
encoded in some way
|
||||
*/
|
||||
void logBinaryMessage(const QByteArray &blob, Severity = Information);
|
||||
|
||||
/**
|
||||
Add an AbstractLogDevice subclass to the existing list of loggers
|
||||
|
||||
\param logger the LogDevice to add
|
||||
*/
|
||||
void registerLogDevice(AbstractLogDevice *logger);
|
||||
|
||||
/**
|
||||
Remove an AbstractLogDevice subclass from the existing list of loggers
|
||||
|
||||
\param loggerName the name of the LogDevice to remove
|
||||
|
||||
\note If there are several log devices with the same name, all will be removed.
|
||||
*/
|
||||
void unregisterLogDevice(const QString &loggerName);
|
||||
|
||||
/**
|
||||
Get a list of the names of all registered log devices
|
||||
*/
|
||||
QStringList currentLogDevices() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Logger)
|
||||
|
||||
friend class Global;
|
||||
|
||||
/**
|
||||
Create a new message logger
|
||||
*/
|
||||
Logger();
|
||||
|
||||
~Logger();
|
||||
|
||||
QStringList m_loggerNames;
|
||||
QList<AbstractLogDevice*> m_loggers;
|
||||
Severity m_logLevel;
|
||||
};
|
||||
|
||||
/**
|
||||
An abstract log device
|
||||
*/
|
||||
class QCA_EXPORT AbstractLogDevice : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
The name of this log device
|
||||
*/
|
||||
QString name() const;
|
||||
|
||||
/**
|
||||
Log a message
|
||||
|
||||
The default implementation does nothing - you should
|
||||
override this method in your subclass to do whatever
|
||||
logging is required
|
||||
*/
|
||||
virtual void logTextMessage( const QString &message, enum Logger::Severity severity );
|
||||
|
||||
/**
|
||||
Log a binary blob
|
||||
|
||||
The default implementation does nothing - you should
|
||||
override this method in your subclass to do whatever
|
||||
logging is required
|
||||
*/
|
||||
virtual void logBinaryMessage( const QByteArray &blob, Logger::Severity severity );
|
||||
|
||||
protected:
|
||||
/**
|
||||
Create a new message logger
|
||||
|
||||
\param name the name of this log device
|
||||
\param parent the parent for this logger
|
||||
*/
|
||||
explicit AbstractLogDevice(const QString &name, QObject *parent = 0);
|
||||
|
||||
virtual ~AbstractLogDevice() = 0;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(AbstractLogDevice)
|
||||
|
||||
class Private;
|
||||
Private *d;
|
||||
|
||||
QString m_name;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -34,260 +34,261 @@
|
||||
|
||||
#include "qca_core.h"
|
||||
|
||||
namespace QCA
|
||||
namespace QCA {
|
||||
|
||||
/**
|
||||
\class TextFilter qca_textfilter.h QtCrypto
|
||||
|
||||
Superclass for text based filtering algorithms
|
||||
|
||||
This differs from Filter in that it has the concept
|
||||
of an algorithm that works in two directions, and
|
||||
supports operations on QString arguments.
|
||||
*/
|
||||
class QCA_EXPORT TextFilter : public Filter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\class TextFilter qca_textfilter.h QtCrypto
|
||||
Standard constructor
|
||||
|
||||
Superclass for text based filtering algorithms
|
||||
|
||||
This differs from Filter in that it has the concept
|
||||
of an algorithm that works in two directions, and
|
||||
supports operations on QString arguments.
|
||||
\param dir the Direction that this TextFilter
|
||||
should use.
|
||||
*/
|
||||
class QCA_EXPORT TextFilter : public Filter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Standard constructor
|
||||
|
||||
\param dir the Direction that this TextFilter
|
||||
should use.
|
||||
*/
|
||||
TextFilter(Direction dir);
|
||||
|
||||
/**
|
||||
Reset the TextFilter
|
||||
|
||||
\param dir the Direction that this TextFilter
|
||||
should use.
|
||||
*/
|
||||
void setup(Direction dir);
|
||||
|
||||
/**
|
||||
Process an array in the "forward" direction,
|
||||
returning an array
|
||||
|
||||
This method runs in the forward direction, so
|
||||
for something like a Base64 encoding, it takes
|
||||
the "native" array, and returns that array
|
||||
encoded in base64.
|
||||
|
||||
\param a the array to encode
|
||||
*/
|
||||
SecureArray encode(const SecureArray &a);
|
||||
|
||||
/**
|
||||
Process an array in the "reverse" direction,
|
||||
returning an array
|
||||
|
||||
This method runs in the reverse direction, so
|
||||
for something like a Base64 encoding, it takes
|
||||
a Base64 encoded array, and returns the "native"
|
||||
representation..
|
||||
|
||||
\param a the array to decode
|
||||
*/
|
||||
SecureArray decode(const SecureArray &a);
|
||||
|
||||
/**
|
||||
Process an array in the "forward" direction,
|
||||
returning a QString
|
||||
|
||||
This is equivalent to encode(), except
|
||||
that it returns a QString, rather than a
|
||||
byte array.
|
||||
|
||||
\param a the array to encode
|
||||
*/
|
||||
QString arrayToString(const SecureArray &a);
|
||||
|
||||
/**
|
||||
Process an string in the "reverse" direction,
|
||||
returning a byte array
|
||||
|
||||
This is equivalent to decode(), except
|
||||
that it takes a QString, rather than a
|
||||
byte array.
|
||||
|
||||
\param s the array to decode
|
||||
*/
|
||||
SecureArray stringToArray(const QString &s);
|
||||
|
||||
/**
|
||||
Process a string in the "forward" direction,
|
||||
returning a string
|
||||
|
||||
This is equivalent to encode(), except
|
||||
that it takes and returns a QString, rather than
|
||||
byte arrays.
|
||||
|
||||
\param s the string to encode
|
||||
*/
|
||||
QString encodeString(const QString &s);
|
||||
|
||||
/**
|
||||
Process a string in the "reverse" direction,
|
||||
returning a string
|
||||
|
||||
This is equivalent to decode(), except
|
||||
that it takes and returns a QString, rather than
|
||||
byte arrays.
|
||||
|
||||
\param s the string to decode
|
||||
*/
|
||||
QString decodeString(const QString &s);
|
||||
|
||||
protected:
|
||||
/**
|
||||
Internal state variable for the Direction
|
||||
that the filter operates in
|
||||
*/
|
||||
Direction _dir;
|
||||
};
|
||||
TextFilter(Direction dir);
|
||||
|
||||
/**
|
||||
\class Hex qca_textfilter.h QtCrypto
|
||||
Reset the TextFilter
|
||||
|
||||
Hexadecimal encoding / decoding
|
||||
\param dir the Direction that this TextFilter
|
||||
should use.
|
||||
*/
|
||||
class QCA_EXPORT Hex : public TextFilter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Standard constructor
|
||||
|
||||
\param dir the Direction that should be used.
|
||||
|
||||
\note The direction can be changed using
|
||||
the setup() call.
|
||||
*/
|
||||
Hex(Direction dir = Encode);
|
||||
|
||||
/**
|
||||
Reset the internal state.
|
||||
|
||||
This is useful to reuse an existing Hex object
|
||||
*/
|
||||
virtual void clear();
|
||||
|
||||
/**
|
||||
Process more data, returning the corresponding
|
||||
encoded or decoded (depending on the Direction
|
||||
set in the constructor or setup() call) representation.
|
||||
|
||||
If you find yourself with code that only calls
|
||||
this method once, you might be better off using
|
||||
encode() or decode(). Similarly, if the data is
|
||||
really a string, you might be better off using
|
||||
arrayToString(), encodeString(), stringToArray()
|
||||
or decodeString().
|
||||
|
||||
\param a the array containing data to process
|
||||
*/
|
||||
virtual SecureArray update(const SecureArray &a);
|
||||
|
||||
/**
|
||||
Complete the algorithm
|
||||
|
||||
\return any remaining output. Because of the way
|
||||
hexadecimal encoding works, this will return a
|
||||
zero length array - any output will have been returned
|
||||
from the update() call.
|
||||
*/
|
||||
virtual SecureArray final();
|
||||
|
||||
/**
|
||||
Test if an update() or final() call succeeded.
|
||||
|
||||
\return true if the previous call succeeded
|
||||
*/
|
||||
virtual bool ok() const;
|
||||
|
||||
private:
|
||||
uchar val;
|
||||
bool partial;
|
||||
bool _ok;
|
||||
};
|
||||
void setup(Direction dir);
|
||||
|
||||
/**
|
||||
\class Base64 qca_textfilter.h QtCrypto
|
||||
Process an array in the "forward" direction,
|
||||
returning an array
|
||||
|
||||
%Base64 encoding / decoding
|
||||
This method runs in the forward direction, so
|
||||
for something like a Base64 encoding, it takes
|
||||
the "native" array, and returns that array
|
||||
encoded in base64.
|
||||
|
||||
\param a the array to encode
|
||||
*/
|
||||
class QCA_EXPORT Base64 : public TextFilter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Standard constructor
|
||||
SecureArray encode(const SecureArray &a);
|
||||
|
||||
\param dir the Direction that should be used.
|
||||
/**
|
||||
Process an array in the "reverse" direction,
|
||||
returning an array
|
||||
|
||||
\note The direction can be changed using
|
||||
the setup() call.
|
||||
*/
|
||||
Base64(Direction dir = Encode);
|
||||
This method runs in the reverse direction, so
|
||||
for something like a Base64 encoding, it takes
|
||||
a Base64 encoded array, and returns the "native"
|
||||
representation..
|
||||
|
||||
/**
|
||||
Sets line break mode. If enabled, linebreaks will be
|
||||
added to encoded output or accepted in encoded input.
|
||||
If disabled, linebreaks in encoded input will cause
|
||||
a failure to decode. The default is disabled.
|
||||
*/
|
||||
void setLineBreaksEnabled(bool b);
|
||||
\param a the array to decode
|
||||
*/
|
||||
SecureArray decode(const SecureArray &a);
|
||||
|
||||
/**
|
||||
Sets the column that linebreaks should be inserted at
|
||||
when encoding.
|
||||
*/
|
||||
void setLineBreaksColumn(int column);
|
||||
/**
|
||||
Process an array in the "forward" direction,
|
||||
returning a QString
|
||||
|
||||
/**
|
||||
Reset the internal state. This is useful to
|
||||
reuse an existing Base64 object
|
||||
*/
|
||||
virtual void clear();
|
||||
This is equivalent to encode(), except
|
||||
that it returns a QString, rather than a
|
||||
byte array.
|
||||
|
||||
/**
|
||||
Process more data, returning the corresponding
|
||||
encoded or decoded (depending on the Direction
|
||||
set in the constructor or setup() call) representation.
|
||||
\param a the array to encode
|
||||
*/
|
||||
QString arrayToString(const SecureArray &a);
|
||||
|
||||
If you find yourself with code that only calls
|
||||
this method once, you might be better off using
|
||||
encode() or decode(). Similarly, if the data is
|
||||
really a string, you might be better off using
|
||||
arrayToString(), encodeString(), stringToArray()
|
||||
or decodeString().
|
||||
/**
|
||||
Process an string in the "reverse" direction,
|
||||
returning a byte array
|
||||
|
||||
\param a the array containing data to process
|
||||
*/
|
||||
virtual SecureArray update(const SecureArray &a);
|
||||
This is equivalent to decode(), except
|
||||
that it takes a QString, rather than a
|
||||
byte array.
|
||||
|
||||
/**
|
||||
Complete the algorithm
|
||||
\param s the array to decode
|
||||
*/
|
||||
SecureArray stringToArray(const QString &s);
|
||||
|
||||
\return any remaining output. Because of the way
|
||||
Base64 encoding works, you will get either an
|
||||
empty array, or an array containing one or two
|
||||
"=" (equals, 0x3D) characters.
|
||||
*/
|
||||
virtual SecureArray final();
|
||||
/**
|
||||
Process a string in the "forward" direction,
|
||||
returning a string
|
||||
|
||||
/**
|
||||
Test if an update() or final() call succeeded.
|
||||
|
||||
\return true if the previous call succeeded
|
||||
*/
|
||||
virtual bool ok() const;
|
||||
This is equivalent to encode(), except
|
||||
that it takes and returns a QString, rather than
|
||||
byte arrays.
|
||||
|
||||
\param s the string to encode
|
||||
*/
|
||||
QString encodeString(const QString &s);
|
||||
|
||||
/**
|
||||
Process a string in the "reverse" direction,
|
||||
returning a string
|
||||
|
||||
This is equivalent to decode(), except
|
||||
that it takes and returns a QString, rather than
|
||||
byte arrays.
|
||||
|
||||
\param s the string to decode
|
||||
*/
|
||||
QString decodeString(const QString &s);
|
||||
|
||||
protected:
|
||||
/**
|
||||
Internal state variable for the Direction
|
||||
that the filter operates in
|
||||
*/
|
||||
Direction _dir;
|
||||
};
|
||||
|
||||
/**
|
||||
\class Hex qca_textfilter.h QtCrypto
|
||||
|
||||
Hexadecimal encoding / decoding
|
||||
*/
|
||||
class QCA_EXPORT Hex : public TextFilter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Standard constructor
|
||||
|
||||
\param dir the Direction that should be used.
|
||||
|
||||
\note The direction can be changed using
|
||||
the setup() call.
|
||||
*/
|
||||
Hex(Direction dir = Encode);
|
||||
|
||||
/**
|
||||
Reset the internal state.
|
||||
|
||||
This is useful to reuse an existing Hex object
|
||||
*/
|
||||
virtual void clear();
|
||||
|
||||
/**
|
||||
Process more data, returning the corresponding
|
||||
encoded or decoded (depending on the Direction
|
||||
set in the constructor or setup() call) representation.
|
||||
|
||||
If you find yourself with code that only calls
|
||||
this method once, you might be better off using
|
||||
encode() or decode(). Similarly, if the data is
|
||||
really a string, you might be better off using
|
||||
arrayToString(), encodeString(), stringToArray()
|
||||
or decodeString().
|
||||
|
||||
\param a the array containing data to process
|
||||
*/
|
||||
virtual SecureArray update(const SecureArray &a);
|
||||
|
||||
/**
|
||||
Complete the algorithm
|
||||
|
||||
\return any remaining output. Because of the way
|
||||
hexadecimal encoding works, this will return a
|
||||
zero length array - any output will have been returned
|
||||
from the update() call.
|
||||
*/
|
||||
virtual SecureArray final();
|
||||
|
||||
/**
|
||||
Test if an update() or final() call succeeded.
|
||||
|
||||
\return true if the previous call succeeded
|
||||
*/
|
||||
virtual bool ok() const;
|
||||
|
||||
private:
|
||||
uchar val;
|
||||
bool partial;
|
||||
bool _ok;
|
||||
};
|
||||
|
||||
/**
|
||||
\class Base64 qca_textfilter.h QtCrypto
|
||||
|
||||
%Base64 encoding / decoding
|
||||
*/
|
||||
class QCA_EXPORT Base64 : public TextFilter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Standard constructor
|
||||
|
||||
\param dir the Direction that should be used.
|
||||
|
||||
\note The direction can be changed using
|
||||
the setup() call.
|
||||
*/
|
||||
Base64(Direction dir = Encode);
|
||||
|
||||
/**
|
||||
Sets line break mode. If enabled, linebreaks will be
|
||||
added to encoded output or accepted in encoded input.
|
||||
If disabled, linebreaks in encoded input will cause
|
||||
a failure to decode. The default is disabled.
|
||||
*/
|
||||
void setLineBreaksEnabled(bool b);
|
||||
|
||||
/**
|
||||
Sets the column that linebreaks should be inserted at
|
||||
when encoding.
|
||||
*/
|
||||
void setLineBreaksColumn(int column);
|
||||
|
||||
/**
|
||||
Reset the internal state. This is useful to
|
||||
reuse an existing Base64 object
|
||||
*/
|
||||
virtual void clear();
|
||||
|
||||
/**
|
||||
Process more data, returning the corresponding
|
||||
encoded or decoded (depending on the Direction
|
||||
set in the constructor or setup() call) representation.
|
||||
|
||||
If you find yourself with code that only calls
|
||||
this method once, you might be better off using
|
||||
encode() or decode(). Similarly, if the data is
|
||||
really a string, you might be better off using
|
||||
arrayToString(), encodeString(), stringToArray()
|
||||
or decodeString().
|
||||
|
||||
\param a the array containing data to process
|
||||
*/
|
||||
virtual SecureArray update(const SecureArray &a);
|
||||
|
||||
/**
|
||||
Complete the algorithm
|
||||
|
||||
\return any remaining output. Because of the way
|
||||
Base64 encoding works, you will get either an
|
||||
empty array, or an array containing one or two
|
||||
"=" (equals, 0x3D) characters.
|
||||
*/
|
||||
virtual SecureArray final();
|
||||
|
||||
/**
|
||||
Test if an update() or final() call succeeded.
|
||||
|
||||
\return true if the previous call succeeded
|
||||
*/
|
||||
virtual bool ok() const;
|
||||
|
||||
private:
|
||||
SecureArray partial;
|
||||
bool _ok;
|
||||
int col;
|
||||
bool _lb_enabled;
|
||||
int _lb_column;
|
||||
};
|
||||
|
||||
private:
|
||||
SecureArray partial;
|
||||
bool _ok;
|
||||
int col;
|
||||
bool _lb_enabled;
|
||||
int _lb_column;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -75,212 +75,206 @@ QCA_EXPORT void *qca_secure_realloc(void *p, int bytes);
|
||||
namespace QCA {
|
||||
|
||||
/**
|
||||
\class SecureArray qca_tools.h QtCrypto
|
||||
\class SecureArray qca_tools.h QtCrypto
|
||||
|
||||
Secure array of bytes
|
||||
Secure array of bytes
|
||||
|
||||
The %SecureArray provides an array of memory from a pool that is,
|
||||
at least partly, secure. In this sense, secure means that the contents
|
||||
of the memory should not be made available to other applications. By
|
||||
comparison, a QMemArray (or subclass such as QCString or QByteArray) may
|
||||
be held in pages that might be swapped to disk or free'd without being
|
||||
cleared first.
|
||||
|
||||
Note that this class is implicitly shared (that is, copy on write).
|
||||
**/
|
||||
The %SecureArray provides an array of memory from a pool that is,
|
||||
at least partly, secure. In this sense, secure means that the contents
|
||||
of the memory should not be made available to other applications. By
|
||||
comparison, a QMemArray (or subclass such as QCString or QByteArray) may
|
||||
be held in pages that might be swapped to disk or free'd without being
|
||||
cleared first.
|
||||
|
||||
Note that this class is implicitly shared (that is, copy on write).
|
||||
*/
|
||||
class QCA_EXPORT SecureArray
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct a secure byte array, zero length
|
||||
*/
|
||||
Construct a secure byte array, zero length
|
||||
*/
|
||||
SecureArray();
|
||||
|
||||
/**
|
||||
* Construct a secure byte array of the specified length
|
||||
*
|
||||
* \param size the number of bytes in the array
|
||||
* \param ch the value every byte should be set to
|
||||
*/
|
||||
Construct a secure byte array of the specified length
|
||||
|
||||
\param size the number of bytes in the array
|
||||
\param ch the value every byte should be set to
|
||||
*/
|
||||
explicit SecureArray(int size, char ch = 0);
|
||||
|
||||
/**
|
||||
* Construct a secure byte array from a string
|
||||
*
|
||||
* Note that this copies, rather than references the source array
|
||||
*/
|
||||
Construct a secure byte array from a string
|
||||
|
||||
Note that this copies, rather than references the source array
|
||||
*/
|
||||
SecureArray(const char *str);
|
||||
|
||||
/**
|
||||
* Construct a secure byte array from a QByteArray
|
||||
*
|
||||
* Note that this copies, rather than references the source array
|
||||
*
|
||||
* \sa operator=()
|
||||
*/
|
||||
Construct a secure byte array from a QByteArray
|
||||
|
||||
Note that this copies, rather than references the source array
|
||||
|
||||
\sa operator=()
|
||||
*/
|
||||
SecureArray(const QByteArray &a);
|
||||
|
||||
/**
|
||||
* Construct a (shallow) copy of another secure byte array
|
||||
*
|
||||
* \param from the source of the data and length.
|
||||
*/
|
||||
Construct a (shallow) copy of another secure byte array
|
||||
|
||||
\param from the source of the data and length.
|
||||
*/
|
||||
SecureArray(const SecureArray &from);
|
||||
|
||||
~SecureArray();
|
||||
|
||||
/**
|
||||
* Creates a reference, rather than a deep copy.
|
||||
* if you want a deep copy then you should use copy()
|
||||
* instead, or use operator=(), then call detach() when required.
|
||||
*/
|
||||
/**
|
||||
Creates a reference, rather than a deep copy.
|
||||
*/
|
||||
SecureArray & operator=(const SecureArray &from);
|
||||
|
||||
/**
|
||||
* Creates a copy, rather than references
|
||||
*
|
||||
* \param a the array to copy from
|
||||
*/
|
||||
Creates a copy, rather than references
|
||||
|
||||
\param a the array to copy from
|
||||
*/
|
||||
SecureArray & operator=(const QByteArray &a);
|
||||
|
||||
/**
|
||||
* Clears the contents of the array and makes it empty
|
||||
*/
|
||||
Clears the contents of the array and makes it empty
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Returns a reference to the byte at the index position
|
||||
*
|
||||
* \param index the zero-based offset to obtain
|
||||
*/
|
||||
Returns a reference to the byte at the index position
|
||||
|
||||
\param index the zero-based offset to obtain
|
||||
*/
|
||||
char & operator[](int index);
|
||||
|
||||
/**
|
||||
* Returns a reference to the byte at the index position
|
||||
*
|
||||
* \param index the zero-based offset to obtain
|
||||
*/
|
||||
Returns a reference to the byte at the index position
|
||||
|
||||
\param index the zero-based offset to obtain
|
||||
*/
|
||||
const char & operator[](int index) const;
|
||||
|
||||
/**
|
||||
* Pointer to the data in the secure array
|
||||
*
|
||||
* You can use this for memcpy and similar functions. If you are trying
|
||||
* to obtain data at a particular offset, you might be better off using
|
||||
* at() or operator[]
|
||||
*
|
||||
*/
|
||||
Pointer to the data in the secure array
|
||||
|
||||
You can use this for memcpy and similar functions. If you are trying
|
||||
to obtain data at a particular offset, you might be better off using
|
||||
at() or operator[]
|
||||
*/
|
||||
char *data();
|
||||
|
||||
/**
|
||||
* Pointer to the data in the secure array
|
||||
*
|
||||
* You can use this for memcpy and similar functions. If you are trying
|
||||
* to obtain data at a particular offset, you might be better off using
|
||||
* at() or operator[]
|
||||
*
|
||||
*/
|
||||
Pointer to the data in the secure array
|
||||
|
||||
You can use this for memcpy and similar functions. If you are trying
|
||||
to obtain data at a particular offset, you might be better off using
|
||||
at() or operator[]
|
||||
*/
|
||||
const char *data() const;
|
||||
|
||||
/**
|
||||
* Pointer to the data in the secure array
|
||||
*
|
||||
* You can use this for memcpy and similar functions. If you are trying
|
||||
* to obtain data at a particular offset, you might be better off using
|
||||
* at() or operator[]
|
||||
*
|
||||
*/
|
||||
Pointer to the data in the secure array
|
||||
|
||||
You can use this for memcpy and similar functions. If you are trying
|
||||
to obtain data at a particular offset, you might be better off using
|
||||
at() or operator[]
|
||||
*/
|
||||
const char *constData() const;
|
||||
|
||||
/**
|
||||
* Returns a reference to the byte at the index position
|
||||
*
|
||||
* \param index the zero-based offset to obtain
|
||||
*/
|
||||
Returns a reference to the byte at the index position
|
||||
|
||||
\param index the zero-based offset to obtain
|
||||
*/
|
||||
char & at(int index);
|
||||
|
||||
/**
|
||||
* Returns a reference to the byte at the index position
|
||||
*
|
||||
* \param index the zero-based offset to obtain
|
||||
*/
|
||||
Returns a reference to the byte at the index position
|
||||
|
||||
\param index the zero-based offset to obtain
|
||||
*/
|
||||
const char & at(int index) const;
|
||||
|
||||
/**
|
||||
* Returns the number of bytes in the array
|
||||
*/
|
||||
Returns the number of bytes in the array
|
||||
*/
|
||||
int size() const;
|
||||
|
||||
/**
|
||||
* Test if the array contains any bytes.
|
||||
*
|
||||
* This is equivalent to testing (size() != 0). Note that if
|
||||
* the array is allocated, isEmpty() is false (even if no data
|
||||
* has been added)
|
||||
*
|
||||
* \return true if the array has zero length, otherwise false
|
||||
*/
|
||||
Test if the array contains any bytes.
|
||||
|
||||
This is equivalent to testing (size() != 0). Note that if
|
||||
the array is allocated, isEmpty() is false (even if no data
|
||||
has been added)
|
||||
|
||||
\return true if the array has zero length, otherwise false
|
||||
*/
|
||||
bool isEmpty() const;
|
||||
|
||||
/**
|
||||
* Change the length of this array
|
||||
* If the new length is less than the old length, the extra information
|
||||
* is (safely) discarded. If the new length is equal to or greater than
|
||||
* the old length, the existing data is copied into the array.
|
||||
*
|
||||
* \param size the new length
|
||||
*/
|
||||
Change the length of this array
|
||||
If the new length is less than the old length, the extra information
|
||||
is (safely) discarded. If the new length is equal to or greater than
|
||||
the old length, the existing data is copied into the array.
|
||||
|
||||
\param size the new length
|
||||
*/
|
||||
bool resize(int size);
|
||||
|
||||
/**
|
||||
* Fill the data array with a specified character
|
||||
*
|
||||
* \param fillChar the character to use as the fill
|
||||
* \param fillToPosition the number of characters to fill
|
||||
* to. If not specified (or -1), fills array to
|
||||
* current length.
|
||||
*
|
||||
* \note This function does not extend the array - if
|
||||
* you ask for fill beyond the current length, only
|
||||
* the current length will be used.
|
||||
* \note The number of characters is 1 based, so if
|
||||
* you ask for fill('x', 10), it will fill from
|
||||
*
|
||||
*/
|
||||
/**
|
||||
Fill the data array with a specified character
|
||||
|
||||
\param fillChar the character to use as the fill
|
||||
\param fillToPosition the number of characters to fill
|
||||
to. If not specified (or -1), fills array to
|
||||
current length.
|
||||
|
||||
\note This function does not extend the array - if
|
||||
you ask for fill beyond the current length, only
|
||||
the current length will be used.
|
||||
\note The number of characters is 1 based, so if
|
||||
you ask for fill('x', 10), it will fill from
|
||||
*/
|
||||
void fill(char fillChar, int fillToPosition = -1);
|
||||
|
||||
/**
|
||||
* Copy the contents of the secure array out to a
|
||||
* standard QByteArray. Note that this performs a deep copy
|
||||
* of the data.
|
||||
*/
|
||||
Copy the contents of the secure array out to a
|
||||
standard QByteArray. Note that this performs a deep copy
|
||||
of the data.
|
||||
*/
|
||||
QByteArray toByteArray() const;
|
||||
|
||||
/**
|
||||
* Append a secure byte array to the end of this array
|
||||
*/
|
||||
Append a secure byte array to the end of this array
|
||||
*/
|
||||
SecureArray & append(const SecureArray &a);
|
||||
|
||||
/**
|
||||
* Append a secure byte array to the end of this array
|
||||
*/
|
||||
Append a secure byte array to the end of this array
|
||||
*/
|
||||
SecureArray & operator+=(const SecureArray &a);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Assign the contents of a provided byte array to this
|
||||
* object.
|
||||
*
|
||||
* \param from the byte array to copy
|
||||
*/
|
||||
Assign the contents of a provided byte array to this
|
||||
object.
|
||||
|
||||
\param from the byte array to copy
|
||||
*/
|
||||
void set(const SecureArray &from);
|
||||
|
||||
/**
|
||||
* Assign the contents of a provided byte array to this
|
||||
* object.
|
||||
*
|
||||
* \param from the byte array to copy
|
||||
*/
|
||||
Assign the contents of a provided byte array to this
|
||||
object.
|
||||
|
||||
\param from the byte array to copy
|
||||
*/
|
||||
void set(const QByteArray &from);
|
||||
|
||||
private:
|
||||
@ -289,27 +283,27 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* Equality operator. Returns true if the two SecureArray
|
||||
* arguments have the same data (and the same length, of course).
|
||||
*
|
||||
* \relates SecureArray
|
||||
**/
|
||||
Equality operator. Returns true if the two SecureArray
|
||||
arguments have the same data (and the same length, of course).
|
||||
|
||||
\relates SecureArray
|
||||
*/
|
||||
QCA_EXPORT bool operator==(const SecureArray &a, const SecureArray &b);
|
||||
|
||||
/**
|
||||
* Inequality operator. Returns true if the two SecureArray
|
||||
* arguments have different length, or the same length but
|
||||
* different data
|
||||
*
|
||||
* \relates SecureArray
|
||||
**/
|
||||
Inequality operator. Returns true if the two SecureArray
|
||||
arguments have different length, or the same length but
|
||||
different data
|
||||
|
||||
\relates SecureArray
|
||||
*/
|
||||
QCA_EXPORT bool operator!=(const SecureArray &a, const SecureArray &b);
|
||||
|
||||
/**
|
||||
* Returns an array that is the result of concatenating a and b
|
||||
*
|
||||
* \relates SecureArray
|
||||
**/
|
||||
Returns an array that is the result of concatenating a and b
|
||||
|
||||
\relates SecureArray
|
||||
*/
|
||||
QCA_EXPORT const SecureArray operator+(const SecureArray &a, const SecureArray &b);
|
||||
|
||||
/**
|
||||
@ -319,184 +313,183 @@ QCA_EXPORT const SecureArray operator+(const SecureArray &a, const SecureArray &
|
||||
|
||||
BigInteger provides arbitrary precision integers.
|
||||
\code
|
||||
if ( BigInteger("3499543804349") ==
|
||||
BigInteger("38493290803248") + BigInteger( 343 ) )
|
||||
{
|
||||
// do something
|
||||
}
|
||||
if ( BigInteger("3499543804349") ==
|
||||
BigInteger("38493290803248") + BigInteger( 343 ) )
|
||||
{
|
||||
// do something
|
||||
}
|
||||
\endcode
|
||||
**/
|
||||
*/
|
||||
class QCA_EXPORT BigInteger
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor. Creates a new BigInteger, initialised to zero.
|
||||
*/
|
||||
Constructor. Creates a new BigInteger, initialised to zero.
|
||||
*/
|
||||
BigInteger();
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*
|
||||
* \param n an alternative integer initialisation value.
|
||||
*/
|
||||
\overload
|
||||
|
||||
\param n an alternative integer initialisation value.
|
||||
*/
|
||||
BigInteger(int n);
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*
|
||||
* \param c an alternative initialisation value, encoded as a character array
|
||||
*
|
||||
* \code
|
||||
* BigInteger b ( "9890343" );
|
||||
* \endcode
|
||||
*/
|
||||
\overload
|
||||
|
||||
\param c an alternative initialisation value, encoded as a character array
|
||||
|
||||
\code
|
||||
BigInteger b ( "9890343" );
|
||||
\endcode
|
||||
*/
|
||||
BigInteger(const char *c);
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*
|
||||
* \param s an alternative initialisation value, encoded as a string
|
||||
*/
|
||||
\overload
|
||||
|
||||
\param s an alternative initialisation value, encoded as a string
|
||||
*/
|
||||
BigInteger(const QString &s);
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*
|
||||
* \param a an alternative initialisation value, encoded as SecureArray
|
||||
*/
|
||||
\overload
|
||||
|
||||
\param a an alternative initialisation value, encoded as SecureArray
|
||||
*/
|
||||
BigInteger(const QCA::SecureArray &a);
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*
|
||||
* \param from an alternative initialisation value, encoded as a %BigInteger
|
||||
*/
|
||||
\overload
|
||||
|
||||
\param from an alternative initialisation value, encoded as a %BigInteger
|
||||
*/
|
||||
BigInteger(const BigInteger &from);
|
||||
|
||||
~BigInteger();
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
*
|
||||
* \param from the BigInteger to copy from
|
||||
*
|
||||
* \code
|
||||
* BigInteger a; // a is zero
|
||||
* BigInteger b( 500 );
|
||||
* a = b; // a is now 500
|
||||
* \endcode
|
||||
*/
|
||||
Assignment operator
|
||||
|
||||
\param from the BigInteger to copy from
|
||||
|
||||
\code
|
||||
BigInteger a; // a is zero
|
||||
BigInteger b( 500 );
|
||||
a = b; // a is now 500
|
||||
\endcode
|
||||
*/
|
||||
BigInteger & operator=(const BigInteger &from);
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*
|
||||
* \param s the QString containing an integer representation
|
||||
*
|
||||
* \sa bool fromString(const QString &s)
|
||||
*
|
||||
* \note it is the application's responsibility to make sure
|
||||
* that the QString represents a valid integer (ie it only
|
||||
* contains numbers and an optional minus sign at the start)
|
||||
*
|
||||
**/
|
||||
\overload
|
||||
|
||||
\param s the QString containing an integer representation
|
||||
|
||||
\sa bool fromString(const QString &s)
|
||||
|
||||
\note it is the application's responsibility to make sure
|
||||
that the QString represents a valid integer (ie it only
|
||||
contains numbers and an optional minus sign at the start)
|
||||
*/
|
||||
BigInteger & operator=(const QString &s);
|
||||
|
||||
/**
|
||||
* Increment in place operator
|
||||
*
|
||||
* \param b the amount to increment by
|
||||
*
|
||||
* \code
|
||||
* BigInteger a; // a is zero
|
||||
* BigInteger b( 500 );
|
||||
* a += b; // a is now 500
|
||||
* a += b; // a is now 1000
|
||||
* \endcode
|
||||
**/
|
||||
Increment in place operator
|
||||
|
||||
\param b the amount to increment by
|
||||
|
||||
\code
|
||||
BigInteger a; // a is zero
|
||||
BigInteger b( 500 );
|
||||
a += b; // a is now 500
|
||||
a += b; // a is now 1000
|
||||
\endcode
|
||||
*/
|
||||
BigInteger & operator+=(const BigInteger &b);
|
||||
|
||||
/**
|
||||
* Decrement in place operator
|
||||
*
|
||||
* \param b the amount to decrement by
|
||||
*
|
||||
* \code
|
||||
* BigInteger a; // a is zero
|
||||
* BigInteger b( 500 );
|
||||
* a -= b; // a is now -500
|
||||
* a -= b; // a is now -1000
|
||||
* \endcode
|
||||
**/
|
||||
Decrement in place operator
|
||||
|
||||
\param b the amount to decrement by
|
||||
|
||||
\code
|
||||
BigInteger a; // a is zero
|
||||
BigInteger b( 500 );
|
||||
a -= b; // a is now -500
|
||||
a -= b; // a is now -1000
|
||||
\endcode
|
||||
*/
|
||||
BigInteger & operator-=(const BigInteger &b);
|
||||
|
||||
/**
|
||||
* Output %BigInteger as a byte array, useful for storage or
|
||||
* transmission. The format is a binary integer in sign-extended
|
||||
* network-byte-order.
|
||||
*
|
||||
* \sa void fromArray(const SecureArray &a);
|
||||
*/
|
||||
/**
|
||||
Output %BigInteger as a byte array, useful for storage or
|
||||
transmission. The format is a binary integer in sign-extended
|
||||
network-byte-order.
|
||||
|
||||
\sa void fromArray(const SecureArray &a);
|
||||
*/
|
||||
QCA::SecureArray toArray() const;
|
||||
|
||||
/**
|
||||
* Assign from an array. The input is expected to be a binary integer
|
||||
* in sign-extended network-byte-order.
|
||||
*
|
||||
* \param a a SecureArray that represents an integer
|
||||
*
|
||||
* \sa BigInteger(const SecureArray &a);
|
||||
* \sa SecureArray toArray() const;
|
||||
*/
|
||||
Assign from an array. The input is expected to be a binary integer
|
||||
in sign-extended network-byte-order.
|
||||
|
||||
\param a a SecureArray that represents an integer
|
||||
|
||||
\sa BigInteger(const SecureArray &a);
|
||||
\sa SecureArray toArray() const;
|
||||
*/
|
||||
void fromArray(const QCA::SecureArray &a);
|
||||
|
||||
/**
|
||||
* Convert %BigInteger to a QString
|
||||
*
|
||||
* \code
|
||||
* QString aString;
|
||||
* BigInteger aBiggishInteger( 5878990 );
|
||||
* aString = aBiggishInteger.toString(); // aString is now "5878990"
|
||||
* \endcode
|
||||
*/
|
||||
/**
|
||||
Convert %BigInteger to a QString
|
||||
|
||||
\code
|
||||
QString aString;
|
||||
BigInteger aBiggishInteger( 5878990 );
|
||||
aString = aBiggishInteger.toString(); // aString is now "5878990"
|
||||
\endcode
|
||||
*/
|
||||
QString toString() const;
|
||||
|
||||
/**
|
||||
* Assign from a QString
|
||||
*
|
||||
* \param s a QString that represents an integer
|
||||
*
|
||||
* \note it is the application's responsibility to make sure
|
||||
* that the QString represents a valid integer (ie it only
|
||||
* contains numbers and an optional minus sign at the start)
|
||||
*
|
||||
* \sa BigInteger(const QString &s)
|
||||
* \sa BigInteger & operator=(const QString &s)
|
||||
*/
|
||||
Assign from a QString
|
||||
|
||||
\param s a QString that represents an integer
|
||||
|
||||
\note it is the application's responsibility to make sure
|
||||
that the QString represents a valid integer (ie it only
|
||||
contains numbers and an optional minus sign at the start)
|
||||
|
||||
\sa BigInteger(const QString &s)
|
||||
\sa BigInteger & operator=(const QString &s)
|
||||
*/
|
||||
bool fromString(const QString &s);
|
||||
|
||||
/**
|
||||
* Compare this value with another %BigInteger
|
||||
*
|
||||
* Normally it is more readable to use one of the operator overloads,
|
||||
* so you don't need to use this method directly.
|
||||
*
|
||||
* \param n the BigInteger to compare with
|
||||
*
|
||||
* \return zero if the values are the same, negative if the argument
|
||||
* is less than the value of this BigInteger, and positive if the argument
|
||||
* value is greater than this BigInteger
|
||||
*
|
||||
* \code
|
||||
* BigInteger a( "400" );
|
||||
* BigInteger b( "-400" );
|
||||
* BigInteger c( " 200 " );
|
||||
* int result;
|
||||
* result = a.compare( b ); // return positive 400 > -400
|
||||
* result = a.compare( c ); // return positive, 400 > 200
|
||||
* result = b.compare( c ); // return negative, -400 < 200
|
||||
* \endcode
|
||||
**/
|
||||
/**
|
||||
Compare this value with another %BigInteger
|
||||
|
||||
Normally it is more readable to use one of the operator overloads,
|
||||
so you don't need to use this method directly.
|
||||
|
||||
\param n the BigInteger to compare with
|
||||
|
||||
\return zero if the values are the same, negative if the argument
|
||||
is less than the value of this BigInteger, and positive if the argument
|
||||
value is greater than this BigInteger
|
||||
|
||||
\code
|
||||
BigInteger a( "400" );
|
||||
BigInteger b( "-400" );
|
||||
BigInteger c( " 200 " );
|
||||
int result;
|
||||
result = a.compare( b ); // return positive 400 > -400
|
||||
result = a.compare( c ); // return positive, 400 > 200
|
||||
result = b.compare( c ); // return negative, -400 < 200
|
||||
\endcode
|
||||
*/
|
||||
int compare(const BigInteger &n) const;
|
||||
|
||||
private:
|
||||
@ -505,80 +498,80 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* Equality operator. Returns true if the two BigInteger values
|
||||
* are the same, including having the same sign.
|
||||
*
|
||||
* \relates BigInteger
|
||||
**/
|
||||
Equality operator. Returns true if the two BigInteger values
|
||||
are the same, including having the same sign
|
||||
|
||||
\relates BigInteger
|
||||
*/
|
||||
inline bool operator==(const BigInteger &a, const BigInteger &b)
|
||||
{
|
||||
return (0 == a.compare( b ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Inequality operator. Returns true if the two BigInteger values
|
||||
* are different in magnitude, sign or both
|
||||
*
|
||||
* \relates BigInteger
|
||||
**/
|
||||
Inequality operator. Returns true if the two BigInteger values
|
||||
are different in magnitude, sign or both
|
||||
|
||||
\relates BigInteger
|
||||
*/
|
||||
inline bool operator!=(const BigInteger &a, const BigInteger &b)
|
||||
{
|
||||
return (0 != a.compare( b ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Less than or equal operator. Returns true if the BigInteger value
|
||||
* on the left hand side is equal to or less than the BigInteger value
|
||||
* on the right hand side.
|
||||
*
|
||||
* \relates BigInteger
|
||||
**/
|
||||
Less than or equal operator. Returns true if the BigInteger value
|
||||
on the left hand side is equal to or less than the BigInteger value
|
||||
on the right hand side.
|
||||
|
||||
\relates BigInteger
|
||||
*/
|
||||
inline bool operator<=(const BigInteger &a, const BigInteger &b)
|
||||
{
|
||||
return (a.compare( b ) <= 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater than or equal operator. Returns true if the BigInteger value
|
||||
* on the left hand side is equal to or greater than the BigInteger value
|
||||
* on the right hand side.
|
||||
*
|
||||
* \relates BigInteger
|
||||
**/
|
||||
Greater than or equal operator. Returns true if the BigInteger value
|
||||
on the left hand side is equal to or greater than the BigInteger value
|
||||
on the right hand side.
|
||||
|
||||
\relates BigInteger
|
||||
*/
|
||||
inline bool operator>=(const BigInteger &a, const BigInteger &b)
|
||||
{
|
||||
return (a.compare( b ) >= 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Less than operator. Returns true if the BigInteger value
|
||||
* on the left hand side is less than the BigInteger value
|
||||
* on the right hand side.
|
||||
*
|
||||
* \relates BigInteger
|
||||
**/
|
||||
Less than operator. Returns true if the BigInteger value
|
||||
on the left hand side is less than the BigInteger value
|
||||
on the right hand side.
|
||||
|
||||
\relates BigInteger
|
||||
*/
|
||||
inline bool operator<(const BigInteger &a, const BigInteger &b)
|
||||
{
|
||||
return (a.compare( b ) < 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater than operator. Returns true if the BigInteger value
|
||||
* on the left hand side is greater than the BigInteger value
|
||||
* on the right hand side.
|
||||
*
|
||||
* \relates BigInteger
|
||||
**/
|
||||
Greater than operator. Returns true if the BigInteger value
|
||||
on the left hand side is greater than the BigInteger value
|
||||
on the right hand side.
|
||||
|
||||
\relates BigInteger
|
||||
*/
|
||||
inline bool operator>(const BigInteger &a, const BigInteger &b)
|
||||
{
|
||||
return (a.compare( b ) > 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream operator.
|
||||
*
|
||||
* \relates BigInteger
|
||||
**/
|
||||
Stream operator
|
||||
|
||||
\relates BigInteger
|
||||
*/
|
||||
QCA_EXPORT QTextStream &operator<<(QTextStream &stream, const BigInteger &b);
|
||||
|
||||
}
|
||||
|
@ -27,45 +27,46 @@
|
||||
#include "qca_core.h"
|
||||
#include <QMutex>
|
||||
|
||||
namespace QCA
|
||||
namespace QCA {
|
||||
|
||||
class ProviderItem;
|
||||
|
||||
class ProviderManager
|
||||
{
|
||||
class ProviderItem;
|
||||
public:
|
||||
ProviderManager();
|
||||
~ProviderManager();
|
||||
|
||||
class ProviderManager
|
||||
{
|
||||
public:
|
||||
ProviderManager();
|
||||
~ProviderManager();
|
||||
void scan();
|
||||
bool add(Provider *p, int priority);
|
||||
void unload(const QString &name);
|
||||
void unloadAll();
|
||||
void setDefault(Provider *p);
|
||||
Provider *find(Provider *p) const;
|
||||
Provider *find(const QString &name) const;
|
||||
Provider *findFor(const QString &name, const QString &type) const;
|
||||
void changePriority(const QString &name, int priority);
|
||||
int getPriority(const QString &name);
|
||||
QStringList allFeatures() const;
|
||||
ProviderList providers() const;
|
||||
|
||||
void scan();
|
||||
bool add(Provider *p, int priority);
|
||||
void unload(const QString &name);
|
||||
void unloadAll();
|
||||
void setDefault(Provider *p);
|
||||
Provider *find(Provider *p) const;
|
||||
Provider *find(const QString &name) const;
|
||||
Provider *findFor(const QString &name, const QString &type) const;
|
||||
void changePriority(const QString &name, int priority);
|
||||
int getPriority(const QString &name);
|
||||
QStringList allFeatures() const;
|
||||
ProviderList providers() const;
|
||||
static void mergeFeatures(QStringList *a, const QStringList &b);
|
||||
|
||||
static void mergeFeatures(QStringList *a, const QStringList &b);
|
||||
QString diagnosticText() const;
|
||||
void appendDiagnosticText(const QString &str);
|
||||
void clearDiagnosticText();
|
||||
|
||||
QString diagnosticText() const;
|
||||
void appendDiagnosticText(const QString &str);
|
||||
void clearDiagnosticText();
|
||||
private:
|
||||
mutable QMutex logMutex, providerMutex;
|
||||
QString dtext;
|
||||
QList<ProviderItem*> providerItemList;
|
||||
ProviderList providerList;
|
||||
Provider *def;
|
||||
bool scanned_static;
|
||||
void addItem(ProviderItem *i, int priority);
|
||||
bool haveAlready(const QString &name) const;
|
||||
};
|
||||
|
||||
private:
|
||||
mutable QMutex logMutex, providerMutex;
|
||||
QString dtext;
|
||||
QList<ProviderItem*> providerItemList;
|
||||
ProviderList providerList;
|
||||
Provider *def;
|
||||
bool scanned_static;
|
||||
void addItem(ProviderItem *i, int priority);
|
||||
bool haveAlready(const QString &name) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -25,10 +25,11 @@
|
||||
|
||||
#include "qca_cert.h"
|
||||
|
||||
namespace QCA
|
||||
{
|
||||
bool qca_have_systemstore();
|
||||
CertificateCollection qca_get_systemstore(const QString &provider);
|
||||
namespace QCA {
|
||||
|
||||
bool qca_have_systemstore();
|
||||
CertificateCollection qca_get_systemstore(const QString &provider);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user