1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12 */
13
14 #include <osgDB/Options>
15 #include <osgDB/Registry>
16
17 using namespace osgDB;
18
Options(const Options & options,const osg::CopyOp & copyop)19 Options::Options(const Options& options,const osg::CopyOp& copyop):
20 osg::Object(options,copyop),
21 _str(options._str),
22 _databasePaths(options._databasePaths),
23 _objectCacheHint(options._objectCacheHint),
24 _objectCache(options._objectCache),
25 _precisionHint(options._precisionHint),
26 _buildKdTreesHint(options._buildKdTreesHint),
27 _pluginData(options._pluginData),
28 _pluginStringData(options._pluginStringData),
29 _findFileCallback(options._findFileCallback),
30 _readFileCallback(options._readFileCallback),
31 _writeFileCallback(options._writeFileCallback),
32 _fileLocationCallback(options._fileLocationCallback),
33 _fileCache(options._fileCache),
34 _terrain(options._terrain),
35 _parentGroup(options._parentGroup) {}
36
parsePluginStringData(const std::string & str,char separator1,char separator2)37 void Options::parsePluginStringData(const std::string& str, char separator1, char separator2)
38 {
39 StringList valueList;
40 split(str, valueList, separator1);
41 if (valueList.size() > 0)
42 {
43 StringList keyAndValue;
44 for (StringList::iterator itr=valueList.begin(); itr!=valueList.end(); ++itr)
45 {
46 split(*itr, keyAndValue, separator2);
47 if (keyAndValue.size() > 1)
48 {
49 setPluginStringData(keyAndValue.front(), keyAndValue.back());
50 }
51 else if (keyAndValue.size() > 0)
52 {
53 setPluginStringData(keyAndValue.front(), "true");
54 }
55 keyAndValue.clear();
56 }
57 }
58 }
59