summaryrefslogtreecommitdiff
path: root/linguistic/source
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-05-03 22:11:02 +0300
committerMichael Stahl <Michael.Stahl@cib.de>2019-05-17 11:20:15 +0200
commit0e4c542f7a862e681baf25f042bc3a928c14004f (patch)
tree56582ddb40671a22eaaa54e1ab3058dc553b9d5d /linguistic/source
parent644ca26af744aec1e66c8dd4199d1228e0f780be (diff)
Use hasElements to check Sequence emptiness in [l-r]*
Similar to clang-tidy readability-container-size-empty Change-Id: Idd67f332b04857a39df26bad1733aae21236f105 Reviewed-on: https://gerrit.libreoffice.org/71764 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'linguistic/source')
-rw-r--r--linguistic/source/gciterator.cxx4
-rw-r--r--linguistic/source/hyphdsp.cxx14
-rw-r--r--linguistic/source/lngsvcmgr.cxx20
-rw-r--r--linguistic/source/spelldsp.cxx8
-rw-r--r--linguistic/source/thesdsp.cxx8
5 files changed, 27 insertions, 27 deletions
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 62322ae67032..7aca99026250 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -1093,7 +1093,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
uno::Any aTmp( xNA->getByName( pElementNames[i] ) );
if (aTmp >>= aImplNames)
{
- if (aImplNames.getLength() > 0)
+ if (aImplNames.hasElements())
{
// only the first entry is used, there should be only one grammar checker per language
const OUString aImplName( aImplNames[0] );
@@ -1149,7 +1149,7 @@ void GrammarCheckingIterator::SetServiceList(
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
OUString aImplName;
- if (rSvcImplNames.getLength() > 0)
+ if (rSvcImplNames.hasElements())
aImplName = rSvcImplNames[0]; // there is only one grammar checker per language
if (!LinguIsUnspecified(nLanguage) && nLanguage != LANGUAGE_DONTKNOW)
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 38cd240c2b76..fa0a77ff20a5 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -328,13 +328,13 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
- sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
+ sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
sal_Int32 i = 0;
Reference< XHyphenator > xHyph;
- if (pEntry->aSvcRefs.getLength() > 0)
+ if (pEntry->aSvcRefs.hasElements())
xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
@@ -460,13 +460,13 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
- sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
+ sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
sal_Int32 i = 0;
Reference< XHyphenator > xHyph;
- if (pEntry->aSvcRefs.getLength() > 0)
+ if (pEntry->aSvcRefs.hasElements())
xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
@@ -582,13 +582,13 @@ Reference< XPossibleHyphens > SAL_CALL
}
else
{
- sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
+ sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
sal_Int32 i = 0;
Reference< XHyphenator > xHyph;
- if (pEntry->aSvcRefs.getLength() > 0)
+ if (pEntry->aSvcRefs.hasElements())
xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
@@ -700,7 +700,7 @@ Sequence< OUString >
if (pEntry)
{
aRes = pEntry->aSvcImplNames;
- if (aRes.getLength() > 0)
+ if (aRes.hasElements())
aRes.realloc(1);
}
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 0c8e8e92f6d5..2f87177c2f1a 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -565,7 +565,7 @@ namespace
{
Sequence< OUString > aNames { rLastFoundList + "/" + rCfgLocaleStr };
Sequence< Any > aValues( rCfg.GetProperties( aNames ) );
- if (aValues.getLength())
+ if (aValues.hasElements())
{
SAL_WARN_IF( aValues.getLength() != 1, "linguistic", "unexpected length of sequence" );
Sequence< OUString > aSvcImplNames;
@@ -799,7 +799,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aSpellCheckerList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
@@ -822,7 +822,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aGrammarCheckerList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
@@ -848,7 +848,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aHyphenatorList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
@@ -871,7 +871,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aThesaurusList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
@@ -1677,7 +1677,7 @@ bool LngSvcMgr::SaveCfgSvcs( const OUString &rServiceName )
aLocales = getAvailableLocales( SN_THESAURUS );
}
- if (pDsp && aLocales.getLength())
+ if (pDsp && aLocales.hasElements())
{
sal_Int32 nLen = aLocales.getLength();
const lang::Locale *pLocale = aLocales.getConstArray();
@@ -1809,7 +1809,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
}
}
@@ -1821,7 +1821,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
}
}
@@ -1833,7 +1833,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
}
}
@@ -1845,7 +1845,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
- if (aValues.getLength())
+ if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
}
}
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 522ee43a96e5..ecb8ec723610 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -321,7 +321,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
- if (bTmpRes && 0 == rProperties.getLength())
+ if (bTmpRes && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
@@ -380,7 +380,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
- if (bTmpRes && 0 == rProperties.getLength())
+ if (bTmpRes && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
@@ -486,7 +486,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
- if (!xTmpRes.is() && 0 == rProperties.getLength())
+ if (!xTmpRes.is() && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
@@ -565,7 +565,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
- if (!xTmpRes.is() && 0 == rProperties.getLength())
+ if (!xTmpRes.is() && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index 77522e0f77cd..810729f704b6 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -139,7 +139,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
{
const Reference< XThesaurus > *pRef = pEntry->aSvcRefs.getConstArray();
while (i <= pEntry->nLastTriedSvcIndex
- && aMeanings.getLength() == 0)
+ && !aMeanings.hasElements())
{
if (pRef[i].is() && pRef[i]->hasLocale( rLocale ))
aMeanings = pRef[i]->queryMeanings( aChkWord, rLocale, rProperties );
@@ -148,7 +148,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
}
// if still no result instantiate new services and try those
- if (aMeanings.getLength() == 0
+ if (!aMeanings.hasElements()
&& pEntry->nLastTriedSvcIndex < nLen - 1)
{
const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
@@ -161,7 +161,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
Sequence< Any > aArgs(1);
aArgs.getArray()[0] <<= GetPropSet();
- while (i < nLen && aMeanings.getLength() == 0)
+ while (i < nLen && !aMeanings.hasElements())
{
// create specific service via it's implementation name
Reference< XThesaurus > xThes;
@@ -186,7 +186,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
// if language is not supported by any of the services
// remove it from the list.
- if (i == nLen && aMeanings.getLength() == 0)
+ if (i == nLen && !aMeanings.hasElements())
{
if (!SvcListHasLanguage( pEntry->aSvcRefs, rLocale ))
aSvcMap.erase( nLanguage );