summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-05 13:27:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-06 08:35:23 +0200
commitab9b38a4064141705aa3a3de9a5d73b465ad3af3 (patch)
tree888fcc6b517c44d77e2d297c13ee84fb487dd7a7 /forms
parent13341ffa49d58f313a05edae4f4f04c215658e9f (diff)
use more begin()/end() for Sequence
Change-Id: I399be6b6ef7a6ce01e883569a177c0969bc29c69
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/DatabaseForm.cxx15
-rw-r--r--forms/source/component/Edit.cxx16
-rw-r--r--forms/source/component/FormComponent.cxx16
-rw-r--r--forms/source/component/ListBox.cxx42
-rw-r--r--forms/source/misc/componenttools.cxx4
5 files changed, 37 insertions, 56 deletions
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 89f3f0a6892c..aca5c0420a47 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -320,12 +320,9 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource )
Reference< XPropertySetInfo > xDestPSI( getPropertySetInfo(), UNO_QUERY_THROW );
Sequence< Property > aSourceProperties( xSourcePSI->getProperties() );
- for ( const Property* pSourceProperty = aSourceProperties.getConstArray();
- pSourceProperty != aSourceProperties.getConstArray() + aSourceProperties.getLength();
- ++pSourceProperty
- )
+ for ( auto const & sourceProperty : aSourceProperties )
{
- if ( xDestPSI->hasPropertyByName( pSourceProperty->Name ) )
+ if ( xDestPSI->hasPropertyByName( sourceProperty.Name ) )
continue;
// the initial value passed to XPropertyContainer is also used as default, usually. So, try
@@ -333,14 +330,14 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource )
Any aInitialValue;
if ( xSourcePropState.is() )
{
- aInitialValue = xSourcePropState->getPropertyDefault( pSourceProperty->Name );
+ aInitialValue = xSourcePropState->getPropertyDefault( sourceProperty.Name );
}
else
{
- aInitialValue = xSourceProps->getPropertyValue( pSourceProperty->Name );
+ aInitialValue = xSourceProps->getPropertyValue( sourceProperty.Name );
}
- addProperty( pSourceProperty->Name, pSourceProperty->Attributes, aInitialValue );
- setPropertyValue( pSourceProperty->Name, xSourceProps->getPropertyValue( pSourceProperty->Name ) );
+ addProperty( sourceProperty.Name, sourceProperty.Attributes, aInitialValue );
+ setPropertyValue( sourceProperty.Name, xSourceProps->getPropertyValue( sourceProperty.Name ) );
}
}
catch(const RuntimeException&)
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index edf84814e65f..478c9b9c94f1 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -424,35 +424,29 @@ namespace
}
Sequence< Property > aSourceProps( xSourceInfo->getProperties() );
- const Property* pSourceProps = aSourceProps.getConstArray();
- const Property* pSourcePropsEnd = aSourceProps.getConstArray() + aSourceProps.getLength();
- while ( pSourceProps != pSourcePropsEnd )
+ for ( auto const & sourceprop : aSourceProps )
{
- if ( !xDestInfo->hasPropertyByName( pSourceProps->Name ) )
+ if ( !xDestInfo->hasPropertyByName( sourceprop.Name ) )
{
- ++pSourceProps;
continue;
}
- Property aDestProp( xDestInfo->getPropertyByName( pSourceProps->Name ) );
+ Property aDestProp( xDestInfo->getPropertyByName( sourceprop.Name ) );
if ( 0 != ( aDestProp.Attributes & PropertyAttribute::READONLY ) )
{
- ++pSourceProps;
continue;
}
try
{
- _rxDest->setPropertyValue( pSourceProps->Name, _rxSource->getPropertyValue( pSourceProps->Name ) );
+ _rxDest->setPropertyValue( sourceprop.Name, _rxSource->getPropertyValue( sourceprop.Name ) );
}
catch(const IllegalArgumentException& e)
{
SAL_WARN( "forms.component", "could not transfer the property named '"
- << pSourceProps->Name
+ << sourceprop.Name
<< "'. " << e.Message );
}
-
- ++pSourceProps;
}
}
catch( const Exception& )
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 367238fd119b..296b06ca3d68 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -2366,12 +2366,9 @@ bool OBoundControlModel::impl_approveValueBinding_nolock( const Reference< XValu
// < SYNCHRONIZED
}
- for ( const Type* pType = aTypeCandidates.getConstArray();
- pType != aTypeCandidates.getConstArray() + aTypeCandidates.getLength();
- ++pType
- )
+ for ( auto const & type : aTypeCandidates )
{
- if ( _rxBinding->supportsType( *pType ) )
+ if ( _rxBinding->supportsType( type ) )
return true;
}
return false;
@@ -2598,14 +2595,11 @@ void OBoundControlModel::calculateExternalValueType()
if ( !m_xExternalBinding.is() )
return;
Sequence< Type > aTypeCandidates( getSupportedBindingTypes() );
- for ( const Type* pTypeCandidate = aTypeCandidates.getConstArray();
- pTypeCandidate != aTypeCandidates.getConstArray() + aTypeCandidates.getLength();
- ++pTypeCandidate
- )
+ for ( auto const & typeCandidate : aTypeCandidates )
{
- if ( m_xExternalBinding->supportsType( *pTypeCandidate ) )
+ if ( m_xExternalBinding->supportsType( typeCandidate ) )
{
- m_aExternalValueType = *pTypeCandidate;
+ m_aExternalValueType = typeCandidate;
break;
}
}
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 3e50047e1803..a5e6d61125ca 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -322,8 +322,8 @@ namespace frm
// copy to member
ValueList().swap(m_aListSourceValues);
::std::copy(
- aListSource.getConstArray(),
- aListSource.getConstArray() + aListSource.getLength(),
+ aListSource.begin(),
+ aListSource.end(),
::std::insert_iterator< ValueList >( m_aListSourceValues, m_aListSourceValues.end() )
);
@@ -467,21 +467,19 @@ namespace frm
// #i27024#
const Any* pSelectSequenceValue = nullptr;
- const OUString* pStartPos = _rPropertyNames.getConstArray();
- const OUString* pEndPos = _rPropertyNames.getConstArray() + _rPropertyNames.getLength();
const OUString* pSelectedItemsPos = ::std::find_if(
- pStartPos, pEndPos,
+ _rPropertyNames.begin(), _rPropertyNames.end(),
::std::bind2nd( ::std::equal_to< OUString >(), PROPERTY_SELECT_SEQ )
);
const OUString* pStringItemListPos = ::std::find_if(
- pStartPos, pEndPos,
+ _rPropertyNames.begin(), _rPropertyNames.end(),
::std::bind2nd( ::std::equal_to< OUString >(), PROPERTY_STRINGITEMLIST )
);
- if ( ( pSelectedItemsPos != pEndPos ) && ( pStringItemListPos != pEndPos ) )
+ if ( ( pSelectedItemsPos != _rPropertyNames.end() ) && ( pStringItemListPos != _rPropertyNames.end() ) )
{
// both properties are present
// -> remember the value for the select sequence
- pSelectSequenceValue = _rValues.getConstArray() + ( pSelectedItemsPos - pStartPos );
+ pSelectSequenceValue = _rValues.getConstArray() + ( pSelectedItemsPos - _rPropertyNames.begin() );
}
OBoundControlModel::setPropertyValues( _rPropertyNames, _rValues );
@@ -974,8 +972,8 @@ namespace frm
{
css::uno::Sequence<OUString> seqNames = xFieldNames->getElementNames();
::std::copy(
- seqNames.getConstArray(),
- seqNames.getConstArray() + seqNames.getLength(),
+ seqNames.begin(),
+ seqNames.end(),
::std::insert_iterator< ValueList >( aDisplayList, aDisplayList.end() )
);
if(*aBoundColumn == -1)
@@ -1229,14 +1227,12 @@ namespace frm
#if HAVE_FEATURE_DBCONNECTIVITY
sal_Int16 *pIndex = aSelectionIndicies.getArray();
- const Any *pValue = i_aValues.getConstArray();
- const Any * const pValueEnd = i_aValues.getConstArray() + i_aValues.getLength();
- for (;pValue < pValueEnd; ++pValue)
+ for ( auto const & value : i_aValues)
{
- if ( pValue->hasValue() )
+ if ( value.hasValue() )
{
ORowSetValue v;
- v.fill(*pValue);
+ v.fill(value);
v.setTypeKind( m_nConvertedBoundValuesType );
ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(), v );
if ( curValuePos != aValues.end() )
@@ -1401,8 +1397,8 @@ namespace frm
OSL_VERIFY( _rExternalValue >>= aSelectIndexesPure );
aSelectIndexes.realloc( aSelectIndexesPure.getLength() );
::std::copy(
- aSelectIndexesPure.getConstArray(),
- aSelectIndexesPure.getConstArray() + aSelectIndexesPure.getLength(),
+ aSelectIndexesPure.begin(),
+ aSelectIndexesPure.end(),
aSelectIndexes.getArray()
);
}
@@ -1535,8 +1531,8 @@ namespace frm
{
Sequence< OUString > aSelectedEntriesTexts( _rSelectSequence.getLength() );
::std::transform(
- _rSelectSequence.getConstArray(),
- _rSelectSequence.getConstArray() + _rSelectSequence.getLength(),
+ _rSelectSequence.begin(),
+ _rSelectSequence.end(),
aSelectedEntriesTexts.getArray(),
ExtractStringFromSequence_Safe( _rStringList )
);
@@ -1582,8 +1578,8 @@ namespace frm
{
Sequence< Any > aSelectedEntriesValues( _rSelectSequence.getLength() );
::std::transform(
- _rSelectSequence.getConstArray(),
- _rSelectSequence.getConstArray() + _rSelectSequence.getLength(),
+ _rSelectSequence.begin(),
+ _rSelectSequence.end(),
aSelectedEntriesValues.getArray(),
ExtractAnyFromValueList_Safe( _rStringList )
);
@@ -1616,8 +1612,8 @@ namespace frm
// expects int's
Sequence< sal_Int32 > aTransformed( aSelectSequence.getLength() );
::std::copy(
- aSelectSequence.getConstArray(),
- aSelectSequence.getConstArray() + aSelectSequence.getLength(),
+ aSelectSequence.begin(),
+ aSelectSequence.end(),
aTransformed.getArray()
);
aReturn <<= aTransformed;
diff --git a/forms/source/misc/componenttools.cxx b/forms/source/misc/componenttools.cxx
index ad929575d7f5..d57e67adeb78 100644
--- a/forms/source/misc/componenttools.cxx
+++ b/forms/source/misc/componenttools.cxx
@@ -60,8 +60,8 @@ namespace frm
void TypeBag::addTypes( const TypeSequence& _rTypes )
{
::std::copy(
- _rTypes.getConstArray(),
- _rTypes.getConstArray() + _rTypes.getLength(),
+ _rTypes.begin(),
+ _rTypes.end(),
::std::insert_iterator< TypeSet >( m_aTypes, m_aTypes.begin() )
);
}