diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2012-01-03 10:14:22 -0500 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-01-03 11:48:44 -0500 |
commit | 84393f15b60ff5392da69b7cc208ffb5e8d209f0 (patch) | |
tree | d536b944eb7a466cfafb8f87e7f4bf6a4b5075f4 /src/util.h | |
parent | b52b6f2e3801fe14e09d646415cb798c565063d5 (diff) | |
download | bitcoin-84393f15b60ff5392da69b7cc208ffb5e8d209f0.tar.xz |
Fix issue #659, and cleanup wallet/command-line argument handling a bit
Conflicts:
src/init.cpp
src/util.cpp
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/util.h b/src/util.h index 6ecc92b2b6..9f9001e06e 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); |