Quantum GIS API Documentation  1.7.4
src/core/qgspluginlayerregistry.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                     qgspluginlayerregistry.cpp - class for
00003                     registering plugin layer creators
00004                              -------------------
00005     begin                : Mon Nov 30 2009
00006     copyright            : (C) 2009 by Mathias Walker, Sourcepole
00007     email                : mwa at sourcepole.ch
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 /* $Id$ */
00019 
00020 #ifndef QGSPLUGINLAYERREGSITRY_H
00021 #define QGSPLUGINLAYERREGSITRY_H
00022 
00023 #include <QMap>
00024 #include <QDomNode>
00025 
00026 class QgsPluginLayer;
00027 
00033 class CORE_EXPORT QgsPluginLayerType
00034 {
00035   public:
00036 
00037     QgsPluginLayerType( QString name );
00038     virtual ~QgsPluginLayerType();
00039 
00040     QString name();
00041 
00043     virtual QgsPluginLayer* createLayer();
00044 
00046     virtual bool showLayerProperties( QgsPluginLayer* layer );
00047 
00048   protected:
00049     QString mName;
00050 };
00051 
00052 //=============================================================================
00053 
00059 class CORE_EXPORT QgsPluginLayerRegistry
00060 {
00061   public:
00062 
00064     static QgsPluginLayerRegistry* instance();
00065 
00066     ~QgsPluginLayerRegistry();
00067 
00069     bool addPluginLayerType( QgsPluginLayerType* pluginLayerType );
00070 
00072     bool removePluginLayerType( QString typeName );
00073 
00075     QgsPluginLayerType* pluginLayerType( QString typeName );
00076 
00078     QgsPluginLayer* createLayer( QString typeName );
00079 
00080   private:
00081 
00082     typedef QMap<QString, QgsPluginLayerType*> PluginLayerTypes;
00083 
00085     QgsPluginLayerRegistry();
00086 
00088     static QgsPluginLayerRegistry* _instance;
00089 
00090     PluginLayerTypes mPluginLayerTypes;
00091 };
00092 
00093 #endif // QGSPLUGINLAYERREGSITRY_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines