diff --git a/src/osgPlugins/osg/AsciiStreamOperator.h b/src/osgPlugins/osg/AsciiStreamOperator.h index 4eab77afc..c57b092c5 100644 --- a/src/osgPlugins/osg/AsciiStreamOperator.h +++ b/src/osgPlugins/osg/AsciiStreamOperator.h @@ -102,6 +102,8 @@ public: virtual void writeWrappedString( const std::string& str ) { + OSG_NOTICE<<"writeWrappedString( "<get( ch ); checkStream(); + + // skip white space + while ( ch==' ' ) { - if ( str.size()==1 || (*str.rbegin())!='\"' ) + _in->get( ch ); checkStream(); + } + + if (ch=='"') + { + // we have an "wrapped string" + _in->get( ch ); checkStream(); + while ( ch!='"' ) { - char ch; - do + if (ch=='\\') { _in->get( ch ); checkStream(); - if ( ch=='\\' ) - { - _in->get( ch ); checkStream(); - if ( ch=='\"' ) - { - str += ch; ch = 0; - } - else if ( ch=='\\' ) - { - str += ch; - } - else - { - str += '\\'; str += ch; - } - } - else - str += ch; - } while ( ch!='\"' ); + str += ch; + } + else str += ch; + + _in->get( ch ); checkStream(); + } + } + else + { + // we have an unwrapped string, read to first space or end of line + while ( (ch!=' ') && (ch!=0) && (ch!='\n') ) + { + str += ch; + _in->get( ch ); checkStream(); } - str = str.substr(1, str.size()-2); } } - + virtual bool matchString( const std::string& str ) { std::string s; readString(s);