mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
initial plugin api and test plugin
git-svn-id: http://svn.osgeo.org/qgis/trunk@133 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
33025461ff
commit
72354ab5ef
13
plugins/qgisplugin.h
Normal file
13
plugins/qgisplugin.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef qgisplugin_h
|
||||
#define qgisplugin_h
|
||||
#include <qstring.h>
|
||||
|
||||
class QgisPlugin{
|
||||
public:
|
||||
virtual QString pluginName() = 0;
|
||||
virtual QString pluginVersion() =0;
|
||||
virtual QString pluginDescription() = 0;
|
||||
};
|
||||
typedef QgisPlugin* create_t();
|
||||
typedef void unload_t(QgisPlugin *);
|
||||
#endif //qgisplugin_h
|
4
plugins/qgisplugin.pro
Normal file
4
plugins/qgisplugin.pro
Normal file
@ -0,0 +1,4 @@
|
||||
TEMPLATE = lib
|
||||
SOURCES = qgistestplugin.cpp
|
||||
HEADERS = qgisplugin.h
|
||||
|
59
plugins/qgistestplugin.cpp
Normal file
59
plugins/qgistestplugin.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
/* Test plugin for QGis
|
||||
* This code is a test plugin for QGis and a demonstration of the API
|
||||
* All QGis plugins must inherit from the abstract base class QgisPlugin. A
|
||||
* plugin must implement the virtual functions defined in QgisPlugin:
|
||||
* *pluginName
|
||||
* *pluginVersion
|
||||
* *pluginDescription
|
||||
*
|
||||
* This list will grow as the API is expanded.
|
||||
*
|
||||
* In addition, a plugin must implement a the classFactory and unload
|
||||
* functions. Note that these functions must be declared as extern "C"
|
||||
*/
|
||||
#include <qstring.h>
|
||||
|
||||
#ifndef qgisplugintest_h
|
||||
#define qgisplugintest_h
|
||||
#include "qgisplugin.h"
|
||||
|
||||
class QgisTestPlugin : public QgisPlugin{
|
||||
public:
|
||||
QgisTestPlugin();
|
||||
virtual QString pluginName();
|
||||
virtual QString pluginVersion();
|
||||
virtual QString pluginDescription();
|
||||
virtual ~QgisTestPlugin();
|
||||
private:
|
||||
QString name;
|
||||
QString version;
|
||||
QString description;
|
||||
};
|
||||
|
||||
#endif
|
||||
QgisTestPlugin::QgisTestPlugin(){
|
||||
name = "Test Plugin";
|
||||
version = "Version 0.0";
|
||||
description = "This test plugin does nothing but tell you its name, version, and description";
|
||||
}
|
||||
QgisTestPlugin::~QgisTestPlugin(){
|
||||
|
||||
}
|
||||
QString QgisTestPlugin::pluginName(){
|
||||
return name;
|
||||
}
|
||||
QString QgisTestPlugin::pluginVersion(){
|
||||
return version;
|
||||
|
||||
}
|
||||
QString QgisTestPlugin::pluginDescription(){
|
||||
return description;
|
||||
|
||||
}
|
||||
extern "C" QgisPlugin * classFactory(){
|
||||
return new QgisTestPlugin();
|
||||
}
|
||||
|
||||
extern "C" void unload(QgisPlugin *p){
|
||||
delete p;
|
||||
}
|
18
plugins/qgistestplugin.h
Normal file
18
plugins/qgistestplugin.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef qgisplugintest_h
|
||||
#define qgisplugintest_h
|
||||
#include "qgisplugin.h"
|
||||
|
||||
class QgisTestPlugin : public QgisPlugin{
|
||||
public:
|
||||
QgisTestPlugin();
|
||||
virtual QString pluginName();
|
||||
virtual QString pluginVersion();
|
||||
virtual QString pluginDescription();
|
||||
virtual ~QgisTestPlugin();
|
||||
private:
|
||||
QString name;
|
||||
QString version;
|
||||
QString description;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user