[PATCH] String::AppendAscii cleanup

Ricardo Montania (via Code Review) gerrit at gerrit.libreoffice.org
Fri Mar 22 09:53:20 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2914

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/14/2914/1

String::AppendAscii cleanup

Change-Id: I3c1ff291488b7747e143982aa7ea95169175c2c2
---
M basctl/source/basicide/baside2.cxx
M connectivity/source/drivers/dbase/DIndex.cxx
M connectivity/source/drivers/dbase/DTable.cxx
M cui/source/dialogs/hyphen.cxx
M cui/source/dialogs/postdlg.cxx
M cui/source/options/optdict.cxx
6 files changed, 22 insertions(+), 23 deletions(-)



diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 72d594d..f8962c5 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1339,7 +1339,7 @@
     ScriptDocument aDocument( GetDocument() );
     String aLibName( GetLibName() );
     LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
-    String aModName( GetName() );
+    OUString aModName( GetName() );
     String aLibSubName;
     if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() )
     {
@@ -1355,7 +1355,7 @@
                     ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
                     if( !sObjName.isEmpty() )
                     {
-                        aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
+                        aModName += " (" + sObjName + ")";
                     }
                 }
                 break;
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index 0cb4630..1e70a5c 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -509,16 +509,15 @@
         aName = getString(xCol->getFastPropertyValue(PROPERTY_ID_NAME));
 
         const String aQuote(m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString());
-        String aStatement;
-        aStatement.AssignAscii("SELECT ");
+        OUString aStatement( "SELECT " );
         aStatement += aQuote;
         aStatement += aName;
         aStatement += aQuote;
-        aStatement.AppendAscii(" FROM ");
+        aStatement += " FROM ";
         aStatement += aQuote;
         aStatement += m_pTable->getName().getStr();
         aStatement += aQuote;
-        aStatement.AppendAscii(" ORDER BY ");
+        aStatement += " ORDER BY ";
         aStatement += aQuote;
         aStatement += aName;
         aStatement += aQuote;
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index ee2d7df..386d802 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2318,8 +2318,8 @@
         aURL.SetURL(aName);
 
         aURL.setExtension( _sExtension );
-        String sNewName(newName);
-        sNewName.AppendAscii(".");
+        OUString sNewName(newName);
+        sNewName += ".";
         sNewName += _sExtension;
 
         try
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index 82bef8d..26326647 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -521,10 +521,10 @@
 void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang )
 {
     String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) );
-    String aTmp( aLabel );
-    aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) );
-    aTmp.Append( aLangStr );
-    aTmp.Append( sal_Unicode( ')' ) );
+    OUString aTmp( aLabel );
+    aTmp += " (";
+    aTmp += aLangStr;
+    aTmp += ")";
     SetText( aTmp );
 }
 
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index cec8c01..4e2465e 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -134,8 +134,8 @@
 
 void SvxPostItDialog::ShowLastAuthor(const String& rAuthor, const String& rDate)
 {
-    String sTxt( rAuthor );
-    sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+    OUString sTxt( rAuthor );
+    sTxt += ", ";
     sTxt += rDate;
     m_pLastEditFT->SetText( sTxt );
 }
@@ -187,23 +187,23 @@
     Time aTime( Time::SYSTEM );
     String aTmp( SvtUserOptions().GetID() );
     const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
-    String aStr( m_pEditED->GetText() );
-    aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n---- " ) );
+    OUString aStr( m_pEditED->GetText() );
+    aStr += "\n---- ";
 
     if ( aTmp.Len() > 0 )
     {
         aStr += aTmp;
-        aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+        aStr += ", ";
     }
     aStr += rLocaleWrapper.getDate(aDate);
-    aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+    aStr += ", ";
     aStr += rLocaleWrapper.getTime(aTime, sal_False, sal_False);
-    aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " ----\n" ) );
+    aStr += " ----\n";
 
     aStr = convertLineEnd(aStr, GetSystemLineEnd());
 
     m_pEditED->SetText(aStr);
-    xub_StrLen nLen = aStr.Len();
+    xub_StrLen nLen = aStr.getLength();
     m_pEditED->GrabFocus();
     m_pEditED->SetSelection( Selection( nLen, nLen ) );
     return 0;
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index 33534bc..86b180f 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -118,9 +118,9 @@
 
 IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl)
 {
-    String sDict = comphelper::string::stripEnd(aNameEdit.GetText(), ' ');
+    OUString sDict = comphelper::string::stripEnd(aNameEdit.GetText(), ' ');
     // add extension for personal dictionaries
-    sDict.AppendAscii(".dic");
+    sDict += ".dic";
 
     Reference< XSearchableDictionaryList >  xDicList( SvxGetDictionaryList() );
 
@@ -133,7 +133,7 @@
     sal_Bool bFound = sal_False;
     sal_uInt16 i;
     for (i = 0; !bFound && i < nCount; ++i )
-        if ( sDict.EqualsIgnoreCaseAscii( String(pDic[i]->getName()) ))
+        if ( sDict.equalsIgnoreAsciiCase( pDic[i]->getName()) )
             bFound = sal_True;
 
     if ( bFound )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c1ff291488b7747e143982aa7ea95169175c2c2
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ricardo Montania <ricardo at linuxafundo.com.br>



More information about the LibreOffice mailing list