aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2012-01-03 10:14:22 -0500
committerGavin Andresen <gavinandresen@gmail.com>2012-01-03 10:17:28 -0500
commit0fcf91ea1e23697736032caadc8e487e0ba6cfef (patch)
tree4738fbd6c1d7061b58b8492423e3d2fdce48b7f9 /src/util.h
parent4231eb217ca06e93cfb0875924b4383f92baf134 (diff)
downloadbitcoin-0fcf91ea1e23697736032caadc8e487e0ba6cfef.tar.xz
Fix issue #659, and cleanup wallet/command-line argument handling a bit
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/util.h b/src/util.h
index bb90869962..48fea023bf 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);