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:
@@ -97,3 +97,164 @@ osg::Node* Input::readNode(const std::string& fileName)
|
||||
{
|
||||
return readNodeFile(fileName,_options.get());
|
||||
}
|
||||
|
||||
bool Input::read(const char* str)
|
||||
{
|
||||
if ((*this)[0].matchWord(str))
|
||||
{
|
||||
(*this) += 1;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
(*this) += 2;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1, Parameter value2)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) &&
|
||||
value1.valid((*this)[1].getStr()) &&
|
||||
value2.valid((*this)[2].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
value2.assign((*this)[2].getStr());
|
||||
(*this) += 3;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) &&
|
||||
value1.valid((*this)[1].getStr()) &&
|
||||
value2.valid((*this)[2].getStr()) &&
|
||||
value3.valid((*this)[3].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
value2.assign((*this)[2].getStr());
|
||||
value3.assign((*this)[3].getStr());
|
||||
(*this) += 4;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) &&
|
||||
value1.valid((*this)[1].getStr()) &&
|
||||
value2.valid((*this)[2].getStr()) &&
|
||||
value3.valid((*this)[3].getStr()) &&
|
||||
value4.valid((*this)[4].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
value2.assign((*this)[2].getStr());
|
||||
value3.assign((*this)[3].getStr());
|
||||
value4.assign((*this)[4].getStr());
|
||||
(*this) += 5;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) &&
|
||||
value1.valid((*this)[1].getStr()) &&
|
||||
value2.valid((*this)[2].getStr()) &&
|
||||
value3.valid((*this)[3].getStr()) &&
|
||||
value4.valid((*this)[4].getStr()) &&
|
||||
value5.valid((*this)[5].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
value2.assign((*this)[2].getStr());
|
||||
value3.assign((*this)[3].getStr());
|
||||
value4.assign((*this)[4].getStr());
|
||||
value5.assign((*this)[5].getStr());
|
||||
(*this) += 6;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) &&
|
||||
value1.valid((*this)[1].getStr()) &&
|
||||
value2.valid((*this)[2].getStr()) &&
|
||||
value3.valid((*this)[3].getStr()) &&
|
||||
value4.valid((*this)[4].getStr()) &&
|
||||
value5.valid((*this)[5].getStr()) &&
|
||||
value6.valid((*this)[6].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
value2.assign((*this)[2].getStr());
|
||||
value3.assign((*this)[3].getStr());
|
||||
value4.assign((*this)[4].getStr());
|
||||
value5.assign((*this)[5].getStr());
|
||||
value6.assign((*this)[6].getStr());
|
||||
(*this) += 7;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) &&
|
||||
value1.valid((*this)[1].getStr()) &&
|
||||
value2.valid((*this)[2].getStr()) &&
|
||||
value3.valid((*this)[3].getStr()) &&
|
||||
value4.valid((*this)[4].getStr()) &&
|
||||
value5.valid((*this)[5].getStr()) &&
|
||||
value6.valid((*this)[6].getStr()) &&
|
||||
value7.valid((*this)[7].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
value2.assign((*this)[2].getStr());
|
||||
value3.assign((*this)[3].getStr());
|
||||
value4.assign((*this)[4].getStr());
|
||||
value5.assign((*this)[5].getStr());
|
||||
value6.assign((*this)[6].getStr());
|
||||
value7.assign((*this)[7].getStr());
|
||||
(*this) += 8;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8)
|
||||
{
|
||||
if ((*this)[0].matchWord(str) &&
|
||||
value1.valid((*this)[1].getStr()) &&
|
||||
value2.valid((*this)[2].getStr()) &&
|
||||
value3.valid((*this)[3].getStr()) &&
|
||||
value4.valid((*this)[4].getStr()) &&
|
||||
value5.valid((*this)[5].getStr()) &&
|
||||
value6.valid((*this)[6].getStr()) &&
|
||||
value7.valid((*this)[7].getStr()) &&
|
||||
value8.valid((*this)[8].getStr()))
|
||||
{
|
||||
value1.assign((*this)[1].getStr());
|
||||
value2.assign((*this)[2].getStr());
|
||||
value3.assign((*this)[3].getStr());
|
||||
value4.assign((*this)[4].getStr());
|
||||
value5.assign((*this)[5].getStr());
|
||||
value6.assign((*this)[6].getStr());
|
||||
value7.assign((*this)[7].getStr());
|
||||
value8.assign((*this)[8].getStr());
|
||||
(*this) += 9;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user