diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-02 13:39:20 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-02 13:37:13 +0200 |
commit | deffca13fd8a765ddc518cfcff464cb1b6f5c65a (patch) | |
tree | e1a34de7398b803bca75fc9dcd69985cc8b9fc18 | |
parent | e2abbc0062398ea67cb13cb5b0b7bfdce78e652c (diff) |
Use hasElements to check Sequence emptiness in [t-u]*
Similar to clang-tidy readability-container-size-empty
Change-Id: Idefe55e37f5c837c889548ffe7c5711400012a4d
Reviewed-on: https://gerrit.libreoffice.org/71667
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
52 files changed, 76 insertions, 80 deletions
diff --git a/test/source/container/xnameaccess.cxx b/test/source/container/xnameaccess.cxx index 34b5e95da668..13199b9764b1 100644 --- a/test/source/container/xnameaccess.cxx +++ b/test/source/container/xnameaccess.cxx @@ -38,7 +38,7 @@ void XNameAccess::testGetElementNames() uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW); uno::Sequence<OUString> aNames = xNA->getElementNames(); - CPPUNIT_ASSERT(aNames.getLength()); + CPPUNIT_ASSERT(aNames.hasElements()); } void XNameAccess::testHasByName() diff --git a/test/source/lang/xserviceinfo.cxx b/test/source/lang/xserviceinfo.cxx index eeba62784b14..9db9e4b1cbe3 100644 --- a/test/source/lang/xserviceinfo.cxx +++ b/test/source/lang/xserviceinfo.cxx @@ -34,7 +34,7 @@ void XServiceInfo::testGetSupportedServiceNames() uno::Reference<lang::XServiceInfo> xSI(init(), uno::UNO_QUERY_THROW); uno::Sequence<OUString> aServiceNames = xSI->getSupportedServiceNames(); - CPPUNIT_ASSERT(aServiceNames.getLength()); + CPPUNIT_ASSERT(aServiceNames.hasElements()); } void XServiceInfo::testSupportsService() diff --git a/test/source/sheet/globalsheetsettings.cxx b/test/source/sheet/globalsheetsettings.cxx index d877e7c3ceab..0fd2e1aae21d 100644 --- a/test/source/sheet/globalsheetsettings.cxx +++ b/test/source/sheet/globalsheetsettings.cxx @@ -172,8 +172,7 @@ void GlobalSheetSettings::testGlobalSheetSettingsProperties() aNewValue <<= uno::Sequence<OUString>(); xGlobalSheetSettings->setPropertyValue(propName, aNewValue); CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUserLists); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue UserLists", sal_Int32(0), - aUserLists.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue UserLists", !aUserLists.hasElements()); propName = "LinkUpdateMode"; sal_Int16 aLinkUpdateMode = 42; diff --git a/test/source/sheet/xcellrangedata.cxx b/test/source/sheet/xcellrangedata.cxx index 223fd5f7b32d..cc8345ab26e9 100644 --- a/test/source/sheet/xcellrangedata.cxx +++ b/test/source/sheet/xcellrangedata.cxx @@ -69,7 +69,7 @@ void XCellRangeData::testGetDataArray() { uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); uno::Sequence< uno::Sequence < Any > > aColRow = xCellRangeData->getDataArray(); - CPPUNIT_ASSERT(aColRow.getLength()); + CPPUNIT_ASSERT(aColRow.hasElements()); } void XCellRangeData::testGetDataArrayOnTableSheet() diff --git a/test/source/sheet/xconsolidationdescriptor.cxx b/test/source/sheet/xconsolidationdescriptor.cxx index 5b95d0acf321..5161c500d1c1 100644 --- a/test/source/sheet/xconsolidationdescriptor.cxx +++ b/test/source/sheet/xconsolidationdescriptor.cxx @@ -49,7 +49,7 @@ void XConsolidationDescriptor::testGetSources() UNO_QUERY_THROW); uno::Sequence<table::CellRangeAddress> aSources = xConsolidationDescriptor->getSources(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get sources", sal_Int32(0), aSources.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get sources", !aSources.hasElements()); } void XConsolidationDescriptor::testSetSources() diff --git a/test/source/sheet/xdatapilottable2.cxx b/test/source/sheet/xdatapilottable2.cxx index dc23c1045cb4..221d722373b1 100644 --- a/test/source/sheet/xdatapilottable2.cxx +++ b/test/source/sheet/xdatapilottable2.cxx @@ -250,7 +250,7 @@ table::CellAddress getLastUsedCellAddress( uno::Reference< sheet::XSpreadsheet > void XDataPilotTable2::checkDrillDownSheetContent(uno::Reference< sheet::XSpreadsheet > const & xSheet, const uno::Sequence< uno::Sequence< Any > >& aData) { table::CellAddress aLastCell = getLastUsedCellAddress(xSheet, 0, 0); - CPPUNIT_ASSERT(aData.getLength() > 0); + CPPUNIT_ASSERT(aData.hasElements()); CPPUNIT_ASSERT(aLastCell.Row); CPPUNIT_ASSERT(aLastCell.Column); diff --git a/test/source/sheet/xfunctiondescriptions.cxx b/test/source/sheet/xfunctiondescriptions.cxx index fb3820590586..5c53b52971ac 100644 --- a/test/source/sheet/xfunctiondescriptions.cxx +++ b/test/source/sheet/xfunctiondescriptions.cxx @@ -55,7 +55,7 @@ void XFunctionDescriptions::testGetById() OUString aName2; uno::Sequence<beans::PropertyValue> aProps2 = xFD->getById(aId1); CPPUNIT_ASSERT_MESSAGE("Received empty FunctionDescriptions from getById()", - aProps2.getLength()); + aProps2.hasElements()); for (const auto& aProp : aProps2) { if (aProp.Name == "Id") diff --git a/test/source/sheet/xrecentfunctions.cxx b/test/source/sheet/xrecentfunctions.cxx index 1d88943d4e39..209c5e56e33d 100644 --- a/test/source/sheet/xrecentfunctions.cxx +++ b/test/source/sheet/xrecentfunctions.cxx @@ -46,7 +46,7 @@ void XRecentFunctions::testSetRecentFunctionIds() xRecentFunctions->setRecentFunctionIds(aIds); aIds = xRecentFunctions->getRecentFunctionIds(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set Ids (empty list)", sal_Int32(0), aIds.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to set Ids (empty list)", !aIds.hasElements()); // max. size list aIds.realloc(nMaxNumber); diff --git a/test/source/sheet/xscenarioenhanced.cxx b/test/source/sheet/xscenarioenhanced.cxx index 6f8b80cbe40c..e6c9568d142e 100644 --- a/test/source/sheet/xscenarioenhanced.cxx +++ b/test/source/sheet/xscenarioenhanced.cxx @@ -29,7 +29,7 @@ void XScenarioEnhanced::testGetRanges() uno::Reference<sheet::XScenarioEnhanced> xSE(getScenarioSpreadsheet(), UNO_QUERY_THROW); uno::Sequence<table::CellRangeAddress> aCellRangeAddr = xSE->getRanges(); - CPPUNIT_ASSERT_MESSAGE("No ranges found", aCellRangeAddr.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("No ranges found", aCellRangeAddr.hasElements()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong CellRangeAddres", table::CellRangeAddress(1, 0, 0, 10, 10), aCellRangeAddr[0]); diff --git a/test/source/sheet/xsheetfilterableex.cxx b/test/source/sheet/xsheetfilterableex.cxx index dee2a8a573d3..46759b224ae3 100644 --- a/test/source/sheet/xsheetfilterableex.cxx +++ b/test/source/sheet/xsheetfilterableex.cxx @@ -36,7 +36,7 @@ void XSheetFilterableEx::testCreateFilterDescriptorByObject() CPPUNIT_ASSERT_MESSAGE("no XSheetFilterDescriptor", xSFD.is()); uno::Sequence<sheet::TableFilterField> xTFF = xSFD->getFilterFields(); - CPPUNIT_ASSERT_MESSAGE("The gained XSheetFilterDescriptor is empty", xTFF.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("The gained XSheetFilterDescriptor is empty", xTFF.hasElements()); for (const auto& field : xTFF) { diff --git a/test/source/sheet/xsheetfilterdescriptor.cxx b/test/source/sheet/xsheetfilterdescriptor.cxx index 97214fb10dd2..71e601372c5e 100644 --- a/test/source/sheet/xsheetfilterdescriptor.cxx +++ b/test/source/sheet/xsheetfilterdescriptor.cxx @@ -27,8 +27,7 @@ void XSheetFilterDescriptor::testGetSetFilterFields() uno::Reference<sheet::XSheetFilterDescriptor> xSFD(init(), uno::UNO_QUERY_THROW); uno::Sequence<sheet::TableFilterField> aDefaultTFF = xSFD->getFilterFields(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get TableFilterField", sal_Int32(0), - aDefaultTFF.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); uno::Sequence<sheet::TableFilterField> aTFF; aTFF.realloc(1); diff --git a/test/source/sheet/xsheetfilterdescriptor2.cxx b/test/source/sheet/xsheetfilterdescriptor2.cxx index 0f501769272c..804d61e222ef 100644 --- a/test/source/sheet/xsheetfilterdescriptor2.cxx +++ b/test/source/sheet/xsheetfilterdescriptor2.cxx @@ -27,8 +27,7 @@ void XSheetFilterDescriptor2::testGetSetFilterFields2() uno::Reference<sheet::XSheetFilterDescriptor2> xSFD(init(), uno::UNO_QUERY_THROW); uno::Sequence<sheet::TableFilterField2> aDefaultTFF = xSFD->getFilterFields2(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get TableFilterField", sal_Int32(0), - aDefaultTFF.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); uno::Sequence<sheet::TableFilterField2> aTFF; aTFF.realloc(1); diff --git a/test/source/sheet/xsheetfilterdescriptor3.cxx b/test/source/sheet/xsheetfilterdescriptor3.cxx index 420135e10914..818ea2c1f32a 100644 --- a/test/source/sheet/xsheetfilterdescriptor3.cxx +++ b/test/source/sheet/xsheetfilterdescriptor3.cxx @@ -27,8 +27,7 @@ void XSheetFilterDescriptor3::testGetSetFilterFields3() uno::Reference<sheet::XSheetFilterDescriptor3> xSFD(init(), uno::UNO_QUERY_THROW); uno::Sequence<sheet::TableFilterField3> aDefaultTFF = xSFD->getFilterFields3(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get TableFilterField", sal_Int32(0), - aDefaultTFF.getLength()); + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); uno::Sequence<sheet::TableFilterField3> aTFF; aTFF.realloc(1); diff --git a/test/source/sheet/xsheetpagebreak.cxx b/test/source/sheet/xsheetpagebreak.cxx index 551271029f18..656a33a0cb0b 100644 --- a/test/source/sheet/xsheetpagebreak.cxx +++ b/test/source/sheet/xsheetpagebreak.cxx @@ -27,7 +27,7 @@ void XSheetPageBreak::testGetColumnPageBreaks() uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW); uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks(); - CPPUNIT_ASSERT_MESSAGE("Unable to get column page breaks", xColPageBreak.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("Unable to get column page breaks", xColPageBreak.hasElements()); } void XSheetPageBreak::testGetRowPageBreaks() @@ -35,7 +35,7 @@ void XSheetPageBreak::testGetRowPageBreaks() uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW); uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks(); - CPPUNIT_ASSERT_MESSAGE("Unable to get row page breaks", xRowPageBreak.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("Unable to get row page breaks", xRowPageBreak.hasElements()); } void XSheetPageBreak::testRemoveAllManualPageBreaks() diff --git a/test/source/sheet/xsubtotalfield.cxx b/test/source/sheet/xsubtotalfield.cxx index ff7871fe0237..41824a1d0f64 100644 --- a/test/source/sheet/xsubtotalfield.cxx +++ b/test/source/sheet/xsubtotalfield.cxx @@ -63,7 +63,7 @@ void XSubTotalField::testGetSetTotalColumns() uno::Reference< sheet::XSubTotalField > xSTF(init(), UNO_QUERY_THROW); uno::Sequence< sheet::SubTotalColumn > sDefaultCols = xSTF->getSubTotalColumns(); - CPPUNIT_ASSERT_MESSAGE("Unable to get SubTotalColumns", sDefaultCols.getLength() != 0); + CPPUNIT_ASSERT_MESSAGE("Unable to get SubTotalColumns", sDefaultCols.hasElements()); uno::Sequence< sheet::SubTotalColumn > sNewCols; sNewCols.realloc(1); diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 764236c7d119..ae59820d1be1 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -576,7 +576,7 @@ static bool performTest( !nullAny.hasValue() || (ifc && !ifc->is()), "getNullPolyAny"); bRet &= check( - xLBT->getNullPolySequence().member.getLength() == 0, + !xLBT->getNullPolySequence().member.hasElements(), "getNullPolySequence"); bRet &= check( xLBT->getNullPolyEnum().member == TestEnum_TEST, @@ -1105,7 +1105,7 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs ) bool bRet = false; try { - if (! rArgs.getLength()) + if (! rArgs.hasElements()) { throw RuntimeException( "no test object specified!\n" "usage : ServiceName of test object | -u unourl of test object" ); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index e13b535ea4d0..6a483bacdd17 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -1912,7 +1912,7 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const css::uno::Any for ( auto n = pListBox->GetEntryCount(); n; ) pListBox->SelectEntryPos( --n, false ); - if ( aItems.getLength() ) + if ( aItems.hasElements() ) selectItemsPos( aItems, true ); else pListBox->SetNoSelection(); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index f7612736efc6..8f7412437667 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -421,7 +421,7 @@ void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvent ++pEvents; aEvents.realloc( pEventsEnd - aEvents.getConstArray() ); - if ( !aEvents.getLength() ) + if ( !aEvents.hasElements() ) return; } } diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index 6668de2abc03..796de3d56a2a 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -585,7 +585,7 @@ namespace toolkitform // get selected items Sequence< sal_Int16 > aSelectIndices; OSL_VERIFY( xModelProps->getPropertyValue("SelectedItems") >>= aSelectIndices ); - if( aSelectIndices.getLength() > 0 ) + if( aSelectIndices.hasElements() ) { pListWidget->SelectedEntries.resize( 0 ); for( sal_Int32 i = 0; i < aSelectIndices.getLength(); i++ ) diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index 0765e2baed3b..4b229374b027 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -181,7 +181,7 @@ bool CachedContentResultSet::CCRS_Cache return ( m_pResult->FetchError & FetchError::ENDOFDATA ) && m_pResult->Orientation - && m_pResult->Rows.getLength(); + && m_pResult->Rows.hasElements(); } bool CachedContentResultSet::CCRS_Cache diff --git a/ucb/source/cacher/cacheddynamicresultsetstub.cxx b/ucb/source/cacher/cacheddynamicresultsetstub.cxx index 927a6ac4e08c..8197a0a6fe15 100644 --- a/ucb/source/cacher/cacheddynamicresultsetstub.cxx +++ b/ucb/source/cacher/cacheddynamicresultsetstub.cxx @@ -235,7 +235,7 @@ void SAL_CALL CachedDynamicResultSetStubFactory OSL_ENSURE( TargetCache.is(), "a TargetCache is needed" ); Reference< XDynamicResultSet > xSource( Source ); - if( SortingInfo.getLength() && + if( SortingInfo.hasElements() && !( xSource->getCapabilities() & ContentResultSetCapability::SORTED ) ) { diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx index be35593388c0..d1e085a3f826 100644 --- a/ucb/source/cacher/contentresultsetwrapper.cxx +++ b/ucb/source/cacher/contentresultsetwrapper.cxx @@ -544,7 +544,7 @@ void SAL_CALL ContentResultSetWrapper::addPropertyChangeListener( const OUString impl_getPropertyChangeListenerContainer(); bool bNeedRegister = !m_pPropertyChangeListeners-> - getContainedTypes().getLength(); + getContainedTypes().hasElements(); m_pPropertyChangeListeners->addInterface( aPropertyName, xListener ); if( bNeedRegister ) { @@ -589,7 +589,7 @@ void SAL_CALL ContentResultSetWrapper::addVetoableChangeListener( const OUString impl_getVetoableChangeListenerContainer(); bool bNeedRegister = !m_pVetoableChangeListeners-> - getContainedTypes().getLength(); + getContainedTypes().hasElements(); m_pVetoableChangeListeners->addInterface( rPropertyName, xListener ); if( bNeedRegister ) { @@ -645,7 +645,7 @@ void SAL_CALL ContentResultSetWrapper::removePropertyChangeListener( const OUStr m_pPropertyChangeListeners->removeInterface( rPropertyName, xListener ); - if( !m_pPropertyChangeListeners->getContainedTypes().getLength() ) + if( !m_pPropertyChangeListeners->getContainedTypes().hasElements() ) { impl_init_xPropertySetOrigin(); { @@ -698,7 +698,7 @@ void SAL_CALL ContentResultSetWrapper::removeVetoableChangeListener( const OUStr m_pVetoableChangeListeners->removeInterface( rPropertyName, xListener ); - if( !m_pVetoableChangeListeners->getContainedTypes().getLength() ) + if( !m_pVetoableChangeListeners->getContainedTypes().hasElements() ) { impl_init_xPropertySetOrigin(); { diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index 24687458cf64..907cef806449 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -364,9 +364,9 @@ void SAL_CALL UniversalContentBroker::initialize( const css::uno::Sequence< Any { { osl::MutexGuard aGuard(m_aMutex); - if (m_aArguments.getLength() != 0) + if (m_aArguments.hasElements()) { - if (aArguments.getLength() != 0 + if (aArguments.hasElements() && !(m_aArguments.getLength() == 2 && aArguments.getLength() == 2 && m_aArguments[0] == aArguments[0] @@ -378,7 +378,7 @@ void SAL_CALL UniversalContentBroker::initialize( const css::uno::Sequence< Any } return; } - if (aArguments.getLength() == 0) + if (!aArguments.hasElements()) { m_aArguments.realloc(2); m_aArguments[0] <<= OUString("Local"); diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index eb28a1eb3a7b..b746167807a4 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -889,7 +889,7 @@ Reference< XMultiServiceFactory > PropertySetRegistry::getConfigProvider() { const Sequence< Any >& rInitArgs = m_pImpl->m_aInitArgs; - if ( rInitArgs.getLength() > 0 ) + if ( rInitArgs.hasElements() ) { // Extract config provider from service init args. rInitArgs[ 0 ] >>= m_pImpl->m_xConfigProvider; diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 8a680d6193bb..2f5dd71fc857 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1794,7 +1794,7 @@ namespace cmis else if ( aCommand.Name == "setPropertyValues" ) { uno::Sequence< beans::PropertyValue > aProperties; - if ( !( aCommand.Argument >>= aProperties ) || !aProperties.getLength() ) + if ( !( aCommand.Argument >>= aProperties ) || !aProperties.hasElements() ) ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv ); aRet <<= setPropertyValues( aProperties, xEnv ); } diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx index 9d5376c14d7c..f55c3418cc48 100644 --- a/ucb/source/ucp/ext/ucpext_content.cxx +++ b/ucb/source/ucp/ext/ucpext_content.cxx @@ -211,7 +211,7 @@ namespace ucb { namespace ucp { namespace ext // unreachable } - if ( !aProperties.getLength() ) + if ( !aProperties.hasElements() ) { ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException( OUString(), *this, -1 ) ), diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx index 9d6f962119c0..1f4543b22959 100644 --- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx +++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx @@ -129,7 +129,7 @@ namespace ucb { namespace ucp { namespace ext Sequence< Sequence< OUString > > aExtensionInfo( xPackageInfo->getExtensionList() ); for ( auto const & extInfo : aExtensionInfo ) { - if ( extInfo.getLength() <= 0 ) + if ( !extInfo.hasElements() ) { SAL_WARN( "ucb.ucp.ext", "illegal extension info" ); continue; diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index eb2d7d9b8489..2e5538286f00 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -399,7 +399,7 @@ BaseContent::addPropertiesChangeListener( m_pPropertyListener.reset( new PropertyListeners( m_aEventListenerMutex ) ); - if( PropertyNames.getLength() == 0 ) + if( !PropertyNames.hasElements() ) m_pPropertyListener->addInterface( OUString(),Listener ); else { diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx index 1930d8cc5f07..5a81536bdf38 100644 --- a/ucb/source/ucp/file/filtask.cxx +++ b/ucb/source/ucp/file/filtask.cxx @@ -2895,7 +2895,7 @@ TaskManager::copyPersistentSet( const OUString& srcUnqPath, uno::Sequence< beans::Property > seqProperty = x_src->getPropertySetInfo()->getProperties(); - if( seqProperty.getLength() ) + if( seqProperty.hasElements() ) { uno::Reference< XPersistentPropertySet > x_dstS = m_xFileRegistry->openPropertySet( new_Name,true ); diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index 197f45279caf..368876d90540 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -112,7 +112,7 @@ FileProvider::initialize( { if( ! m_pMyShell ) { OUString config; - if( aArguments.getLength() > 0 && + if( aArguments.hasElements() && (aArguments[0] >>= config) && config == "NoConfig" ) m_pMyShell.reset( new TaskManager( m_xContext, this, false ) ); diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index 9962b7b1d465..93cf2bf2b82f 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -830,7 +830,7 @@ Sequence<Any> FTPContent::setPropertyValues( } } - if(evt.getLength()) { + if(evt.hasElements()) { // title has changed notifyPropertiesChange(evt); (void)exchange(new FTPContentIdentifier(m_aFTPURL.ident(false,false))); diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index e3f2c0cb0222..087965399d86 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -968,7 +968,7 @@ uno::Any SAL_CALL Content::execute( else if ( aCommand.Name == "setPropertyValues" ) { uno::Sequence< beans::PropertyValue > aProperties; - if ( !( aCommand.Argument >>= aProperties ) || !aProperties.getLength() ) + if ( !( aCommand.Argument >>= aProperties ) || !aProperties.hasElements() ) ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv ); aRet <<= setPropertyValues( aProperties, xEnv ); } diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx index 056527010065..e0ac3c81fda7 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx +++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx @@ -340,7 +340,7 @@ uno::Any SAL_CALL HierarchyContent::execute( // Unreachable } - if ( !aProperties.getLength() ) + if ( !aProperties.hasElements() ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx index 1c626cc3deec..158cf62905f5 100644 --- a/ucb/source/ucp/hierarchy/hierarchydata.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx @@ -927,7 +927,7 @@ bool HierarchyEntry::first( iterator const & it ) } } - if ( it.m_pImpl->names.getLength() == 0 ) + if ( !it.m_pImpl->names.hasElements() ) return false; it.m_pImpl->pos = 0; diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx index 8dc85b8706ad..022f6ec7beb5 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx @@ -163,7 +163,7 @@ HierarchyContentProvider::queryContent( void SAL_CALL HierarchyContentProvider::initialize( const uno::Sequence< uno::Any >& aArguments ) { - if ( aArguments.getLength() > 0 ) + if ( aArguments.hasElements() ) OSL_FAIL( "HierarchyContentProvider::initialize : not supported!" ); } diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx index 2facec6e88a9..dba85a3a9d30 100644 --- a/ucb/source/ucp/package/pkgcontent.cxx +++ b/ucb/source/ucp/package/pkgcontent.cxx @@ -436,7 +436,7 @@ uno::Any SAL_CALL Content::execute( // Unreachable } - if ( !aProperties.getLength() ) + if ( !aProperties.hasElements() ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx index e74039e9a0d8..9dd5b6e6ae98 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.cxx +++ b/ucb/source/ucp/tdoc/tdoc_content.cxx @@ -365,7 +365,7 @@ uno::Any SAL_CALL Content::execute( // Unreachable } - if ( !aProperties.getLength() ) + if ( !aProperties.hasElements() ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 9c139fb4a30d..bd05e53fd880 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -493,7 +493,7 @@ uno::Any SAL_CALL Content::execute( // Unreachable } - if ( !aProperties.getLength() ) + if ( !aProperties.hasElements() ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( @@ -1392,7 +1392,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( aProperties = rProperties; } - if ( aProperties.getLength() > 0 ) + if ( aProperties.hasElements() ) ContentProperties::UCBNamesToDAVNames( aProperties, aPropNames ); diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx index 01d55bf6211c..04eccd0f0057 100644 --- a/ucbhelper/source/client/content.cxx +++ b/ucbhelper/source/client/content.cxx @@ -1201,7 +1201,7 @@ Reference< XContent > Content_Impl::getContent() Reference< XUniversalContentBroker > pBroker( UniversalContentBroker::create( getComponentContext() ) ); - OSL_ENSURE( pBroker->queryContentProviders().getLength(), + OSL_ENSURE( pBroker->queryContentProviders().hasElements(), "Content Broker not configured (no providers)!" ); Reference< XContentIdentifier > xId diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx index 5c64416a1c59..73b8a67d5949 100644 --- a/ucbhelper/source/provider/contenthelper.cxx +++ b/ucbhelper/source/provider/contenthelper.cxx @@ -527,7 +527,7 @@ void SAL_CALL ContentImplHelper::removeProperty( const OUString& Name ) // Success! - if ( xSet->getPropertySetInfo()->getProperties().getLength() == 0 ) + if ( !xSet->getPropertySetInfo()->getProperties().hasElements() ) { // Remove empty propertyset from registry. uno::Reference< css::ucb::XPropertySetRegistry > diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index 71ae2477f8e1..5445320c8150 100644 --- a/unotools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -207,7 +207,7 @@ void GlobalEventConfig_Impl::initBindingInfo() SAL_INFO("unotools", "reading binding for: " << lMacros[0]); Sequence< Any > lValues = GetProperties( lMacros ); OUString sMacroURL; - if( lValues.getLength() > 0 ) + if( lValues.hasElements() ) { lValues[0] >>= sMacroURL; sal_Int32 startIndex = lEventNames[i].indexOf('\''); diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 0ebbf953a712..11fb0816c3bf 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -916,7 +916,7 @@ bool SvtLinguConfig::GetSupportedDictionaryFormatsFor( xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); if (xNA->getByName( "SupportedDictionaryFormats" ) >>= rFormatList) bSuccess = true; - DBG_ASSERT( rFormatList.getLength(), "supported dictionary format list is empty" ); + DBG_ASSERT( rFormatList.hasElements(), "supported dictionary format list is empty" ); } catch (uno::Exception &) { @@ -965,9 +965,9 @@ bool SvtLinguConfig::GetDictionaryEntry( bSuccess = (xNA->getByName( "Locations" ) >>= aLocations) && (xNA->getByName( "Format" ) >>= aFormatName) && (xNA->getByName( "Locales" ) >>= aLocaleNames); - DBG_ASSERT( aLocations.getLength(), "Dictionary locations not set" ); + DBG_ASSERT( aLocations.hasElements(), "Dictionary locations not set" ); DBG_ASSERT( !aFormatName.isEmpty(), "Dictionary format name not set" ); - DBG_ASSERT( aLocaleNames.getLength(), "No locales set for the dictionary" ); + DBG_ASSERT( aLocaleNames.hasElements(), "No locales set for the dictionary" ); // if successful continue if (bSuccess) @@ -1174,7 +1174,7 @@ bool SvtLinguConfig::HasGrammarChecker() const xNA.set( xNA->getByName("GrammarCheckerList"), uno::UNO_QUERY_THROW ); uno::Sequence< OUString > aElementNames( xNA->getElementNames() ); - bRes = aElementNames.getLength() > 0; + bRes = aElementNames.hasElements(); } catch (const uno::Exception&) { diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx index 93cfe5d1a0bc..d63af0441701 100644 --- a/unotools/source/config/optionsdlg.cxx +++ b/unotools/source/config/optionsdlg.cxx @@ -146,7 +146,7 @@ void SvtOptionsDlgOptions_Impl::ReadNode( const OUString& _rNode, NodeType _eTyp { OUString sNodes( sNode + sSet ); Sequence< OUString > aNodes = GetNodeNames( sNodes ); - if ( aNodes.getLength() > 0 ) + if ( aNodes.hasElements() ) { for ( sal_uInt32 n = 0; n < static_cast<sal_uInt32>(aNodes.getLength()); ++n ) { diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index c0aa160b4264..f0489fdaf07a 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -116,7 +116,7 @@ private: void SvtUserOptions::ChangeListener::changesOccurred (util::ChangesEvent const& rEvent) { - if (rEvent.Changes.getLength()) + if (rEvent.Changes.hasElements()) m_rParent.Notify(); } diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index c7c651b3c9dc..cde0ad16aaee 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -154,9 +154,9 @@ void LocaleDataWrapper::invalidateData() xDefaultCalendar.reset(); xSecondaryCalendar.reset(); bSecondaryCalendarValid = false; - if (aGrouping.getLength()) + if (aGrouping.hasElements()) aGrouping[0] = 0; - if (aDateAcceptancePatterns.getLength()) + if (aDateAcceptancePatterns.hasElements()) aDateAcceptancePatterns = Sequence<OUString>(); } @@ -259,7 +259,7 @@ css::uno::Sequence< css::lang::Locale > LocaleDataWrapper::getAllInstalledLocale { uno::Sequence< lang::Locale > &rInstalledLocales = InstalledLocales::get(); - if ( rInstalledLocales.getLength() ) + if ( rInstalledLocales.hasElements() ) return rInstalledLocales; try @@ -281,7 +281,7 @@ css::uno::Sequence< css::lang::Locale > LocaleDataWrapper::getInstalledLocaleNam const uno::Sequence< lang::Locale > &rInstalledLocales = InstalledLocales::get(); - if ( !rInstalledLocales.getLength() ) + if ( !rInstalledLocales.hasElements() ) { LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), LanguageTag( LANGUAGE_SYSTEM) ); aLDW.getAllInstalledLocaleNames(); @@ -1080,7 +1080,7 @@ void LocaleDataWrapper::getDigitGroupingImpl() * sequence. Needed additional API and a locale data element. */ - if (!aGrouping.getLength()) + if (!aGrouping.hasElements()) { aGrouping.realloc(3); // room for {3,2,0} aGrouping[0] = 0; // invalidate @@ -1106,7 +1106,7 @@ void LocaleDataWrapper::getDigitGroupingImpl() const css::uno::Sequence< sal_Int32 > LocaleDataWrapper::getDigitGrouping() const { ::utl::ReadWriteGuard aGuard( aMutex ); - if (!aGrouping.getLength() || aGrouping[0] == 0) + if (!aGrouping.hasElements() || aGrouping[0] == 0) { // no cached content aGuard.changeReadToWrite(); const_cast<LocaleDataWrapper*>(this)->getDigitGroupingImpl(); @@ -1789,7 +1789,7 @@ css::uno::Sequence< OUString > LocaleDataWrapper::getDateAcceptancePatterns() co { ::utl::ReadWriteGuard aGuard( aMutex ); - if (aDateAcceptancePatterns.getLength()) + if (aDateAcceptancePatterns.hasElements()) return aDateAcceptancePatterns; aGuard.changeReadToWrite(); @@ -1814,7 +1814,7 @@ void LocaleDataWrapper::setDateAcceptancePatterns( { ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::Write ); - if (!aDateAcceptancePatterns.getLength() || !rPatterns.getLength()) + if (!aDateAcceptancePatterns.hasElements() || !rPatterns.hasElements()) { try { @@ -1824,9 +1824,9 @@ void LocaleDataWrapper::setDateAcceptancePatterns( { SAL_WARN( "unotools.i18n", "setDateAcceptancePatterns: Exception caught " << e ); } - if (!rPatterns.getLength()) + if (!rPatterns.hasElements()) return; // just a reset - if (!aDateAcceptancePatterns.getLength()) + if (!aDateAcceptancePatterns.hasElements()) { aDateAcceptancePatterns = rPatterns; return; diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx index fdbec07cfa83..4d90303df0d3 100644 --- a/unotools/source/misc/mediadescriptor.cxx +++ b/unotools/source/misc/mediadescriptor.cxx @@ -476,7 +476,7 @@ css::uno::Sequence< css::beans::NamedValue > MediaDescriptor::requestAndVerifyDo erase( PROP_ENCRYPTIONDATA() ); // insert valid password into media descriptor (but not a default password) - if( (aEncryptionData.getLength() > 0) && !bIsDefaultPassword ) + if( aEncryptionData.hasElements() && !bIsDefaultPassword ) (*this)[ PROP_ENCRYPTIONDATA() ] <<= aEncryptionData; return aEncryptionData; diff --git a/unotools/source/ucbhelper/progresshandlerwrap.cxx b/unotools/source/ucbhelper/progresshandlerwrap.cxx index d336af5dcb22..04719393267d 100644 --- a/unotools/source/ucbhelper/progresshandlerwrap.cxx +++ b/unotools/source/ucbhelper/progresshandlerwrap.cxx @@ -36,7 +36,7 @@ static bool getStatusFromAny_Impl( const Any& aAny, OUString& aText, sal_Int32& bool bNumIsSet = false; Sequence< Any > aSetList; - if( ( aAny >>= aSetList ) && aSetList.getLength() ) + if( ( aAny >>= aSetList ) && aSetList.hasElements() ) for( int ind = 0; ind < aSetList.getLength(); ind++ ) { if( !bNumIsSet && ( aSetList[ind] >>= nNum ) ) diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 40b42ad1538b..b9d79c0e4425 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -1281,7 +1281,7 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo else xSink = new UcbDataSink_Impl(xLockBytes.get()); - if ( rProps.getLength() ) + if ( rProps.hasElements() ) { Reference < XCommandProcessor > xProcessor( xContent, UNO_QUERY ); Command aCommand; diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 4d0a1ca91f3f..891ee882ec6a 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -1402,7 +1402,7 @@ void SAL_CALL librdf_Repository::setStatementRDFa( throw lang::IllegalArgumentException( "librdf_Repository::setStatementRDFa: Subject is null", *this, 0); } - if (!i_rPredicates.getLength()) { + if (!i_rPredicates.hasElements()) { throw lang::IllegalArgumentException( "librdf_Repository::setStatementRDFa: no Predicates", *this, 1); diff --git a/uui/source/iahndl-filter.cxx b/uui/source/iahndl-filter.cxx index 829d761b0d06..64bc7fe7ebc5 100644 --- a/uui/source/iahndl-filter.cxx +++ b/uui/source/iahndl-filter.cxx @@ -200,7 +200,7 @@ handleFilterOptionsRequest_( { } - if( xFilterCFG.is() && rRequest.rProperties.getLength() ) + if( xFilterCFG.is() && rRequest.rProperties.hasElements() ) { try { diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 6680ea4feae7..f0c6cdb67016 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -397,7 +397,7 @@ UUIInteractionHelper::handleRequest_impl( std::vector< OUString > aArguments; uno::Sequence< OUString > sModules = aModSizeException.Names; - if ( sModules.getLength() ) + if ( sModules.hasElements() ) { OUStringBuffer aName; for ( sal_Int32 index=0; index< sModules.getLength(); ++index ) @@ -1142,7 +1142,7 @@ UUIInteractionHelper::handleMacroConfirmRequest( bool bApprove = false; - bool bShowSignatures = aSignInfo.getLength() > 0; + bool bShowSignatures = aSignInfo.hasElements(); uno::Reference<awt::XWindow> xParent = getParentXWindow(); MacroWarning aWarning(Application::GetFrameWeld(xParent), bShowSignatures); diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx index ef8fef56a10f..de057886e792 100644 --- a/uui/source/passwordcontainer.cxx +++ b/uui/source/passwordcontainer.cxx @@ -61,9 +61,9 @@ bool fillContinuation( } return false; } - else if (aRec.UserList.getLength() != 0) + else if (aRec.UserList.hasElements()) { - if (aRec.UserList[0].Passwords.getLength() == 0) + if (!aRec.UserList[0].Passwords.hasElements()) { // Password sequence can be empty, for instance if master // password was not given (e.g. master pw dialog canceled) @@ -176,7 +176,7 @@ bool PasswordContainerHelper::handleAuthenticationRequest( if ( !rURL.isEmpty() ) aRec = m_xPasswordContainer->find(rURL, xIH1); - if ( aRec.UserList.getLength() == 0 ) + if ( !aRec.UserList.hasElements() ) { // compat: try server name. aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH1); @@ -200,7 +200,7 @@ bool PasswordContainerHelper::handleAuthenticationRequest( aRec = m_xPasswordContainer->findForName( rURL, rRequest.UserName, xIH1); - if ( aRec.UserList.getLength() == 0 ) + if ( !aRec.UserList.hasElements() ) { // compat: try server name. aRec = m_xPasswordContainer->findForName( |