aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/scan_name.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-03-31 03:38:10 +0000
committerlloyd <[email protected]>2009-03-31 03:38:10 +0000
commit58bcc7e7c08badf1a11735129704b1d38fa8abad (patch)
treeae37dd8fccb7814777ec0f0037c20d12ddda0093 /src/utils/scan_name.cpp
parent1309862b2d60622129ba5f3fdaadc8b763d842a8 (diff)
Add a new version of SCAN_Name::arg that returns a default value if the
param isn't set.
Diffstat (limited to 'src/utils/scan_name.cpp')
-rw-r--r--src/utils/scan_name.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp
index b867a0462..3425425e2 100644
--- a/src/utils/scan_name.cpp
+++ b/src/utils/scan_name.cpp
@@ -54,11 +54,18 @@ SCAN_Name::SCAN_Name(const std::string& algo_spec)
std::string SCAN_Name::arg(u32bit i) const
{
- if(i > arg_count())
+ if(i >= arg_count())
throw std::range_error("SCAN_Name::argument");
return name[i+1];
}
+std::string SCAN_Name::arg(u32bit i, const std::string& def_value) const
+ {
+ if(i >= arg_count())
+ return def_value;
+ return name[i+1];
+ }
+
u32bit SCAN_Name::arg_as_u32bit(u32bit i, u32bit def_value) const
{
if(i >= arg_count())