diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-04 17:06:38 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-31 16:10:17 +0200 |
commit | 966f40eecfc60f20c309bc2477149442d753763a (patch) | |
tree | ed72f7b3d2fe609696834d47da120eeb4bd1460c /extensions | |
parent | 4830a1bae89a8ed60696503e315ffd42c70dff74 (diff) |
Use hasElements to check Sequence emptiness in [e-i]*
Similar to clang-tidy readability-container-size-empty
Change-Id: I79e31919db8f4132216f09a7868d18835eeb154b
Reviewed-on: https://gerrit.libreoffice.org/71795
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/bibliography/bibconfig.cxx | 2 | ||||
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 4 | ||||
-rw-r--r-- | extensions/source/bibliography/datman.cxx | 8 | ||||
-rw-r--r-- | extensions/source/dbpilots/controlwizard.cxx | 4 | ||||
-rw-r--r-- | extensions/source/dbpilots/groupboxwiz.cxx | 6 | ||||
-rw-r--r-- | extensions/source/logging/consolehandler.cxx | 2 | ||||
-rw-r--r-- | extensions/source/logging/loggerconfig.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 8 | ||||
-rw-r--r-- | extensions/source/propctrlr/genericpropertyhandler.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/objectinspectormodel.cxx | 6 | ||||
-rw-r--r-- | extensions/source/propctrlr/pcrcommon.hxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/propcontroller.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/stringrepresentation.cxx | 4 |
13 files changed, 26 insertions, 26 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 262d0cd8c763..daaa3702b03b 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -300,7 +300,7 @@ DBChangeDialogConfig_Impl::~DBChangeDialogConfig_Impl() const Sequence<OUString>& DBChangeDialogConfig_Impl::GetDataSourceNames() { - if(!aSourceNames.getLength()) + if(!aSourceNames.hasElements()) { Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext); diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 12af26f4cede..757cd195f61b 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -259,7 +259,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, { DBChangeDialogConfig_Impl aConfig; const Sequence<OUString> aSources = aConfig.GetDataSourceNames(); - if(aSources.getLength()) + if(aSources.hasElements()) aBibDesc.sDataSource = aSources.getConstArray()[0]; } @@ -564,7 +564,7 @@ sal_Bool BibliographyLoader::hasElements() { Reference< XResultSet > xCursor = GetDataCursor(); Reference< XNameAccess > xColumns = GetDataColumns(); - return xColumns.is() && (xColumns->getElementNames().getLength() != 0); + return xColumns.is() && xColumns->getElementNames().hasElements(); } Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo() diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 52720123935a..ad8215500d9a 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -148,7 +148,7 @@ static Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm) if (xSupplyCols.is()) xReturn = xSupplyCols->getColumns(); - if (!xReturn.is() || (xReturn->getElementNames().getLength() == 0)) + if (!xReturn.is() || !xReturn->getElementNames().hasElements()) { // no .... xReturn = nullptr; // -> get the table the form is bound to and ask it for their columns @@ -706,7 +706,7 @@ Reference< XForm > BibDataManager::createDatabaseForm(BibDBDescriptor& rDesc) if (xTables.is()) aTableNameSeq = xTables->getElementNames(); - if(aTableNameSeq.getLength() > 0) + if(aTableNameSeq.hasElements()) { if(!rDesc.sTableOrQuery.isEmpty()) aActiveDataTable = rDesc.sTableOrQuery; @@ -830,7 +830,7 @@ OUString BibDataManager::getQueryField() if(aFieldString.isEmpty()) { const Sequence< OUString > aSeq = getQueryFields(); - if(aSeq.getLength()>0) + if(aSeq.hasElements()) { aFieldString=aSeq[0]; } @@ -892,7 +892,7 @@ void BibDataManager::setActiveDataSource(const OUString& rURL) Reference< XNameAccess > xAccess = xSupplyTables->getTables(); aTableNameSeq = xAccess->getElementNames(); } - if(aTableNameSeq.getLength() > 0) + if(aTableNameSeq.hasElements()) { aActiveDataTable = aTableNameSeq[0]; aVal <<= aActiveDataTable; diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 9c8a00ee21d8..4453b72f95f0 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -625,7 +625,7 @@ namespace dbp return false; } - return 0 != m_aContext.aFieldNames.getLength(); + return m_aContext.aFieldNames.hasElements(); } @@ -683,7 +683,7 @@ namespace dbp bool OControlWizard::needDatasourceSelection() { // lemme see ... - return (0 == getContext().aFieldNames.getLength()); + return !getContext().aFieldNames.hasElements(); // if we got fields, the data source is valid ... } diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx index af4751428cf1..f8ee3b2129b5 100644 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ b/extensions/source/dbpilots/groupboxwiz.cxx @@ -100,7 +100,7 @@ namespace dbp return GBW_STATE_OPTIONVALUES; case GBW_STATE_OPTIONVALUES: - if (getContext().aFieldNames.getLength()) + if (getContext().aFieldNames.hasElements()) return GBW_STATE_DBFIELD; else return GBW_STATE_FINALIZE; @@ -131,7 +131,7 @@ namespace dbp if (!m_bVisitedDB) { // try to generate a default for the DB field // (simply use the first field in the DB names collection) - if (getContext().aFieldNames.getLength()) + if (getContext().aFieldNames.hasElements()) m_aSettings.sDBField = getContext().aFieldNames[0]; } m_bVisitedDB = true; @@ -180,7 +180,7 @@ namespace dbp get(m_pMoveLeft, "toleft"); get(m_pExistingRadios, "radiobuttons"); - if (getContext().aFieldNames.getLength()) + if (getContext().aFieldNames.hasElements()) { enableFormDatasourceDisplay(); } diff --git a/extensions/source/logging/consolehandler.cxx b/extensions/source/logging/consolehandler.cxx index e20350d5629c..346880936e3f 100644 --- a/extensions/source/logging/consolehandler.cxx +++ b/extensions/source/logging/consolehandler.cxx @@ -99,7 +99,7 @@ namespace logging { ::osl::MutexGuard aGuard( m_aMutex ); - if ( arguments.getLength() == 0 ) + if ( !arguments.hasElements() ) { // create() - nothing to init m_aHandlerHelper.setIsInitialized(); return; diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index b6cdfa1d0c01..9d04e98715bb 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -196,7 +196,7 @@ namespace logging if ( !sServiceName.isEmpty() ) { bool bSuccess = false; - if ( aSettings.getLength() ) + if ( aSettings.hasElements() ) { Sequence< Any > aConstructionArgs(1); aConstructionArgs[0] <<= aSettings; diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index edfb90cfa5f3..ed7348bfaa5d 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -226,7 +226,7 @@ namespace pcr { xStringResourceResolver.set( _xComponent->getPropertyValue( "ResourceResolver" ),UNO_QUERY); if( xStringResourceResolver.is() && - xStringResourceResolver->getLocales().getLength() > 0 ) + xStringResourceResolver->getLocales().hasElements() ) { xRet = xStringResourceResolver; } @@ -1806,7 +1806,7 @@ namespace pcr Any aListSourceValue( impl_getPropertyValue_throw( PROPERTY_LISTSOURCE ) ); if ( aListSourceValue >>= aListSource ) { - if ( aListSource.getLength() ) + if ( aListSource.hasElements() ) sListSource = aListSource[0]; } else @@ -1888,7 +1888,7 @@ namespace pcr { Sequence< OUString > aEntries; impl_getPropertyValue_throw( PROPERTY_STRINGITEMLIST ) >>= aEntries; - bool isEnabled = aEntries.getLength() != 0; + bool isEnabled = aEntries.hasElements(); if ( ( m_nClassId == FormComponentType::LISTBOX ) && ( m_eComponentClass == eFormControl ) ) { @@ -3103,7 +3103,7 @@ namespace pcr if ( aValue >>= aValueList ) { m_bPropertyValueIsList = true; - if ( aValueList.getLength() ) + if ( aValueList.hasElements() ) sValue = aValueList[0]; return sValue; } diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 7e91a0b79d51..267ab9bc6c78 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -468,7 +468,7 @@ namespace pcr Sequence< Property > aProperties; if ( xPSI.is() ) aProperties = xPSI->getProperties(); - DBG_ASSERT( aProperties.getLength(), "GenericPropertyHandler::getSupportedProperties: no properties!" ); + DBG_ASSERT( aProperties.hasElements(), "GenericPropertyHandler::getSupportedProperties: no properties!" ); for ( auto const & property : aProperties ) { diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index 5f2a3a694248..f210b848df6a 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -113,7 +113,7 @@ namespace pcr void SAL_CALL ObjectInspectorModel::initialize( const Sequence< Any >& _arguments ) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_aFactories.getLength() ) + if ( m_aFactories.hasElements() ) throw AlreadyInitializedException(); StlSyntaxSequence< Any > arguments( _arguments ); @@ -185,14 +185,14 @@ namespace pcr void ObjectInspectorModel::createWithHandlerFactories( const Sequence< Any >& _rFactories ) { - impl_verifyArgument_throw( _rFactories.getLength() > 0, 1 ); + impl_verifyArgument_throw( _rFactories.hasElements(), 1 ); m_aFactories = _rFactories; } void ObjectInspectorModel::createWithHandlerFactoriesAndHelpSection( const Sequence< Any >& _rFactories, sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ) { - impl_verifyArgument_throw( _rFactories.getLength() > 0, 1 ); + impl_verifyArgument_throw( _rFactories.hasElements(), 1 ); impl_verifyArgument_throw( _nMinHelpTextLines >= 1, 2 ); impl_verifyArgument_throw( _nMaxHelpTextLines >= 1, 3 ); impl_verifyArgument_throw( _nMinHelpTextLines <= _nMaxHelpTextLines, 2 ); diff --git a/extensions/source/propctrlr/pcrcommon.hxx b/extensions/source/propctrlr/pcrcommon.hxx index 9a596611330b..e200396a6c7e 100644 --- a/extensions/source/propctrlr/pcrcommon.hxx +++ b/extensions/source/propctrlr/pcrcommon.hxx @@ -93,7 +93,7 @@ namespace pcr iterator end() { return UnoBase::getArray() + UnoBase::getLength(); } sal_Int32 size() const { return UnoBase::getLength(); } - bool empty() const { return UnoBase::getLength() == 0; } + bool empty() const { return !UnoBase::hasElements(); } }; diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 1e45e28fe190..ca78d761124e 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -1218,7 +1218,7 @@ namespace pcr if ( !m_aPageIds.empty() ) { Sequence< PropertyCategoryDescriptor > aCategories( m_xModel->describeCategories() ); - if ( aCategories.getLength() ) + if ( aCategories.hasElements() ) m_pView->activatePage( m_aPageIds[ aCategories[0].ProgrammaticName ] ); else // allowed: if we default-created the pages ... diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index b28df28c0e0e..3d2fc67e0efb 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -280,7 +280,7 @@ OUString StringRepresentation::convertSimpleToString( const uno::Any& _rValue ) { try { - if ( m_aConstants.getLength() ) + if ( m_aConstants.hasElements() ) { sal_Int16 nConstantValue = 0; if ( _rValue >>= nConstantValue ) @@ -479,7 +479,7 @@ uno::Any StringRepresentation::convertStringToSimple( const OUString& _rValue,co { try { - if ( m_aConstants.getLength() && m_aValues.getLength() ) + if ( m_aConstants.hasElements() && m_aValues.hasElements() ) { const OUString* pIter = m_aValues.getConstArray(); const OUString* pEnd = pIter + m_aValues.getLength(); |