license info / plugin version define

svn path=/trunk/kdesupport/qca/; revision=251711
This commit is contained in:
Justin Karneges 2003-09-17 01:02:09 +00:00
parent 471671d4f8
commit b5ee65cbb6
4 changed files with 82 additions and 5 deletions

View File

@ -1365,7 +1365,7 @@ public:
int qcaVersion() const int qcaVersion() const
{ {
return 1; return QCA_PLUGIN_VERSION;
} }
int capabilities() const int capabilities() const

View File

@ -1,3 +1,23 @@
/*
* qca.cpp - Qt Cryptographic Architecture
* Copyright (C) 2003 Justin Karneges
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include"qca.h" #include"qca.h"
#include<qptrlist.h> #include<qptrlist.h>
@ -18,14 +38,13 @@
#define PLUGIN_EXT "so" #define PLUGIN_EXT "so"
#endif #endif
#define QCA_PLUGIN_VERSION 1
using namespace QCA; using namespace QCA;
class ProviderItem class ProviderItem
{ {
public: public:
QCAProvider *p; QCAProvider *p;
QString fname;
static ProviderItem *load(const QString &fname) static ProviderItem *load(const QString &fname)
{ {
@ -46,6 +65,7 @@ public:
return 0; return 0;
} }
ProviderItem *i = new ProviderItem(lib, p); ProviderItem *i = new ProviderItem(lib, p);
i->fname = fname;
return i; return i;
} }
@ -84,6 +104,16 @@ private:
static QPtrList<ProviderItem> providerList; static QPtrList<ProviderItem> providerList;
static bool qca_init = false; static bool qca_init = false;
static bool plugin_have(const QString &fname)
{
QPtrListIterator<ProviderItem> it(providerList);
for(ProviderItem *i; (i = it.current()); ++it) {
if(i->fname == fname)
return true;
}
return false;
}
static void plugin_scan() static void plugin_scan()
{ {
QStringList dirs = QApplication::libraryPaths(); QStringList dirs = QApplication::libraryPaths();
@ -100,9 +130,14 @@ static void plugin_scan()
continue; continue;
if(fi.extension() != PLUGIN_EXT) if(fi.extension() != PLUGIN_EXT)
continue; continue;
//printf("f=[%s]\n", fi.filePath().latin1()); QString fname = fi.filePath();
ProviderItem *i = ProviderItem::load(fi.filePath()); // don't load the same plugin again!
if(plugin_have(fname))
continue;
//printf("f=[%s]\n", fname.latin1());
ProviderItem *i = ProviderItem::load(fname);
if(!i) if(!i)
continue; continue;
if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) { if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) {

View File

@ -1,3 +1,23 @@
/*
* qca.h - Qt Cryptographic Architecture
* Copyright (C) 2003 Justin Karneges
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef QCA_H #ifndef QCA_H
#define QCA_H #define QCA_H

View File

@ -1,3 +1,23 @@
/*
* qcaprovider.h - QCA Plugin API
* Copyright (C) 2003 Justin Karneges
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef QCAPROVIDER_H #ifndef QCAPROVIDER_H
#define QCAPROVIDER_H #define QCAPROVIDER_H
@ -8,6 +28,8 @@
#include<qhostaddress.h> #include<qhostaddress.h>
#include"qca.h" #include"qca.h"
#define QCA_PLUGIN_VERSION 1
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
#define QCA_EXPORT extern "C" __declspec(dllexport) #define QCA_EXPORT extern "C" __declspec(dllexport)
#else #else