QGIS API Documentation  2.99.0-Master (0a63d1f)
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 <QDomNode>
24 
25 #include "qgis_core.h"
26 
27 class QgsPluginLayer;
28 
32 class CORE_EXPORT QgsPluginLayerType
33 {
34  public:
35 
36  QgsPluginLayerType( const QString& name );
37  virtual ~QgsPluginLayerType() = default;
38 
39  QString name();
40 
42  virtual QgsPluginLayer* createLayer();
43 
47  virtual QgsPluginLayer* createLayer( const QString& uri );
48 
50  virtual bool showLayerProperties( QgsPluginLayer* layer );
51 
52  protected:
53  QString mName;
54 };
55 
56 //=============================================================================
57 
64 class CORE_EXPORT QgsPluginLayerRegistry
65 {
66  public:
67 
70 
72  QgsPluginLayerRegistry( const QgsPluginLayerRegistry& rh ) = delete;
74  QgsPluginLayerRegistry& operator=( const QgsPluginLayerRegistry& rh ) = delete;
75 
78  QStringList pluginLayerTypes();
79 
81  bool addPluginLayerType( QgsPluginLayerType* pluginLayerType );
82 
84  bool removePluginLayerType( const QString& typeName );
85 
87  QgsPluginLayerType* pluginLayerType( const QString& typeName );
88 
92  QgsPluginLayer* createLayer( const QString& typeName, const QString& uri = QString() );
93 
94  private:
95 
96  typedef QMap<QString, QgsPluginLayerType*> PluginLayerTypes;
97 
98  PluginLayerTypes mPluginLayerTypes;
99 };
100 
101 #endif // QGSPLUGINLAYERREGSITRY_H
A registry of plugin layers types.
Base class for plugin layers.
class for creating plugin specific layers