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 /unotools/source | |
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>
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/config/eventcfg.cxx | 2 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 8 | ||||
-rw-r--r-- | unotools/source/config/optionsdlg.cxx | 2 | ||||
-rw-r--r-- | unotools/source/config/useroptions.cxx | 2 | ||||
-rw-r--r-- | unotools/source/i18n/localedatawrapper.cxx | 20 | ||||
-rw-r--r-- | unotools/source/misc/mediadescriptor.cxx | 2 | ||||
-rw-r--r-- | unotools/source/ucbhelper/progresshandlerwrap.cxx | 2 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucblockbytes.cxx | 2 |
8 files changed, 20 insertions, 20 deletions
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; |