diff --git a/plugins/xmlregistry/RegistryTree.cpp b/plugins/xmlregistry/RegistryTree.cpp index df7d8763b5..8058a30883 100644 --- a/plugins/xmlregistry/RegistryTree.cpp +++ b/plugins/xmlregistry/RegistryTree.cpp @@ -7,7 +7,9 @@ #include "wxutil/IConv.h" -// Constructor +namespace registry +{ + RegistryTree::RegistryTree() : _topLevelNode(TOPLEVEL_NODE_NAME), _defaultImportNode(std::string("/") + _topLevelNode), @@ -307,3 +309,5 @@ void RegistryTree::dump() const { _tree.saveToFile("-"); } + +} diff --git a/plugins/xmlregistry/RegistryTree.h b/plugins/xmlregistry/RegistryTree.h index 690e47d6da..0ef34a1984 100644 --- a/plugins/xmlregistry/RegistryTree.h +++ b/plugins/xmlregistry/RegistryTree.h @@ -2,6 +2,9 @@ #include "xmlutil/Document.h" +namespace registry +{ + const char* const TOPLEVEL_NODE_NAME = "darkradiant"; class RegistryTree @@ -74,3 +77,5 @@ class RegistryTree */ std::string prepareKey(const std::string& key); }; + +} diff --git a/plugins/xmlregistry/XMLRegistry.cpp b/plugins/xmlregistry/XMLRegistry.cpp index c5d15cf2f0..967424394e 100644 --- a/plugins/xmlregistry/XMLRegistry.cpp +++ b/plugins/xmlregistry/XMLRegistry.cpp @@ -1,4 +1,4 @@ -#include "XMLRegistry.h" // The Abstract Base Class +#include "XMLRegistry.h" #include #include @@ -11,6 +11,9 @@ #include "string/string.h" #include "wxutil/IConv.h" +namespace registry +{ + XMLRegistry::XMLRegistry() : _queryCounter(0), _changesSinceLastSave(0), @@ -314,8 +317,10 @@ void XMLRegistry::initialiseModule(const ApplicationContext& ctx) module::GlobalModuleRegistry().signal_allModulesUninitialised().connect( sigc::mem_fun(this, &XMLRegistry::shutdown)); - _autosaver.reset(new registry::Autosaver([this]() + _autosaver.reset(new Autosaver([this]() { return _changesSinceLastSave > 0; })); } + +} diff --git a/plugins/xmlregistry/XMLRegistry.h b/plugins/xmlregistry/XMLRegistry.h index 789ba18af4..767a6e4ebd 100644 --- a/plugins/xmlregistry/XMLRegistry.h +++ b/plugins/xmlregistry/XMLRegistry.h @@ -28,14 +28,17 @@ #include "RegistryTree.h" #include "Autosaver.h" +namespace registry +{ + class XMLRegistry : public Registry { private: - // The map of registry key signals. There is one signal per key, but a - // signal can of course be connected to multiple slots. - typedef std::map > KeySignals; - mutable KeySignals _keySignals; + // The map of registry key signals. There is one signal per key, but a + // signal can of course be connected to multiple slots. + typedef std::map > KeySignals; + mutable KeySignals _keySignals; // The "install" tree, is basically treated as read-only RegistryTree _standardTree; @@ -50,13 +53,13 @@ class XMLRegistry : // Change tracking counter, is reset when saveToDisk() is called unsigned int _changesSinceLastSave; - // TRUE if the registry has already been saved to disk - // At this point no more write operations should be made - // to the registry - bool _shutdown; + // TRUE if the registry has already been saved to disk + // At this point no more write operations should be made + // to the registry + bool _shutdown; - // The autosaver - std::unique_ptr _autosaver; + // Auto-save helper + std::unique_ptr _autosaver; public: /* Constructor: @@ -84,8 +87,8 @@ class XMLRegistry : // Set the value of the given attribute at the specified . void setAttribute(const std::string& path, - const std::string& attrName, - const std::string& attrValue) override; + const std::string& attrName, + const std::string& attrValue) override; // Loads the string value of the given attribute of the node at . std::string getAttribute(const std::string& path, const std::string& attrName) override; @@ -114,7 +117,7 @@ class XMLRegistry : */ void exportToFile(const std::string& key, const std::string& filename) override; - sigc::signal signalForKey(const std::string& key) const override; + sigc::signal signalForKey(const std::string& key) const override; // RegisterableModule implementation const std::string& getName() const override; @@ -127,7 +130,9 @@ class XMLRegistry : void emitSignalForKey(const std::string& changedKey); - // Invoked after all modules have been uninitialised - void shutdown(); + // Invoked after all modules have been uninitialised + void shutdown(); }; typedef std::shared_ptr XMLRegistryPtr; + +} diff --git a/plugins/xmlregistry/XMLRegistryModule.cpp b/plugins/xmlregistry/XMLRegistryModule.cpp index 6a7d55c89f..409fd559e4 100644 --- a/plugins/xmlregistry/XMLRegistryModule.cpp +++ b/plugins/xmlregistry/XMLRegistryModule.cpp @@ -9,5 +9,5 @@ extern "C" void DARKRADIANT_DLLEXPORT RegisterModule(IModuleRegistry& registry) { module::performDefaultInitialisation(registry); - registry.registerModule(XMLRegistryPtr(new XMLRegistry)); + registry.registerModule(std::make_shared()); }