Added support for bool in ArgumentParser::Parameter.
Added support for using Input::read(...) methods using ArgumentParser::Paramter to adapter to multiple paramter types.
This commit is contained in:
@@ -33,6 +33,7 @@ class OSG_EXPORT ArgumentParser
|
||||
public:
|
||||
enum ParameterType
|
||||
{
|
||||
BOOL_PARAMETER,
|
||||
FLOAT_PARAMETER,
|
||||
DOUBLE_PARAMETER,
|
||||
INT_PARAMETER,
|
||||
@@ -42,6 +43,7 @@ class OSG_EXPORT ArgumentParser
|
||||
|
||||
union ValueUnion
|
||||
{
|
||||
bool* _bool;
|
||||
float* _float;
|
||||
double* _double;
|
||||
int* _int;
|
||||
@@ -49,6 +51,8 @@ class OSG_EXPORT ArgumentParser
|
||||
std::string* _string;
|
||||
};
|
||||
|
||||
Parameter(bool& value) { _type = BOOL_PARAMETER; _value._bool = &value; }
|
||||
|
||||
Parameter(float& value) { _type = FLOAT_PARAMETER; _value._float = &value; }
|
||||
|
||||
Parameter(double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; }
|
||||
@@ -83,6 +87,9 @@ class OSG_EXPORT ArgumentParser
|
||||
/** Return true if specified parameter is a number. */
|
||||
static bool isNumber(const char* str);
|
||||
|
||||
/** Return true if specified parameter is a bool. */
|
||||
static bool isBool(const char* str);
|
||||
|
||||
public:
|
||||
|
||||
ArgumentParser(int* argc,char **argv);
|
||||
|
||||
Reference in New Issue
Block a user