diff --git a/auto/mk-src.in b/auto/mk-src.in index 4aa5b60..76b3b16 100644 --- a/auto/mk-src.in +++ b/auto/mk-src.in @@ -294,6 +294,15 @@ class: config string: key string: value + method: replace u + posib err + desc => Experimental method that is like replace but will mark + it as being set in an insecure context. + / + void + string: key + string: value + method: remove posib err desc => Remove a key and returns TRUE if it exists diff --git a/common/config.cpp b/common/config.cpp index a9201d0..bb95a47 100644 --- a/common/config.cpp +++ b/common/config.cpp @@ -809,6 +809,15 @@ namespace acommon { return set(entry); } + PosibErr Config::replace_u(ParmStr key, ParmStr value) + { + Entry * entry = new Entry; + entry->key = key; + entry->value = value; + entry->secure = false; + return set(entry); + } + PosibErr Config::remove(ParmStr key) { Entry * entry = new Entry; diff --git a/common/config.hpp b/common/config.hpp index c6a0c58..016edc3 100644 --- a/common/config.hpp +++ b/common/config.hpp @@ -145,6 +145,11 @@ namespace acommon { PosibErr replace(ParmStr, ParmStr); PosibErr remove(ParmStr); + // replace_u (u is for user value) is like replace except that it + // marks the value as insecure. It should be used when setting a + // config value to anything other than a known constant. + PosibErr replace_u(ParmStr, ParmStr); + bool empty() const {return !first_;} PosibErr merge(const Config & other);