qca
QCA::Provider Class Reference
[QCA provider API]
#include <QtCrypto>

Classes | |
| class | Context |
| Internal context class used for the plugin. More... | |
Public Member Functions | |
| virtual | ~Context () |
| virtual | ~Provider () |
| virtual Context * | clone () const =0 |
| virtual void | configChanged (const QVariantMap &config) |
| virtual Context * | createContext (const QString &type)=0 |
| virtual QString | credit () const |
| virtual QVariantMap | defaultConfig () const |
| virtual void | deinit () |
| virtual QStringList | features () const =0 |
| virtual void | init () |
| virtual QString | name () const =0 |
| Provider * | provider () const |
| virtual int | qcaVersion () const =0 |
| bool | sameProvider (const Context *c) const |
| QString | type () const |
| virtual int | version () const |
Protected Member Functions | |
| Context (const Context &from) | |
| Context (Provider *parent, const QString &type) | |
Detailed Description
Algorithm provider.
Provider represents a plugin provider (or as a special case, the built-in provider). This is the class you need to inherit from to create your own plugin. You don't normally need to worry about this class if you are just using existing QCA capabilities and plugins, however there is nothing stopping you from using it to obtain information about specific plugins, as shown in the example below.
Definition at line 668 of file qca_core.h.
Constructor & Destructor Documentation
| QCA::Provider::~Provider | ( | ) | [virtual] |
Definition at line 836 of file qca_core.cpp.
| virtual QCA::Provider::~Context | ( | ) | [virtual] |
Member Function Documentation
| void QCA::Provider::configChanged | ( | const QVariantMap & | config | ) | [virtual] |
Method to set the configuration options.
If your provider supports configuration options, you will be advised of user changes to the configuration when this method is called.
- Parameters:
-
config the new configuration to be used by the provider
Definition at line 863 of file qca_core.cpp.
| QCA::Provider::Context | ( | const Context & | from | ) | [protected] |
Copy constructor.
- Parameters:
-
from the Context to copy from
| QCA::Provider::Context | ( | Provider * | parent, | |
| const QString & | type | |||
| ) | [protected] |
Standard constructor.
- Parameters:
-
parent the parent provider for this context type the name of the provider context type
Routine to create a plugin context.
You need to return a pointer to an algorithm Context that corresponds with the algorithm name specified.
- Parameters:
-
type the name of the algorithm required
Context *createContext(const QString &type) { if ( type == "sha1" ) return new SHA1Context( this ); else if ( type == "sha256" ) return new SHA0256Context( this ); else if ( type == "hmac(sha1)" ) return new HMACSHA1Context( this ); else return 0; }
Naturally you also need to implement the specified Context subclasses as well.
| QString QCA::Provider::credit | ( | ) | const [virtual] |
Optional credit text for the provider.
You might display this information in a credits or "About" dialog. Returns an empty string if the provider has no credit text. Only report credit text when absolutely required (for example, an "advertisement clause" related to licensing). Do not use it for reporting general author information.
Definition at line 853 of file qca_core.cpp.
| QVariantMap QCA::Provider::defaultConfig | ( | ) | const [virtual] |
Method to set up the default configuration options.
If your provider needs some configuration options, this method allows you to establish default options. The user can then change the configuration options as required, and set them using configChanged().
You need to return a QVariantMap that has configuration options as the keys, and the default configuration as the values, as shown below:
QVariantMap defaultConfig() const { QVariantMap myConfig; myConfig[ "firstOption" ] = QString("firstOptionValue"); myConfig[ "secondOption" ] = true; myConfig[ "thirdOpt" ] = 1243; return myConfig; }
- See also:
- configChanged for how to set the configuration;
Definition at line 858 of file qca_core.cpp.
| void QCA::Provider::deinit | ( | ) | [virtual] |
Deinitialisation routine.
This routine will be called just before provider destruction. Notably, during QCA shutdown, deinit() will be called on all providers before any of the providers are destructed. Use this opportunity to free any resources that may be used by other providers.
Definition at line 844 of file qca_core.cpp.
| virtual QStringList QCA::Provider::features | ( | ) | const [pure virtual] |
The capabilities (algorithms) of the provider.
Typically you just return a fixed QStringList:
QStringList features() const { QStringList list; list += "sha1"; list += "sha256"; list += "hmac(sha1)"; return list; }
| void QCA::Provider::init | ( | ) | [virtual] |
Initialisation routine.
This routine will be called when your plugin is loaded, so this is a good place to do any one-off initialisation tasks. If you don't need any initialisation, just implement it as an empty routine.
Definition at line 840 of file qca_core.cpp.
| virtual QString QCA::Provider::name | ( | ) | const [pure virtual] |
| virtual int QCA::Provider::qcaVersion | ( | ) | const [pure virtual] |
Target QCA version for the provider.
This is used to verify compatibility between the provider and QCA. For a provider to be used, it must supply major and minor version numbers here that are less-than or equal to the actual QCA version (the patch version number is ignored). This means an older provider may be used with a newer QCA, but a newer provider cannot be used with an older QCA.
| bool QCA::Provider::sameProvider | ( | const Context * | c | ) | const |
| QString QCA::Provider::type | ( | ) | const |
The type of context, as passed to the constructor.
| int QCA::Provider::version | ( | ) | const [virtual] |
Version number of the plugin.
The format is the same as QCA itself. Version 1.2.3 would be represented as 0x010203.
The default returns 0 (version 0.0.0).
Definition at line 848 of file qca_core.cpp.
The documentation for this class was generated from the following files:
KDE 4.4 API Reference