From Wang Rui, "a new parsePluginStringData() method in the osgDB::Options class which will be automatically executed to parse option string to the string data map"

This commit is contained in:
Robert Osfield
2010-11-03 10:37:02 +00:00
parent 1beedce6fc
commit afa563df57
2 changed files with 36 additions and 2 deletions

View File

@@ -30,3 +30,26 @@ Options::Options(const Options& options,const osg::CopyOp& copyop):
_writeFileCallback(options._writeFileCallback),
_fileLocationCallback(options._fileLocationCallback),
_fileCache(options._fileCache) {}
void Options::parsePluginStringData(const std::string& str, char separator1, char separator2)
{
StringList valueList;
split(str, valueList, separator1);
if (valueList.size() > 0)
{
StringList keyAndValue;
for (StringList::iterator itr=valueList.begin(); itr!=valueList.end(); ++itr)
{
split(*itr, keyAndValue, separator2);
if (keyAndValue.size() > 1)
{
setPluginStringData(keyAndValue.front(), keyAndValue.back());
}
else if (keyAndValue.size() > 0)
{
setPluginStringData(keyAndValue.front(), "true");
}
keyAndValue.clear();
}
}
}