X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Futil.h;h=9f9001e06eb45293fedaf7af7ba6e7b1edd708b4;hb=84393f15b60ff5392da69b7cc208ffb5e8d209f0;hp=6ecc92b2b6d8ff8a83b58198cbb7139e9db2039e;hpb=b52b6f2e3801fe14e09d646415cb798c565063d5;p=novacoin.git diff --git a/src/util.h b/src/util.h index 6ecc92b..9f9001e 100644 --- a/src/util.h +++ b/src/util.h @@ -442,7 +442,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)) { @@ -450,9 +450,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);