diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-10-24 00:49:27 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-24 14:45:19 +0200 |
commit | 86192438d16ec160d6b59d08735e770ee05ac113 (patch) | |
tree | 25dbb9dde6631d49b0ea8483c8f3018def3ddd0d /toolkit/source/controls/unocontrolmodel.cxx | |
parent | 6f50961e69406a17d6ec998956a6b33208b1001b (diff) |
Simplify containers iterations in test..tools
Use range-based loop or replace with STL functions.
Change-Id: If8fac9236a4696c8e56c0e81c60c429782581b96
Reviewed-on: https://gerrit.libreoffice.org/62262
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit/source/controls/unocontrolmodel.cxx')
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index e27ec6da790e..b59d4ce0e22d 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -140,8 +140,8 @@ css::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const css::uno::Sequence<sal_Int32> aIDs( nIDs ); sal_Int32* pIDs = aIDs.getArray(); sal_uInt32 n = 0; - for ( ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it ) - pIDs[n++] = it->first; + for ( const auto& rData : maData ) + pIDs[n++] = rData.first; return aIDs; } @@ -408,11 +408,10 @@ void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId ) void UnoControlModel::ImplRegisterProperties( const std::vector< sal_uInt16 > &rIds ) { - std::vector< sal_uInt16 >::const_iterator iter; - for( iter = rIds.begin(); iter != rIds.end(); ++iter) + for (const auto& rId : rIds) { - if( !ImplHasProperty( *iter ) ) - ImplRegisterProperty( *iter, ImplGetDefaultValue( *iter ) ); + if( !ImplHasProperty( rId ) ) + ImplRegisterProperty( rId, ImplGetDefaultValue( rId ) ); } } @@ -538,12 +537,12 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt std::set<sal_uInt16> aProps; - for (ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it ) + for (const auto& rData : maData) { - if ( ( ( GetPropertyAttribs( it->first ) & css::beans::PropertyAttribute::TRANSIENT ) == 0 ) - && ( getPropertyState( GetPropertyName( it->first ) ) != css::beans::PropertyState_DEFAULT_VALUE ) ) + if ( ( ( GetPropertyAttribs( rData.first ) & css::beans::PropertyAttribute::TRANSIENT ) == 0 ) + && ( getPropertyState( GetPropertyName( rData.first ) ) != css::beans::PropertyState_DEFAULT_VALUE ) ) { - aProps.insert( it->first ); + aProps.insert( rData.first ); } } @@ -552,13 +551,13 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt // Save FontProperty always in the old format (due to missing distinction // between 5.0 and 5.1) OutStream->writeLong( ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() ) ? ( nProps + 3 ) : nProps ); - for ( std::set<sal_uInt16>::const_iterator it = aProps.begin(); it != aProps.end(); ++it ) + for ( const auto& rProp : aProps ) { sal_Int32 nPropDataBeginMark = xMark->createMark(); OutStream->writeLong( 0 ); // DataLen - const css::uno::Any* pProp = &(maData[*it]); - OutStream->writeShort( *it ); + const css::uno::Any* pProp = &(maData[rProp]); + OutStream->writeShort( rProp ); bool bVoid = pProp->getValueType().getTypeClass() == css::uno::TypeClass_VOID; @@ -687,7 +686,7 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt SAL_WARN( "toolkit", "UnoControlModel::write: don't know how to handle a property of type '" << rType.getTypeName() << "'.\n(Currently handling property '" - << GetPropertyName( *it ) + << GetPropertyName( rProp ) << "'.)"); } #endif |