X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Futil.h;h=48fea023bfe8090360c2ac1a2c4c2f1778dc6728;hb=0fcf91ea1e23697736032caadc8e487e0ba6cfef;hp=bb90869962f1a847b2c7256661f011aa8436208d;hpb=4231eb217ca06e93cfb0875924b4383f92baf134;p=novacoin.git diff --git a/src/util.h b/src/util.h index bb90869..48fea02 100644 --- a/src/util.h +++ b/src/util.h @@ -439,7 +439,7 @@ inline int64 GetArg(const std::string& strArg, int64 nDefault) return nDefault; } -inline bool GetBoolArg(const std::string& strArg) +inline bool GetBoolArg(const std::string& strArg, bool fDefault=false) { if (mapArgs.count(strArg)) { @@ -447,9 +447,26 @@ inline bool GetBoolArg(const std::string& strArg) return true; return (atoi(mapArgs[strArg]) != 0); } - return false; -} - + return fDefault; +} + +/** + * Set an argument if it doesn't already have a value + * + * @param strArg Argument to set (e.g. "-foo") + * @param strValue Value (e.g. "1") + * @return true if argument gets set, false if it already had a value + */ +bool SoftSetArg(const std::string& strArg, const std::string& strValue); + +/** + * Set a boolean argument if it doesn't already have a value + * + * @param strArg Argument to set (e.g. "-foo") + * @param fValue Value (e.g. false) + * @return true if argument gets set, false if it already had a value + */ +bool SoftSetArg(const std::string& strArg, bool fValue);