From b6a6d94ea3e012d02fb91d935c3f93af74e893e3 Mon Sep 17 00:00:00 2001 From: mishas Date: Thu, 12 Apr 2007 07:13:20 +0000 Subject: [PATCH 1/1] * static method 'mergePath' is now normal method 'merge' * added qualifier const the myKeyPath * implemented method 'merge' git-svn-id: file:///svnroot/simple-launcher/trunk@169 3ba93dab-e023-0410-b42a-de7732cf370a --- gconf-wrapper.cc | 15 +++++++++++++++ gconf-wrapper.h | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gconf-wrapper.cc b/gconf-wrapper.cc index e1120d6..cad3e04 100644 --- a/gconf-wrapper.cc +++ b/gconf-wrapper.cc @@ -32,6 +32,21 @@ void GConfItem::allocateClient() { GConfKey::GConfKey(const std::string& path): myKeyPath(path) { } +std::string GConfKey::merge(const std::string& path) const { + std::string result = myKeyPath; + + if (path.empty()) { + // this is actually a bad situation, what to do?? + } else if (path[0] == '/') { + result.append(path); + } else { + result.append("/"); + result.append(path); + } + + return result; +} + GConfStringValue::GConfStringValue(const GConfKey& key, const std::string& name, const std::string& defaultValue): GConfOption(key, name), myDefaultValue(defaultValue) { diff --git a/gconf-wrapper.h b/gconf-wrapper.h index 198b146..9fbf284 100644 --- a/gconf-wrapper.h +++ b/gconf-wrapper.h @@ -44,15 +44,15 @@ public: const std::string& path() const { return myKeyPath; } - static std::string mergePath(const std::string&, const std::string); + std::string merge(const std::string&) const; private: - std::string myKeyPath; + const std::string myKeyPath; }; class GConfOption : public GConfItem { protected: - GConfOption(const GConfKey& key, const std::string& path): myIsSynchronized(false), myPath(GConfKey::mergePath(key.path(), path)) { } + GConfOption(const GConfKey& key, const std::string& path): myIsSynchronized(false), myPath(key.merge(path)) { } void setGConfValue(const GConfValue *); GConfValue *getGConfValue(GConfValueType) const; -- 1.7.9.5