Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 /* $Id$ */
19 
20 #ifndef QGSPLUGINLAYERREGSITRY_H
21 #define QGSPLUGINLAYERREGSITRY_H
22 
23 #include <QMap>
24 #include <QDomNode>
25 
26 class QgsPluginLayer;
27 
33 class CORE_EXPORT QgsPluginLayerType
34 {
35  public:
36 
37  QgsPluginLayerType( QString name );
38  virtual ~QgsPluginLayerType();
39 
40  QString name();
41 
43  virtual QgsPluginLayer* createLayer();
44 
46  virtual bool showLayerProperties( QgsPluginLayer* layer );
47 
48  protected:
49  QString mName;
50 };
51 
52 //=============================================================================
53 
59 class CORE_EXPORT QgsPluginLayerRegistry
60 {
61  public:
62 
64  static QgsPluginLayerRegistry* instance();
65 
67 
69  bool addPluginLayerType( QgsPluginLayerType* pluginLayerType );
70 
72  bool removePluginLayerType( QString typeName );
73 
75  QgsPluginLayerType* pluginLayerType( QString typeName );
76 
78  QgsPluginLayer* createLayer( QString typeName );
79 
80  private:
81 
82  typedef QMap<QString, QgsPluginLayerType*> PluginLayerTypes;
83 
86 
89 
91 };
92 
93 #endif // QGSPLUGINLAYERREGSITRY_H