Go to the documentation of this file.
26 #ifndef __TERRALIB_COMMON_INTERNAL_APPLICATIONSETTINGS_H
27 #define __TERRALIB_COMMON_INTERNAL_APPLICATIONSETTINGS_H
32 #include "../core/filesystem/FileSystem.h"
38 #include <boost/property_tree/ptree.hpp>
39 #include <boost/property_tree/xml_parser.hpp>
40 #include <boost/filesystem.hpp>
41 #include <boost/noncopyable.hpp>
69 ::boost::recursive_mutex,
70 ::boost::lock_guard< ::boost::recursive_mutex>,
71 ::boost::lock_guard< ::boost::recursive_mutex> >,
72 public ::boost::noncopyable
94 void setValue(
const std::string& key,
const std::string& value);
105 std::string
getValue(
const std::string& key);
120 void load(
const std::string& settingsFile);
213 boost::property_tree::read_xml(
m_file,
m_settings, boost::property_tree::xml_parser::trim_whitespace);
227 #if BOOST_VERSION > 105600
228 boost::property_tree::xml_writer_settings<std::string> settings(
'\t', 1);
230 boost::property_tree::xml_writer_settings<char> settings(
'\t', 1);
232 boost::property_tree::write_xml(
m_file,
m_settings, std::locale(), settings);
258 #endif // __TERRALIB_COMMON_INTERNAL_APPLICATIONSETTINGS_H
const boost::property_tree::ptree & getAllSettings() const
It return a reading reference to the internal settings.
std::string getValue(const std::string &key)
It returns the value for a given key or empty.
void load(const std::string &settingsFile)
It initializes the application settings.
boost::property_tree::ptree m_settings
This will keep our settings in memory.
static bool remove(const std::string &path)
Removes a file or directory from a given path in UTF-8.
A class for managing application settings.
void update()
It updates the application settings.
void changed()
This method can be used by clients to inform manually that the internal state has changed.
std::string m_file
The settings file name.
void setValue(const std::string &key, const std::string &value)
It stores the value according to the key.
Threading policies that can be applied to TerraLib classes that need some synchronization schema.
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockWrite
This policy assures an object-level locking scheme for a derived class.
~ApplicationSettings()
The destructor will automatically save the settings to a file if one is set.
ApplicationSettings()
Constructor.
Proxy configuration file for TerraView (see terraview_config.h).
bool m_dirty
A dirty bit to indicate wheter the clients have made changes in the settings since the last update.
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockRead
static bool isRegularFile(const std::string &path)
Checks if a given path in UTF-8 is a regular file.