QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgspluginlayerregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspluginlayerregistry.cpp - class for
3  registering plugin layer creators
4  -------------------
5  begin : Mon Nov 30 2009
6  copyright : (C) 2009 by Mathias Walker, Sourcepole
7  email : mwa at sourcepole.ch
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSPLUGINLAYERREGSITRY_H
20 #define QGSPLUGINLAYERREGSITRY_H
21 
22 #include <QMap>
23 #include "qgis_sip.h"
24 #include <QDomNode>
25 
26 #include "qgis_core.h"
27 
28 class QgsPluginLayer;
29 
34 class CORE_EXPORT QgsPluginLayerType
35 {
36  public:
37 
38  QgsPluginLayerType( const QString &name );
39  virtual ~QgsPluginLayerType() = default;
40 
41  QString name();
42 
44  virtual QgsPluginLayer *createLayer() SIP_FACTORY;
45 
50  virtual QgsPluginLayer *createLayer( const QString &uri ) SIP_FACTORY;
51 
53  virtual bool showLayerProperties( QgsPluginLayer *layer );
54 
55  protected:
56  QString mName;
57 };
58 
59 //=============================================================================
60 
68 class CORE_EXPORT QgsPluginLayerRegistry
69 {
70  public:
71 
77 
82 
86  QStringList pluginLayerTypes();
87 
89  bool addPluginLayerType( QgsPluginLayerType *pluginLayerType SIP_TRANSFER );
90 
92  bool removePluginLayerType( const QString &typeName );
93 
95  QgsPluginLayerType *pluginLayerType( const QString &typeName );
96 
101  QgsPluginLayer *createLayer( const QString &typeName, const QString &uri = QString() ) SIP_FACTORY;
102 
103  private:
104 #ifdef SIP_RUN
106 #endif
107 
108  typedef QMap<QString, QgsPluginLayerType *> PluginLayerTypes;
109 
110  PluginLayerTypes mPluginLayerTypes;
111 };
112 
113 #endif // QGSPLUGINLAYERREGSITRY_H
QgsPluginLayerType::~QgsPluginLayerType
virtual ~QgsPluginLayerType()=default
QgsPluginLayerRegistry::operator=
QgsPluginLayerRegistry & operator=(const QgsPluginLayerRegistry &rh)=delete
QgsPluginLayerRegistry cannot be copied.
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
typeName
const QString & typeName
Definition: qgswfsgetfeature.cpp:55
QgsPluginLayerRegistry::QgsPluginLayerRegistry
QgsPluginLayerRegistry(const QgsPluginLayerRegistry &rh)=delete
QgsPluginLayerRegistry cannot be copied.
QgsPluginLayer
Base class for plugin layers.
Definition: qgspluginlayer.h:32
QgsPluginLayerType
class for creating plugin specific layers
Definition: qgspluginlayerregistry.h:35
QgsPluginLayerRegistry::QgsPluginLayerRegistry
QgsPluginLayerRegistry()=default
Constructor for QgsPluginLayerRegistry.
QgsPluginLayerRegistry
A registry of plugin layers types.
Definition: qgspluginlayerregistry.h:69