2004-12-30 09:32:01 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
2007-04-17 12:01:26 +00:00
|
|
|
|
2004-12-30 09:32:01 +00:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2007-04-17 12:01:26 +00:00
|
|
|
|
2004-12-30 09:32:01 +00:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2007-04-17 12:01:26 +00:00
|
|
|
// QtCrypto has the declarations for all of QCA
|
2005-01-01 05:34:22 +00:00
|
|
|
#include <QtCrypto>
|
2007-04-17 12:01:26 +00:00
|
|
|
#include <QCoreApplication>
|
|
|
|
|
2004-12-30 09:32:01 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <qstringlist.h>
|
|
|
|
|
2014-01-02 03:50:18 +06:00
|
|
|
#ifdef QT_STATICPLUGIN
|
|
|
|
#include "import_plugins.h"
|
|
|
|
#endif
|
|
|
|
|
2004-12-30 09:32:01 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2007-04-17 12:01:26 +00:00
|
|
|
// the Initializer object sets things up, and
|
2004-12-30 09:32:01 +00:00
|
|
|
// also does cleanup when it goes out of scope
|
|
|
|
QCA::Initializer init;
|
|
|
|
|
2005-02-28 09:47:01 +00:00
|
|
|
QCoreApplication app(argc, argv);
|
|
|
|
|
2005-02-28 08:13:42 +00:00
|
|
|
// get all the available providers loaded.
|
2005-04-27 10:37:06 +00:00
|
|
|
// you don't normally need this (because you test using isSupported())
|
|
|
|
// but this is a special case.
|
2005-02-28 08:13:42 +00:00
|
|
|
QCA::scanForPlugins();
|
2004-12-30 09:32:01 +00:00
|
|
|
|
|
|
|
// this gives us all the plugin providers as a list
|
|
|
|
QCA::ProviderList qcaProviders = QCA::providers();
|
2005-02-28 08:00:46 +00:00
|
|
|
for (int i = 0; i < qcaProviders.size(); ++i) {
|
2004-12-30 09:32:01 +00:00
|
|
|
// each provider has a name, which we can display
|
2005-02-28 08:00:46 +00:00
|
|
|
std::cout << qcaProviders[i]->name().toLatin1().data() << ": ";
|
2004-12-30 09:32:01 +00:00
|
|
|
// ... and also a list of features
|
2005-02-28 08:00:46 +00:00
|
|
|
QStringList capabilities = qcaProviders[i]->features();
|
2004-12-30 09:32:01 +00:00
|
|
|
// we turn the string list back into a single string,
|
|
|
|
// and display it as well
|
2005-02-28 08:00:46 +00:00
|
|
|
std::cout << capabilities.join(", ").toLatin1().data() << std::endl;
|
2004-12-30 09:32:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Note that the default provider isn't included in
|
|
|
|
// the result of QCA::providers()
|
|
|
|
std::cout << "default: ";
|
|
|
|
// However it is still possible to get the features
|
|
|
|
// supported by the default provider
|
|
|
|
QStringList capabilities = QCA::defaultFeatures();
|
2005-02-28 08:00:46 +00:00
|
|
|
std::cout << capabilities.join(", ").toLatin1().data() << std::endl;
|
2004-12-30 09:32:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|