Thanks Robert,

It should be good and readable to add some typedefs here.

Cheers,

Wang Rui



2013/6/24 Robert Osfield <[email protected]>

> Hi Rui,
>
> When doing my review of your changes I spotted a couple of places
> where a typedef wasn't used where I'd normally use one for the
> purposes of readability and maintainability so once I checked your
> changes in as is I went ahead and added typedef's for the std::map<>
> the changes are below.
>
> Cheers,
> Robert.
>
> $ svn diff
> Index: include/osgDB/InputStream
> ===================================================================
> --- include/osgDB/InputStream   (revision 13541)
> +++ include/osgDB/InputStream   (working copy)
> @@ -186,7 +186,8 @@
>      ArrayMap _arrayMap;
>      IdentifierMap _identifierMap;
>
> -    std::map<std::string, int> _domainVersionMap;
> +    typedef std::map<std::string, int> VersionMap;
> +    VersionMap _domainVersionMap;
>      int _fileVersion;
>      bool _useSchemaData;
>      bool _forceReadingImage;
> Index: include/osgDB/OutputStream
> ===================================================================
> --- include/osgDB/OutputStream  (revision 13541)
> +++ include/osgDB/OutputStream  (working copy)
> @@ -188,10 +188,14 @@
>      ArrayMap _arrayMap;
>      ObjectMap _objectMap;
>
> -    std::map<std::string, int> _domainVersionMap;
> +    typedef std::map<std::string, int> VersionMap;
> +    VersionMap _domainVersionMap;
>      WriteImageHint _writeImageHint;
> -    bool _useSchemaData, _useRobustBinaryFormat;
> -    std::map<std::string, std::string> _inbuiltSchemaMap;
> +    bool _useSchemaData;
> +    bool _useRobustBinaryFormat;
> +
> +    typedef std::map<std::string, std::string> SchemaMap;
> +    SchemaMap _inbuiltSchemaMap;
>      std::vector<std::string> _fields;
>      std::string _schemaName;
>      std::string _compressorName;
> Index: src/osgDB/OutputStream.cpp
> ===================================================================
> --- src/osgDB/OutputStream.cpp  (revision 13541)
> +++ src/osgDB/OutputStream.cpp  (working copy)
> @@ -68,7 +68,7 @@
>  int OutputStream::getFileVersion( const std::string& d ) const
>  {
>      if ( d.empty() ) return OPENSCENEGRAPH_SOVERSION;
> -    std::map<std::string, int>::const_iterator itr =
> _domainVersionMap.find(d);
> +    VersionMap::const_iterator itr = _domainVersionMap.find(d);
>      return itr==_domainVersionMap.end() ? 0 : itr->second;
>  }
>
> @@ -563,14 +563,14 @@
>          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 @@
>          {
>              unsigned int numDomains = _domainVersionMap.size();
>              *this << numDomains;
> -            for ( std::map<std::string, int>::iterator
> itr=_domainVersionMap.begin();
> +            for ( VersionMap::iterator itr=_domainVersionMap.begin();
>                    itr!=_domainVersionMap.end(); ++itr )
>              {
>                  *this << itr->first << itr->second;
> @@ -633,7 +633,7 @@
>                << std::string(osgGetVersion()) << std::endl;
>          if ( _domainVersionMap.size()>0 )
>          {
> -            for ( std::map<std::string, int>::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 @@
>          _fields.push_back( "SchemaData" );
>
>          std::string schemaData;
> -        for ( std::map<std::string, std::string>::iterator
> itr=_inbuiltSchemaMap.begin();
> +        for ( SchemaMap::iterator itr=_inbuiltSchemaMap.begin();
>                itr!=_inbuiltSchemaMap.end(); ++itr )
>          {
>              schemaData += itr->first + '=';
> Index: src/osgDB/InputStream.cpp
> ===================================================================
> --- src/osgDB/InputStream.cpp   (revision 13541)
> +++ src/osgDB/InputStream.cpp   (working copy)
> @@ -76,7 +76,7 @@
>  int InputStream::getFileVersion( const std::string& d ) const
>  {
>      if ( d.empty() ) return _fileVersion;
> -    std::map<std::string, int>::const_iterator itr =
> _domainVersionMap.find(d);
> +    VersionMap::const_iterator itr = _domainVersionMap.find(d);
>      return itr==_domainVersionMap.end() ? 0 : itr->second;
>  }
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to