diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-01-03 12:19:48 -0500 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-01-03 12:19:48 -0500 |
commit | eb2a10afd600b2680f24d02ffc73d4c9d9800492 (patch) | |
tree | 90538703868e2b1c04c76c41b7368f2d04d4add8 /src/util.h | |
parent | 3b8051864b98eb5a9df6327f314a45af9205a09c (diff) | |
parent | cc6bd19660461091903568803014b39d571fd458 (diff) | |
download | bitcoin-eb2a10afd600b2680f24d02ffc73d4c9d9800492.tar.xz |
Merge branch '0.4.x' into 0.5.0.x
Conflicts:
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 bcb9027148..78caff683d 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); |