A singleton for managing the application plugins. More...
#include <ApplicationPlugins.h>
Public Types | |
typedef ObjectLevelLockingPolicy < ::boost::lock_guard < ::boost::recursive_mutex > > | LockRead |
typedef ObjectLevelLockingPolicy < ::boost::lock_guard < ::boost::recursive_mutex > > | LockWrite |
typedef volatile ApplicationSettings | VolatileType |
Public Slots | |
void | addPlugins (const std::map< std::string, std::string > &plgs) |
void | removePlugins (const std::vector< std::string > &plgs) |
Public Member Functions | |
void | addPlugin (const std::string &pluginName, const std::string &pluginFileName) |
void | changed () |
This method can be used by clients to inform manually that the internal state has changed. More... | |
const boost::property_tree::ptree & | getAllSettings () const |
It return a reading reference to the internal settings. More... | |
boost::property_tree::ptree & | getAllSettings () |
It return a reference to the internal settings. More... | |
const std::string & | getFileName () const |
const std::map< std::string, std::string > & | getPluginsFiles () const |
std::string | getValue (const std::string &key) |
It returns the value for a given key or empty. More... | |
void | load () |
void | load (const std::string &fileName) |
void | removePlugin (const std::string &pluginName) |
void | setValue (const std::string &key, const std::string &value) |
It stores the value according to the key. More... | |
void | update () |
It updates the application settings. More... | |
Static Public Member Functions | |
static ApplicationPlugins & | getInstance () |
It returns a reference to the singleton instance. More... | |
Protected Member Functions | |
ApplicationPlugins () | |
It initializes the singleton. More... | |
~ApplicationPlugins () | |
Destructor. More... | |
Protected Attributes | |
bool | m_dirty |
A dirty bit to indicate wheter the clients have made changes in the settings since the last update. More... | |
std::string | m_file |
The settings file name. More... | |
std::map< std::string, std::string > | m_plugins_files |
boost::property_tree::ptree | m_settings |
This will keep our settings in memory. More... | |
Friends | |
class | te::common::Singleton< ApplicationPlugins > |
A singleton for managing the application plugins.
This singleton can be used to keep the list of plugins managed by the application.
It will look for a plugin configuration file as follows:
Definition at line 61 of file ApplicationPlugins.h.
|
inherited |
Definition at line 205 of file ThreadingPolicies.h.
|
inherited |
Definition at line 206 of file ThreadingPolicies.h.
|
inherited |
Definition at line 204 of file ThreadingPolicies.h.
|
protected |
It initializes the singleton.
Definition at line 159 of file ApplicationPlugins.cpp.
|
protected |
Destructor.
Definition at line 164 of file ApplicationPlugins.cpp.
void te::qt::af::ApplicationPlugins::addPlugin | ( | const std::string & | pluginName, |
const std::string & | pluginFileName | ||
) |
Definition at line 124 of file ApplicationPlugins.cpp.
|
slot |
Definition at line 143 of file ApplicationPlugins.cpp.
|
inlineinherited |
This method can be used by clients to inform manually that the internal state has changed.
This method is useful when accessing the internal settings structure.
Definition at line 236 of file ApplicationSettings.h.
References te::common::ApplicationSettings::m_dirty.
Referenced by te::qt::af::UpdateUserSettings().
|
inlineinherited |
It return a reading reference to the internal settings.
Definition at line 243 of file ApplicationSettings.h.
References te::common::ApplicationSettings::m_settings.
Referenced by te::qt::af::ApplicationController::initializeProjectMenus(), te::qt::af::UserPlugins::load(), and te::qt::af::UpdateUserSettings().
|
inlineinherited |
It return a reference to the internal settings.
Definition at line 248 of file ApplicationSettings.h.
References te::common::ApplicationSettings::m_settings.
const std::string & te::qt::af::ApplicationPlugins::getFileName | ( | ) | const |
Definition at line 138 of file ApplicationPlugins.cpp.
|
staticinherited |
It returns a reference to the singleton instance.
Referenced by te::qt::af::ApplicationController::initializePlugins(), and te::qt::af::UserPlugins::load().
const std::map< std::string, std::string > & te::qt::af::ApplicationPlugins::getPluginsFiles | ( | ) | const |
Definition at line 119 of file ApplicationPlugins.cpp.
|
inlineinherited |
It returns the value for a given key or empty.
key | The key used to identify the searched value. |
Definition at line 189 of file ApplicationSettings.h.
References te::common::ApplicationSettings::m_settings.
Referenced by te::qt::af::ApplicationController::initialize(), and te::qt::af::SaveDataSourcesFile().
void te::qt::af::ApplicationPlugins::load | ( | ) |
Definition at line 36 of file ApplicationPlugins.cpp.
References te::common::Singleton< T >::getInstance(), te::common::Singleton< OSSettingsDir >::getInstance(), te::common::OSSettingsDir::getSystemSettingsPath(), te::common::OSSettingsDir::getUserSettingsPath(), TERRALIB_APPLICATION_PLUGINS_FILE, TERRALIB_CONFIG_DIR, TERRALIB_DIR, TERRALIB_DIR_ENVVAR, and TR_QT_AF.
Referenced by te::qt::af::ApplicationController::initializePlugins().
void te::qt::af::ApplicationPlugins::load | ( | const std::string & | fileName | ) |
Definition at line 114 of file ApplicationPlugins.cpp.
void te::qt::af::ApplicationPlugins::removePlugin | ( | const std::string & | pluginName | ) |
Definition at line 130 of file ApplicationPlugins.cpp.
|
slot |
Definition at line 151 of file ApplicationPlugins.cpp.
|
inlineinherited |
It stores the value according to the key.
key | The key used to identify the given value. The key must follow the same rules as XML elements and they can be subclassified using a dot notation: setValue(key.subkey.subsubkey, value). |
value | The value to be stored, any valid string. |
Definition at line 181 of file ApplicationSettings.h.
References te::common::ApplicationSettings::m_dirty, and te::common::ApplicationSettings::m_settings.
|
inlineinherited |
It updates the application settings.
Definition at line 215 of file ApplicationSettings.h.
References te::common::ApplicationSettings::m_dirty, te::common::ApplicationSettings::m_file, and te::common::ApplicationSettings::m_settings.
Referenced by te::common::ApplicationSettings::~ApplicationSettings().
|
friend |
Definition at line 68 of file ApplicationPlugins.h.
|
protectedinherited |
A dirty bit to indicate wheter the clients have made changes in the settings since the last update.
Definition at line 167 of file ApplicationSettings.h.
Referenced by te::common::ApplicationSettings::changed(), te::common::ApplicationSettings::load(), te::common::ApplicationSettings::setValue(), and te::common::ApplicationSettings::update().
|
protectedinherited |
The settings file name.
Definition at line 166 of file ApplicationSettings.h.
Referenced by te::common::ApplicationSettings::load(), and te::common::ApplicationSettings::update().
|
protected |
Definition at line 98 of file ApplicationPlugins.h.
|
protectedinherited |
This will keep our settings in memory.
Definition at line 165 of file ApplicationSettings.h.
Referenced by te::common::ApplicationSettings::getAllSettings(), te::common::ApplicationSettings::getValue(), te::common::ApplicationSettings::load(), te::common::ApplicationSettings::setValue(), and te::common::ApplicationSettings::update().