[PATCH] fdo#43460 sc: use isEmpty()

Jelle van der Waa (via Code Review) gerrit at gerrit.libreoffice.org
Mon Jun 17 07:56:46 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4316

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/16/4316/1

fdo#43460 sc: use isEmpty()

Change-Id: I062570091ebea0ad30f09b0358ab664a3ff949ef
---
M sc/source/core/data/documen3.cxx
M sc/source/core/data/postit.cxx
M sc/source/core/tool/compiler.cxx
M sc/source/core/tool/dbdata.cxx
M sc/source/core/tool/interpr2.cxx
M sc/source/filter/oox/pagesettings.cxx
M sc/source/filter/oox/querytablebuffer.cxx
M sc/source/filter/xml/XMLStylesExportHelper.cxx
M sc/source/filter/xml/xmlexprt.cxx
M sc/source/filter/xml/xmltabi.cxx
M sc/source/ui/docshell/docsh.cxx
M sc/source/ui/unoobj/chart2uno.cxx
M sc/source/ui/vba/vbafont.cxx
M sc/source/ui/view/dbfunc3.cxx
14 files changed, 26 insertions(+), 26 deletions(-)



diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 3c20d73..c6ef36a 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1942,7 +1942,7 @@
             aCellStr = GetString(nCol, nRow, nTab);
             if (!aCellStr.isEmpty())
             {
-                if (aTotal.getLength())
+                if (!aTotal.isEmpty())
                     aTotal.append(' ');
                 aTotal.append(aCellStr);
             }
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 3c03746..0e0cde3 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -777,13 +777,13 @@
     const ScPostIt* pNote = rDoc.GetNotes(rPos.Tab())->findByAddress( rPos );
     if( pNote && !pNote->IsCaptionShown() )
     {
-        if( aBuffer.getLength() > 0 )
+        if( !aBuffer.isEmpty() )
             aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) ).append( pNote->GetText() );
         pNoteCaption = pNote->GetOrCreateCaption( rPos );
     }
 
     // create a caption if any text exists
-    if( !pNoteCaption && (aBuffer.getLength() == 0) )
+    if( !pNoteCaption && aBuffer.isEmpty() )
         return 0;
 
     // prepare visible rectangle (add default distance to all borders)
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index afd50e1..a726f91 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5166,7 +5166,7 @@
         default:
             ;   // nothing
     }
-    if ( aBuffer.getLength() )
+    if ( !aBuffer.isEmpty() )
         rBuffer.append(aBuffer.makeStringAndClear());
     else
         rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 163e6fe..0b60852 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -234,19 +234,19 @@
 
     if (mpSortParam->maKeyState[0].bDoSort)
     {
-        if (aBuf.getLength())
+        if (!aBuf.isEmpty())
             aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
         aBuf.append(ScGlobal::GetRscString(STR_OPERATION_SORT));
     }
 
     if (mpSubTotal->bGroupActive[0] && !mpSubTotal->bRemoveOnly)
     {
-        if (aBuf.getLength())
+        if (!aBuf.isEmpty())
             aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
         aBuf.append(ScGlobal::GetRscString(STR_OPERATION_SUBTOTAL));
     }
 
-    if (!aBuf.getLength())
+    if (aBuf.isEmpty())
         aBuf.append(ScGlobal::GetRscString(STR_OPERATION_NONE));
 
     return aBuf.makeStringAndClear();
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index b42cf4d..16d460d 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -3052,7 +3052,7 @@
 
             aText.insert(0, aBlock.makeStringAndClear());
         }
-        if (aText.getLength() > 0)
+        if (!aText.isEmpty())
             aText.append( RTL_CONSTASCII_STRINGPARAM(UTF8_TH_BAHT) );
 
         // generate text for Satang value
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index fd90cc5..9e9f941 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -786,7 +786,7 @@
 
 void HeaderFooterParser::appendText()
 {
-    if( maBuffer.getLength() > 0 )
+    if( !maBuffer.isEmpty() )
     {
         getEndPos()->gotoEnd( sal_False );
         getEndPos()->setString( maBuffer.makeStringAndClear() );
diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx
index d80d06d..cf42cc5 100644
--- a/sc/source/filter/oox/querytablebuffer.cxx
+++ b/sc/source/filter/oox/querytablebuffer.cxx
@@ -93,7 +93,7 @@
 {
     if( !rTableName.isEmpty() )
     {
-        if( rTables.getLength() > 0 )
+        if( !rTables.isEmpty() )
             rTables.append( sal_Unicode( ';' ) );
         rTables.appendAscii( RTL_CONSTASCII_STRINGPARAM( "HTML__" ) ).append( rTableName );
     }
@@ -103,7 +103,7 @@
 {
     if( nTableIndex > 0 )
     {
-        if( rTables.getLength() > 0 )
+        if( !rTables.isEmpty() )
             rTables.append( sal_Unicode( ';' ) );
         rTables.appendAscii( RTL_CONSTASCII_STRINGPARAM( "HTML_" ) ).append( nTableIndex );
     }
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 6f87529..882948d 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -329,7 +329,7 @@
                 sTemp.append(sText[i]);
             ++i;
         }
-        if (sTemp.getLength())
+        if (!sTemp.isEmpty())
         {
             SvXMLElementExport aElemP(rExport, XML_NAMESPACE_TEXT, XML_P, true, false);
             rExport.GetTextParagraphExport()->exportText(sTemp.makeStringAndClear(), bPrevCharWasSpace);
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 2b72e89..f92e5a75 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1515,7 +1515,7 @@
             }
         }
         ::sax::Converter::encodeBase64(aBuffer, aPassHash);
-        if (aBuffer.getLength())
+        if (!aBuffer.isEmpty())
         {
             AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
             if ( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
@@ -2678,7 +2678,7 @@
                     ::sax::Converter::encodeBase64(aBuffer, aHash);
                     eHashUsed = PASSHASH_XL;
                 }
-                if (aBuffer.getLength())
+                if (!aBuffer.isEmpty())
                 {
                     AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
                     if ( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
@@ -3757,19 +3757,19 @@
                 sBufferRangeType.append(GetXMLToken(XML_REPEAT_COLUMN));
             if ((nRangeType & sheet::NamedRangeFlag::ROW_HEADER) == sheet::NamedRangeFlag::ROW_HEADER)
             {
-                if (sBufferRangeType.getLength() > 0)
+                if (!sBufferRangeType.isEmpty())
                     sBufferRangeType.appendAscii(" ");
                 sBufferRangeType.append(GetXMLToken(XML_REPEAT_ROW));
             }
             if ((nRangeType & sheet::NamedRangeFlag::FILTER_CRITERIA) == sheet::NamedRangeFlag::FILTER_CRITERIA)
             {
-                if (sBufferRangeType.getLength() > 0)
+                if (!sBufferRangeType.isEmpty())
                     sBufferRangeType.appendAscii(" ");
                 sBufferRangeType.append(GetXMLToken(XML_FILTER));
             }
             if ((nRangeType & sheet::NamedRangeFlag::PRINT_AREA) == sheet::NamedRangeFlag::PRINT_AREA)
             {
-                if (sBufferRangeType.getLength() > 0)
+                if (!sBufferRangeType.isEmpty())
                     sBufferRangeType.appendAscii(" ");
                 sBufferRangeType.append(GetXMLToken(XML_PRINT_RANGE));
             }
@@ -4509,7 +4509,7 @@
             {
                 ::sax::Converter::encodeBase64(aTrackedChangesKey,
                         GetDocument()->GetChangeTrack()->GetProtection());
-                if (aTrackedChangesKey.getLength())
+                if (!aTrackedChangesKey.isEmpty())
                     ++nPropsToAdd;
             }
 
@@ -4533,7 +4533,7 @@
             {
                 sal_Int32 nCount(rProps.getLength());
                 rProps.realloc(nCount + nPropsToAdd);
-                if (aTrackedChangesKey.getLength())
+                if (!aTrackedChangesKey.isEmpty())
                 {
                     rProps[nCount].Name = OUString("TrackedChangesProtectionKey");
                     rProps[nCount].Value <<= aTrackedChangesKey.makeStringAndClear();
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index a7f014c..1069f47 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -122,7 +122,7 @@
     if (bInUrl)
         return false;
 
-    if (aTabNameBuf.getLength() == 0)
+    if (aTabNameBuf.isEmpty())
         return false;
 
     rExtTabName = aTabNameBuf.makeStringAndClear();
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c3c7705..c38b397 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -990,14 +990,14 @@
         const sal_Unicode c = p[i];
         if (c == sal_Unicode(' '))
         {
-            if (aBuf.getLength())
+            if (!aBuf.isEmpty())
                 aTokens.push_back( aBuf.makeStringAndClear() );
         }
         else
             aBuf.append(c);
     }
 
-    if (aBuf.getLength())
+    if (!aBuf.isEmpty())
         aTokens.push_back( aBuf.makeStringAndClear() );
 
     rLang = LanguageType( 0 );
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 832f59c..f28d693 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -126,7 +126,7 @@
     OUStringBuffer aBuffer;
     ::std::for_each( rTableList.begin(), rTableList.end(), lcl_appendTableNumber( aBuffer ));
     // remove last trailing ' '
-    if( aBuffer.getLength() > 0 )
+    if( !aBuffer.isEmpty() )
         aBuffer.setLength( aBuffer.getLength() - 1 );
     return aBuffer.makeStringAndClear();
 }
@@ -2277,7 +2277,7 @@
                 if ( aUIString.GetChar(0) == (sal_Unicode) '.' )
                     aUIString.Erase( 0, 1 );
 
-                if( sRet.getLength() )
+                if( !sRet.isEmpty() )
                     sRet.append( (sal_Unicode) ';' );
                 sRet.append( aUIString );
             }
diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx
index 8eceec2..1f6ce31 100644
--- a/sc/source/ui/vba/vbafont.cxx
+++ b/sc/source/ui/vba/vbafont.cxx
@@ -336,7 +336,7 @@
     getItalic() >>= bValue;
     if( bValue )
     {
-        if( aStyles.getLength() )
+        if( !aStyles.isEmpty() )
             aStyles.appendAscii(" ");
         aStyles.appendAscii("Italic");
     }
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 96a08ce..622dbcc 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1320,7 +1320,7 @@
             aWordBuf.append(c);
     }
 
-    if (aWordBuf.getLength() > 0)
+    if (!aWordBuf.isEmpty())
     {
         OUString aWord = aWordBuf.makeStringAndClear();
         if (aWord.equals(rMemberName))

-- 
To view, visit https://gerrit.libreoffice.org/4316
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I062570091ebea0ad30f09b0358ab664a3ff949ef
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Jelle van der Waa <jelle at vdwaa.nl>



More information about the LibreOffice mailing list