diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-03 10:53:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-03 14:15:37 +0200 |
commit | 31d4562ca9e21f7b04960ac083765733e9a55118 (patch) | |
tree | 977b0cdd4a768a2eed9fef6a0f79ecff0b3250e6 | |
parent | bce779932b59990fbdf8278993f8bb9514781de2 (diff) |
use begin()/end() when working with Sequence
Change-Id: Icf9da6a24d72c073338f6fbb513d7250b3898015
Reviewed-on: https://gerrit.libreoffice.org/39469
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
20 files changed, 34 insertions, 35 deletions
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 9272d204b943..6da5394ec3c6 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -1253,7 +1253,7 @@ namespace basctl } // sort - std::sort( aModuleNames.getArray() , aModuleNames.getArray() + aModuleNames.getLength() , StringCompareLessThan ); + std::sort( aModuleNames.begin(), aModuleNames.end(), StringCompareLessThan ); return aModuleNames; } diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 438fab7d7e61..f39c49ac78e1 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -440,7 +440,7 @@ std::vector< Reference< XDataSeriesContainer > > Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW ); Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); std::transform( - aChartTypeSeq.getConstArray(), aChartTypeSeq.getConstArray() + aChartTypeSeq.getLength(), + aChartTypeSeq.begin(), aChartTypeSeq.end(), std::back_inserter( aResult ), lcl_ChartTypeToSeriesCnt() ); } diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index ba54572d5c33..6f872f17a062 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -308,7 +308,7 @@ void ImplObjectHierarchy::createAxesTree( { Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true ) ); if( !m_bOrderingForElementSelector ) - std::transform( aAxes.getConstArray(), aAxes.getConstArray() + aAxes.getLength(), + std::transform( aAxes.begin(), aAxes.end(), std::back_inserter( rContainer ), lcl_ObjectToOID( xChartDoc )); diff --git a/chart2/source/inc/CloneHelper.hxx b/chart2/source/inc/CloneHelper.hxx index ae739bbc6ab6..5c8b87f307f3 100644 --- a/chart2/source/inc/CloneHelper.hxx +++ b/chart2/source/inc/CloneHelper.hxx @@ -64,7 +64,7 @@ template< class Interface > css::uno::Sequence< css::uno::Reference<Interface> > & rDestination ) { rDestination.realloc( rSource.getLength()); - std::transform( rSource.getConstArray(), rSource.getConstArray() + rSource.getLength(), + std::transform( rSource.begin(), rSource.end(), rDestination.getArray(), CreateRefClone< Interface >()); } diff --git a/chart2/source/inc/ModifyListenerHelper.hxx b/chart2/source/inc/ModifyListenerHelper.hxx index 48f2e0b149b0..4a8dabc7d2ea 100644 --- a/chart2/source/inc/ModifyListenerHelper.hxx +++ b/chart2/source/inc/ModifyListenerHelper.hxx @@ -213,7 +213,7 @@ void addListenerToAllSequenceElements( const css::uno::Reference< css::util::XModifyListener > & xListener ) { if( xListener.is()) - std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(), + std::for_each( rSequence.begin(), rSequence.end(), impl::addListenerFunctor< T >( xListener )); } @@ -255,7 +255,7 @@ void removeListenerFromAllSequenceElements( const css::uno::Reference< css::util::XModifyListener > & xListener ) { if( xListener.is()) - std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(), + std::for_each( rSequence.begin(), rSequence.end(), impl::removeListenerFunctor< T >( xListener )); } diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index a8a84deb5a67..34fd73540e64 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -230,7 +230,7 @@ std::vector< Reference< chart2::data::XLabeledDataSequence > > const OUString& aRole, bool bMatchPrefix /* = false */ ) { std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVec; - std::remove_copy_if( aDataSequences.getConstArray(), aDataSequences.getConstArray() + aDataSequences.getLength(), + std::remove_copy_if( aDataSequences.begin(), aDataSequences.end(), std::back_inserter( aResultVec ), [&aRole, bMatchPrefix](const Reference< chart2::data::XLabeledDataSequence > & xSeq) {return !(lcl_MatchesRole(aRole, bMatchPrefix).operator()(xSeq));}); diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 384420c0681a..dfa434f41ea6 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -908,7 +908,7 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation { Sequence< OUString > aLabels = m_bDataInColumns ? this->getRowDescriptions() : this->getColumnDescriptions(); aResult.realloc( aLabels.getLength() ); - transform( aLabels.getConstArray(), aLabels.getConstArray() + aLabels.getLength(), + transform( aLabels.begin(), aLabels.end(), aResult.getArray(), CommonFunctors::makeAny< OUString >() ); } } @@ -925,7 +925,7 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation if( aData.getLength() ) { aResult.realloc( aData.getLength()); - transform( aData.getConstArray(), aData.getConstArray() + aData.getLength(), + transform( aData.begin(), aData.end(), aResult.getArray(), CommonFunctors::makeAny< double >()); } } @@ -990,7 +990,7 @@ void SAL_CALL InternalDataProvider::setDataByRangeRepresentation( if( nIndex>=0 ) { vector< double > aNewDataVec; - transform( aNewData.getConstArray(), aNewData.getConstArray() + aNewData.getLength(), + transform( aNewData.begin(), aNewData.end(), back_inserter( aNewDataVec ), CommonFunctors::AnyToDouble()); if( m_bDataInColumns ) m_aInternalData.setColumnValues( nIndex, aNewDataVec ); diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx index e942b6eaeb5b..855f5c5d2b30 100644 --- a/chart2/source/tools/UncachedDataSequence.cxx +++ b/chart2/source/tools/UncachedDataSequence.cxx @@ -174,7 +174,7 @@ Sequence< double > SAL_CALL UncachedDataSequence::getNumericalData() { Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation )); aResult.realloc( aValues.getLength()); - std::transform( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(), + std::transform( aValues.begin(), aValues.end(), aResult.getArray(), CommonFunctors::AnyToDouble()); } return aResult; @@ -189,7 +189,7 @@ Sequence< OUString > SAL_CALL UncachedDataSequence::getTextualData() { Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation )); aResult.realloc( aValues.getLength()); - std::transform( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(), + std::transform( aValues.begin(), aValues.end(), aResult.getArray(), CommonFunctors::AnyToString()); } return aResult; diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index 7a57de445f98..a32b8d8def87 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -478,18 +478,18 @@ void OPropertyContainerHelper::describeProperties(Sequence< Property >& _rProps) } // as our property vector is sorted by handles, not by name, we have to sort aOwnProps - std::sort(aOwnProps.getArray(), aOwnProps.getArray() + aOwnProps.getLength(), PropertyCompareByName()); + std::sort(aOwnProps.begin(), aOwnProps.end(), PropertyCompareByName()); // unfortunately the STL merge function does not allow the output range to overlap one of the input ranges, // so we need an extra sequence Sequence< Property > aOutput; aOutput.realloc(_rProps.getLength() + aOwnProps.getLength()); // do the merge - std::merge( _rProps.getConstArray(), _rProps.getConstArray() + _rProps.getLength(), // input 1 - aOwnProps.getConstArray(), aOwnProps.getConstArray() + aOwnProps.getLength(), // input 2 - aOutput.getArray(), // output - PropertyCompareByName() // compare operator - ); + std::merge( _rProps.begin(), _rProps.end(), // input 1 + aOwnProps.begin(), aOwnProps.end(), // input 2 + aOutput.getArray(), // output + PropertyCompareByName() // compare operator + ); // copy the output _rProps = aOutput; diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index 2ae4364d9c2d..c89e3c4e6f51 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -133,8 +133,8 @@ Sequence< Type > SAL_CALL java_sql_Statement_Base::getTypes( ) Sequence< Type > aOldTypes = java_sql_Statement_BASE::getTypes(); if ( m_pConnection.is() && !m_pConnection->isAutoRetrievingEnabled() ) { - (void) std::remove(aOldTypes.getArray(),aOldTypes.getArray() + aOldTypes.getLength(), - cppu::UnoType<XGeneratedResultSet>::get()); + std::remove(aOldTypes.begin(), aOldTypes.end(), + cppu::UnoType<XGeneratedResultSet>::get()); aOldTypes.realloc(aOldTypes.getLength() - 1); } diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 834984027a74..62ea7650590c 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -139,8 +139,8 @@ Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) Sequence< Type > aOldTypes = OStatement_BASE::getTypes(); if ( m_pConnection.is() && !m_pConnection->isAutoRetrievingEnabled() ) { - std::remove(aOldTypes.getArray(),aOldTypes.getArray() + aOldTypes.getLength(), - cppu::UnoType<XGeneratedResultSet>::get()); + std::remove(aOldTypes.begin(), aOldTypes.end(), + cppu::UnoType<XGeneratedResultSet>::get()); aOldTypes.realloc(aOldTypes.getLength() - 1); } diff --git a/connectivity/source/sdbcx/VDescriptor.cxx b/connectivity/source/sdbcx/VDescriptor.cxx index 5c9c899f7991..70463eadada5 100644 --- a/connectivity/source/sdbcx/VDescriptor.cxx +++ b/connectivity/source/sdbcx/VDescriptor.cxx @@ -86,9 +86,9 @@ namespace connectivity describeProperties( aProperties ); if ( isNew() ) - std::for_each( aProperties.getArray(), aProperties.getArray() + aProperties.getLength(), ResetROAttribute() ); + std::for_each( aProperties.begin(), aProperties.end(), ResetROAttribute() ); else - std::for_each( aProperties.getArray(), aProperties.getArray() + aProperties.getLength(), SetROAttribute() ); + std::for_each( aProperties.begin(), aProperties.end(), SetROAttribute() ); return new ::cppu::OPropertyArrayHelper( aProperties ); } diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 2a19133c1f8c..d72e534bb450 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -767,7 +767,7 @@ void OConnection::impl_checkTableQueryNames_nothrow() { Reference< XNameAccess > xTables( getTables() ); Sequence< OUString > aTableNames( xTables->getElementNames() ); - std::set< OUString > aSortedTableNames( aTableNames.getConstArray(), aTableNames.getConstArray() + aTableNames.getLength() ); + std::set< OUString > aSortedTableNames( aTableNames.begin(), aTableNames.end() ); Reference< XNameAccess > xQueries( getQueries() ); Sequence< OUString > aQueryNames( xQueries->getElementNames() ); diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx index 19b64557c5f4..bceddfcde856 100644 --- a/extensions/source/propctrlr/eformshelper.cxx +++ b/extensions/source/propctrlr/eformshelper.cxx @@ -593,7 +593,7 @@ namespace pcr if ( xInfo.is() ) { Sequence< Property > aProperties = xInfo->getProperties(); - std::for_each( aProperties.getConstArray(), aProperties.getConstArray() + aProperties.getLength(), + std::for_each( aProperties.begin(), aProperties.end(), PropertyBagInserter( _rBag ) ); } diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index be1b66519154..5ede817d6009 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -822,8 +822,8 @@ namespace pcr // the initial selection in the dialog Sequence< OUString > aNames( pEventHolder->getElementNames() ); - const OUString* pChosenEvent = std::find( aNames.getConstArray(), aNames.getConstArray() + aNames.getLength(), rForEvent.sListenerMethodName ); - sal_uInt16 nInitialSelection = (sal_uInt16)( pChosenEvent - aNames.getConstArray() ); + const OUString* pChosenEvent = std::find( aNames.begin(), aNames.end(), rForEvent.sListenerMethodName ); + sal_uInt16 nInitialSelection = (sal_uInt16)( pChosenEvent - aNames.begin() ); // the dialog SvxAbstractDialogFactory* pFactory = SvxAbstractDialogFactory::Create(); diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index b5d931aa8182..2998a8b15a14 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -116,7 +116,7 @@ namespace pcr OSL_FAIL( "EnumRepresentation::getDescriptions: caught an exception!" ); } - return std::vector< OUString >( aNames.getConstArray(), aNames.getConstArray() + aNames.getLength() ); + return std::vector< OUString >( aNames.begin(), aNames.end() ); } void EnumRepresentation::impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const @@ -162,8 +162,7 @@ namespace pcr Sequence< sal_Int32 > aValues; impl_getValues( aValues ); - sal_Int32 index = std::find( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(), - nAsInt ) - aValues.getConstArray(); + sal_Int32 index = std::find( aValues.begin(), aValues.end(), nAsInt ) - aValues.begin(); std::vector< OUString > aDescriptions( getDescriptions() ); if ( ( index >= 0 ) && ( index < (sal_Int32)aDescriptions.size() ) ) diff --git a/forms/source/component/propertybaghelper.cxx b/forms/source/component/propertybaghelper.cxx index 130008fd6ae2..53ed30505fca 100644 --- a/forms/source/component/propertybaghelper.cxx +++ b/forms/source/component/propertybaghelper.cxx @@ -260,7 +260,7 @@ namespace frm Sequence< Property > aProperties( xPSI->getProperties() ); Sequence< OUString > aPropertyNames( aProperties.getLength() ); - ::std::transform( aProperties.getConstArray(), aProperties.getConstArray() + aProperties.getLength(), + ::std::transform( aProperties.begin(), aProperties.end(), aPropertyNames.getArray(), SelectNameOfProperty() ); Sequence< Any > aValues; diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx index b4b883c2c471..d60e24b8488b 100644 --- a/oox/source/helper/zipstorage.cxx +++ b/oox/source/helper/zipstorage.cxx @@ -114,7 +114,7 @@ void ZipStorage::implGetElementNames( ::std::vector< OUString >& orElementNames { aNames = mxStorage->getElementNames(); if( aNames.getLength() > 0 ) - orElementNames.insert( orElementNames.end(), aNames.getConstArray(), aNames.getConstArray() + aNames.getLength() ); + orElementNames.insert( orElementNames.end(), aNames.begin(), aNames.end() ); } catch (Exception const& e) { diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx index 1527c4ef814a..2d2c14209f8f 100644 --- a/oox/source/ole/olestorage.cxx +++ b/oox/source/ole/olestorage.cxx @@ -288,7 +288,7 @@ void OleStorage::implGetElementNames( ::std::vector< OUString >& orElementNames { aNames = mxStorage->getElementNames(); if( aNames.getLength() > 0 ) - orElementNames.insert( orElementNames.end(), aNames.getConstArray(), aNames.getConstArray() + aNames.getLength() ); + orElementNames.insert( orElementNames.end(), aNames.begin(), aNames.end() ); } catch(const Exception& ) { diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 859fc221cc19..190f509a030e 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -2811,7 +2811,7 @@ bool lclExtractGroupMembers( ScFieldGroupMembers& rMembers, const Any& rElement if( rElement >>= aSeq ) { if( aSeq.hasElements() ) - rMembers.insert( rMembers.end(), aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength() ); + rMembers.insert( rMembers.end(), aSeq.begin(), aSeq.end() ); return true; } |