X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Futil.h;h=78caff683dee94490b55612322e4e4823859ce85;hb=eb2a10afd600b2680f24d02ffc73d4c9d9800492;hp=bcb9027148d24a95dfc313d0916d9aea3d6dc244;hpb=3b8051864b98eb5a9df6327f314a45af9205a09c;p=novacoin.git diff --git a/src/util.h b/src/util.h index bcb9027..78caff6 100644 --- a/src/util.h +++ b/src/util.h @@ -449,7 +449,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)) { @@ -457,9 +457,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);