QGIS API Documentation  3.0.2-Girona (307d082)
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.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 
75  QgsPluginLayerRegistry() = default;
77 
79  QgsPluginLayerRegistry( const QgsPluginLayerRegistry &rh ) = delete;
81  QgsPluginLayerRegistry &operator=( const QgsPluginLayerRegistry &rh ) = delete;
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
A registry of plugin layers types.
Base class for plugin layers.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:69
class for creating plugin specific layers