QCA

providertest.cpp
1/*
2 Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20*/
21
22// QtCrypto has the declarations for all of QCA
23#include <QCoreApplication>
24#include <QtCrypto>
25
26#include <iostream>
27#include <qstringlist.h>
28
29#ifdef QT_STATICPLUGIN
30#include "import_plugins.h"
31#endif
32
33int main(int argc, char **argv)
34{
35 // the Initializer object sets things up, and
36 // also does cleanup when it goes out of scope
38
39 QCoreApplication app(argc, argv);
40
41 // get all the available providers loaded.
42 // you don't normally need this (because you test using isSupported())
43 // but this is a special case.
45
46 // this gives us all the plugin providers as a list
47 const QCA::ProviderList qcaProviders = QCA::providers();
48 for (const QCA::Provider *provider : qcaProviders) {
49 // each provider has a name, which we can display
50 std::cout << provider->name().toLatin1().data() << ": ";
51 // ... and also a list of features
52 QStringList capabilities = provider->features();
53 // we turn the string list back into a single string,
54 // and display it as well
55 std::cout << capabilities.join(QStringLiteral(", ")).toLatin1().data() << std::endl;
56 }
57
58 // Note that the default provider isn't included in
59 // the result of QCA::providers()
60 std::cout << "default: ";
61 // However it is still possible to get the features
62 // supported by the default provider
64 std::cout << capabilities.join(QStringLiteral(", ")).toLatin1().data() << std::endl;
65 return 0;
66}
Convenience method for initialising and cleaning up QCA.
Definition qca_core.h:660
Algorithm provider.
Definition qca_core.h:765
Capabilities capabilities()
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)
QCA_EXPORT void scanForPlugins()
Scan for new plugins.
QCA_EXPORT ProviderList providers()
Return a list of the current providers.
QCA_EXPORT QStringList defaultFeatures()
Generate a list of the built in features.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 11:52:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.