Allow passing default value to Bench::GetXXXParameter()
Just an extra convenience for the benchmark functions.
This commit is contained in:
@@ -87,14 +87,16 @@ wxIMPLEMENT_APP_CONSOLE(BenchApp);
|
|||||||
|
|
||||||
Bench::Function *Bench::Function::ms_head = NULL;
|
Bench::Function *Bench::Function::ms_head = NULL;
|
||||||
|
|
||||||
long Bench::GetNumericParameter()
|
long Bench::GetNumericParameter(long defVal)
|
||||||
{
|
{
|
||||||
return wxGetApp().GetNumericParameter();
|
const long val = wxGetApp().GetNumericParameter();
|
||||||
|
return val ? val : defVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Bench::GetStringParameter()
|
wxString Bench::GetStringParameter(const wxString& defVal)
|
||||||
{
|
{
|
||||||
return wxGetApp().GetStringParameter();
|
const wxString& val = wxGetApp().GetStringParameter();
|
||||||
|
return !val.empty() ? val : defVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ private:
|
|||||||
Tests may use this parameter in whatever way they see fit, by default it is
|
Tests may use this parameter in whatever way they see fit, by default it is
|
||||||
1 but can be set to a different value by user from the command line.
|
1 but can be set to a different value by user from the command line.
|
||||||
*/
|
*/
|
||||||
long GetNumericParameter();
|
long GetNumericParameter(long defValue = 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the string parameter.
|
Get the string parameter.
|
||||||
@@ -91,7 +91,7 @@ long GetNumericParameter();
|
|||||||
Tests may use this parameter in whatever way they see fit, by default it is
|
Tests may use this parameter in whatever way they see fit, by default it is
|
||||||
empty but can be set to a different value by user from the command line.
|
empty but can be set to a different value by user from the command line.
|
||||||
*/
|
*/
|
||||||
wxString GetStringParameter();
|
wxString GetStringParameter(const wxString& defValue = wxString());
|
||||||
|
|
||||||
} // namespace Bench
|
} // namespace Bench
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user