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) {
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;