From 48020eed9e5a7ad590572e2f1ad588a05f84e2b2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 24 Jun 2013 09:02:32 +0000 Subject: [PATCH] Introduced typedef's to make the code more readble and maintanable --- include/osgDB/InputStream | 3 ++- include/osgDB/OutputStream | 10 +++++++--- src/osgDB/InputStream.cpp | 2 +- src/osgDB/OutputStream.cpp | 12 ++++++------ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/osgDB/InputStream b/include/osgDB/InputStream index 68875944d..8ccb29b5c 100644 --- a/include/osgDB/InputStream +++ b/include/osgDB/InputStream @@ -186,7 +186,8 @@ protected: ArrayMap _arrayMap; IdentifierMap _identifierMap; - std::map _domainVersionMap; + typedef std::map VersionMap; + VersionMap _domainVersionMap; int _fileVersion; bool _useSchemaData; bool _forceReadingImage; diff --git a/include/osgDB/OutputStream b/include/osgDB/OutputStream index f9bf597f6..393d4c186 100644 --- a/include/osgDB/OutputStream +++ b/include/osgDB/OutputStream @@ -188,10 +188,14 @@ protected: ArrayMap _arrayMap; ObjectMap _objectMap; - std::map _domainVersionMap; + typedef std::map VersionMap; + VersionMap _domainVersionMap; WriteImageHint _writeImageHint; - bool _useSchemaData, _useRobustBinaryFormat; - std::map _inbuiltSchemaMap; + bool _useSchemaData; + bool _useRobustBinaryFormat; + + typedef std::map SchemaMap; + SchemaMap _inbuiltSchemaMap; std::vector _fields; std::string _schemaName; std::string _compressorName; diff --git a/src/osgDB/InputStream.cpp b/src/osgDB/InputStream.cpp index 859665b53..52851e08c 100644 --- a/src/osgDB/InputStream.cpp +++ b/src/osgDB/InputStream.cpp @@ -76,7 +76,7 @@ InputStream::~InputStream() int InputStream::getFileVersion( const std::string& d ) const { if ( d.empty() ) return _fileVersion; - std::map::const_iterator itr = _domainVersionMap.find(d); + VersionMap::const_iterator itr = _domainVersionMap.find(d); return itr==_domainVersionMap.end() ? 0 : itr->second; } diff --git a/src/osgDB/OutputStream.cpp b/src/osgDB/OutputStream.cpp index e5afe5613..7a3a67883 100644 --- a/src/osgDB/OutputStream.cpp +++ b/src/osgDB/OutputStream.cpp @@ -68,7 +68,7 @@ OutputStream::~OutputStream() int OutputStream::getFileVersion( const std::string& d ) const { if ( d.empty() ) return OPENSCENEGRAPH_SOVERSION; - std::map::const_iterator itr = _domainVersionMap.find(d); + VersionMap::const_iterator itr = _domainVersionMap.find(d); return itr==_domainVersionMap.end() ? 0 : itr->second; } @@ -563,14 +563,14 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t unsigned int attributes = 0; // From SOVERSION 98, start to support custom wrapper domains, enabling the attribute bit - if ( _domainVersionMap.size()>0 ) attributes |= 0x1; + if ( _domainVersionMap.size()>0 ) attributes |= 0x1; if ( _useSchemaData ) { attributes |= 0x2; // Record if we use inbuilt schema data or not useCompressSource = true; } - + // From SOVERSION 98, start to support binary begin/end brackets so we can easily ignore // errors and unsupport classes, enabling the attribute bit if ( _useRobustBinaryFormat ) @@ -585,7 +585,7 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t { unsigned int numDomains = _domainVersionMap.size(); *this << numDomains; - for ( std::map::iterator itr=_domainVersionMap.begin(); + for ( VersionMap::iterator itr=_domainVersionMap.begin(); itr!=_domainVersionMap.end(); ++itr ) { *this << itr->first << itr->second; @@ -633,7 +633,7 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t << std::string(osgGetVersion()) << std::endl; if ( _domainVersionMap.size()>0 ) { - for ( std::map::iterator itr=_domainVersionMap.begin(); + for ( VersionMap::iterator itr=_domainVersionMap.begin(); itr!=_domainVersionMap.end(); ++itr ) { *this << PROPERTY("#CustomDomain") << itr->first << itr->second << std::endl; @@ -655,7 +655,7 @@ void OutputStream::compress( std::ostream* ostream ) _fields.push_back( "SchemaData" ); std::string schemaData; - for ( std::map::iterator itr=_inbuiltSchemaMap.begin(); + for ( SchemaMap::iterator itr=_inbuiltSchemaMap.begin(); itr!=_inbuiltSchemaMap.end(); ++itr ) { schemaData += itr->first + '=';