All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ApplicationPlugins.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/af/ApplicationPlugins.h
22 
23  \brief A singleton for managing the application plugins.
24 */
25 
26 #ifndef __TERRALIB_QT_AF_INTERNAL_APPLICATIONPLUGINS_H
27 #define __TERRALIB_QT_AF_INTERNAL_APPLICATIONPLUGINS_H
28 
29 //! TerraLib
30 #include "../../common/ApplicationSettings.h"
31 #include "../../common/Singleton.h"
32 #include "Config.h"
33 
34 //! Qt
35 #include <QObject>
36 
37 namespace te
38 {
39  namespace qt
40  {
41  namespace af
42  {
43  /*!
44  \class ApplicationPlugins
45 
46  \brief A singleton for managing the application plugins.
47 
48  This singleton can be used to keep the list of plugins managed by the application.
49 
50  It will look for a plugin configuration file as follows:
51  <ul>
52  <li>first, searchs for the plugin configuration file name in SystemApplicationSettings</li>
53  <li>then it check for this file in the current application dir</li>
54  <li>if not foud it looks in the system application dir</li>
55  <li>if not found looks in the user folder</li>
56  <li>and finally it uses a location defined by an environment variable TERRALIB_DIR_ENVVAR under TERRALIB_CONFIG_DIR</li>
57  </ul>
58 
59  \ingroup af
60  */
62  : public QObject,
64  public te::common::Singleton<ApplicationPlugins>
65  {
66  Q_OBJECT
67 
69 
70  public:
71 
72  void load();
73 
74  void load(const std::string& fileName);
75 
76  const std::map<std::string, std::string>& getPluginsFiles() const;
77 
78  void addPlugin(const std::string& pluginName, const std::string& pluginFileName);
79 
80  void removePlugin(const std::string& pluginName);
81 
82  const std::string& getFileName() const;
83 
84  public slots:
85 
86  void addPlugins(const std::map<std::string, std::string>& plgs);
87 
88  void removePlugins(const std::vector<std::string>& plgs);
89 
90  protected:
91 
92  /*! \brief It initializes the singleton. */
94 
95  /*! \brief Destructor. */
97 
98  std::map<std::string, std::string> m_plugins_files;
99  };
100 
101  } // end namespace af
102  } // end namespace qt
103 } // end namespace te
104 
105 #endif // __TERRALIB_QT_AF_INTERNAL_APPLICATIONPLUGINS_H
Template support for singleton pattern.
Definition: Singleton.h:100
std::map< std::string, std::string > m_plugins_files
Configuration flags for the TerraLib Application Framework.
A class for managing application settings.
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:108
A singleton for managing the application plugins.