Added support for trimming the contents of parsed Xml graph
This commit is contained in:
@@ -45,6 +45,20 @@ XmlNode* osgDB::readXmlFile(const std::string& filename,const Options* options)
|
||||
}
|
||||
}
|
||||
|
||||
std::string osgDB::trimEnclosingSpaces(const std::string& str)
|
||||
{
|
||||
if (str.empty()) return str;
|
||||
|
||||
std::string::size_type start = str.find_first_not_of(' ');
|
||||
if (start==std::string::npos) return std::string();
|
||||
|
||||
std::string::size_type end = str.find_last_not_of(' ');
|
||||
if (end==std::string::npos) return std::string();
|
||||
|
||||
return std::string(str, start, (end-start)+1);
|
||||
}
|
||||
|
||||
|
||||
XmlNode* osgDB::readXmlStream(std::istream& fin)
|
||||
{
|
||||
XmlNode::Input input;
|
||||
@@ -120,7 +134,7 @@ void XmlNode::Input::readAllDataIntoBuffer()
|
||||
|
||||
void XmlNode::Input::skipWhiteSpace()
|
||||
{
|
||||
while(_currentPos<_buffer.size() && _buffer[_currentPos]==' ' || _buffer[_currentPos]=='\t' )
|
||||
while(_currentPos<_buffer.size() && (_buffer[_currentPos]==' ' || _buffer[_currentPos]=='\t'))
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<"_currentPos="<<_currentPos<<"_buffer.size()="<<_buffer.size()<<" v="<<_buffer[_currentPos]<<std::endl;
|
||||
++_currentPos;
|
||||
|
||||
Reference in New Issue
Block a user