Added ability for OSG serializers to get the file version number when writing out via the OutputStream object

This commit is contained in:
Robert Osfield 2017-06-19 12:04:03 +01:00
parent da7a0968be
commit 9f3533632a
2 changed files with 9 additions and 1 deletions

View File

@ -12,17 +12,22 @@ namespace osgDB
// forward declare
class InputStream;
class OutputStream;
class OSGDB_EXPORT OutputIterator : public osg::Referenced
{
public:
OutputIterator() : _out(0), _supportBinaryBrackets(false) {}
OutputIterator() : _out(0), _outputStream(0), _supportBinaryBrackets(false) {}
virtual ~OutputIterator() {}
void setStream( std::ostream* ostream ) { _out = ostream; }
std::ostream* getStream() { return _out; }
const std::ostream* getStream() const { return _out; }
void setOutputStream( OutputStream* outputStream) { _outputStream = outputStream; }
OutputStream* getOutputStream() { return _outputStream; }
const OutputStream* getOutputStream() const { return _outputStream; }
void setSupportBinaryBrackets( bool b ) { _supportBinaryBrackets = b; }
bool getSupportBinaryBrackets() const { return _supportBinaryBrackets; }
@ -69,6 +74,7 @@ protected:
}
std::ostream* _out;
osgDB::OutputStream* _outputStream;
bool _supportBinaryBrackets;
};

View File

@ -706,6 +706,8 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t
throwException( "OutputStream: Null stream specified." );
if ( getException() ) return;
_out->setOutputStream(this);
if ( isBinary() )
{
*this << (unsigned int)type << (unsigned int)OPENSCENEGRAPH_SOVERSION;