aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-01-03 12:23:09 -0500
committerLuke Dashjr <luke-jr+git@utopios.org>2012-01-03 12:23:09 -0500
commita2e9767225d3c3fa55f31c2494a3a2f54a65f87f (patch)
tree67460aca4b75a21357f4906ded77c346d0181d50 /src/util.h
parent20e3f2aefc6071af1d4e0754053f2fb88061ee9a (diff)
parentfb88f1cc97d52d8cd5bc49169a1bcd4df735fc52 (diff)
downloadbitcoin-a2e9767225d3c3fa55f31c2494a3a2f54a65f87f.tar.xz
Merge branch '0.5.0.x' into 0.5.x
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 dcf060e3e8..d42b572c6b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -459,7 +459,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))
{
@@ -467,9 +467,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);