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
37 QCA::Initializer init;
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.
44 QCA::scanForPlugins();
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
63 QStringList capabilities = QCA::defaultFeatures();
64 std::cout << capabilities.join(QStringLiteral(", ")).toLatin1().data() << std::endl;
65 return 0;
66}
67

source code of qca/examples/providertest/providertest.cpp