Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4243

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/43/4243/1

String -> OUString of unotools Tempfile and related...

Change-Id: Iefab16211c66e25c724d5de4b565cddc418854d6
---
M connectivity/source/drivers/dbase/DTable.cxx
M desktop/source/deployment/manager/dp_manager.cxx
M desktop/source/deployment/registry/dp_backend.cxx
M filter/source/xsltdialog/xmlfiltertestdialog.cxx
M framework/source/services/autorecovery.cxx
M include/unotools/tempfile.hxx
M reportdesign/source/core/api/ReportEngineJFree.cxx
M sfx2/source/doc/docfile.cxx
M sot/source/sdstor/ucbstorage.cxx
M sw/source/core/doc/docglbl.cxx
M sw/source/ui/dbui/addresslistdialog.cxx
M sw/source/ui/dbui/dbmgr.cxx
M sw/source/ui/dbui/mmlayoutpage.cxx
M sw/source/ui/misc/glosbib.cxx
M sw/source/ui/misc/glosdoc.cxx
M unotools/source/ucbhelper/tempfile.cxx
16 files changed, 100 insertions(+), 86 deletions(-)



diff --git a/connectivity/source/drivers/dbase/DTable.cxx 
b/connectivity/source/drivers/dbase/DTable.cxx
index 99819f3..102fabb 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2493,12 +2493,11 @@
     OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier();
     if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
         aIdent += "/";
-    String sTempName(aIdent);
-    String sExt;
-    sExt.AssignAscii(".");
+    OUString sTempName(aIdent);
+    OUString sExt(".");
     sExt += m_pConnection->getExtension();
 
-    String sName(m_Name);
+    OUString sName(m_Name);
     TempFile aTempFile(sName,&sExt,&sTempName);
     if(!aTempFile.IsValid())
         getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE,*this);
@@ -2508,7 +2507,7 @@
     aURL.SetURL(aTempFile.GetURL());
 
     String sNewName(aURL.getName());
-    sNewName.Erase(sNewName.Len() - sExt.Len());
+    sNewName.Erase(sNewName.Len() - sExt.getLength());
     return sNewName;
 }
 // -----------------------------------------------------------------------------
diff --git a/desktop/source/deployment/manager/dp_manager.cxx 
b/desktop/source/deployment/manager/dp_manager.cxx
index 5bf0c91..a48cfe8 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -588,7 +588,7 @@
     Reference<XCommandEnvironment> xCmdEnv(
         sourceContent.getCommandEnvironment() );
 
-    String baseDir(m_activePackages_expanded);
+    OUString baseDir(m_activePackages_expanded);
     ::utl::TempFile aTemp(&baseDir, sal_False);
     OUString tempEntry = aTemp.GetURL();
     tempEntry = tempEntry.copy(tempEntry.lastIndexOf('/') + 1);
diff --git a/desktop/source/deployment/registry/dp_backend.cxx 
b/desktop/source/deployment/registry/dp_backend.cxx
index 8c6cdfa..2cc8afa 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -220,7 +220,7 @@
     ucbhelper::Content dataContent;
     ::dp_misc::create_folder(&dataContent, sDataFolder, xCmdEnv);
 
-    const String baseDir(sDataFolder);
+    const OUString baseDir(sDataFolder);
     const ::utl::TempFile aTemp(&baseDir, sal_True);
     const OUString url = aTemp.GetURL();
     return sDataFolder + url.copy(url.lastIndexOf('/'));
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx 
b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 0490c3f..e5a8c82 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -433,8 +433,8 @@
         Reference< XStorable > xStorable( xComp, UNO_QUERY );
         if( xStorable.is() )
         {
-            String leadingChars;
-            String ext(RTL_CONSTASCII_USTRINGPARAM(".xml"));
+            OUString leadingChars;
+            OUString ext(".xml");
             utl::TempFile aTempFile(leadingChars, &ext);
             OUString aTempFileURL( aTempFile.GetURL() );
 
@@ -599,8 +599,8 @@
 
         if( m_pCBXDisplaySource->IsChecked() )
         {
-            String lead;
-            String ext(RTL_CONSTASCII_USTRINGPARAM(".xml"));
+            OUString lead;
+            OUString ext(".xml");
             TempFile aTempFile(lead, &ext);
             OUString aTempFileURL( aTempFile.GetURL() );
 
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 9af8eb7..b429974 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2801,8 +2801,8 @@
     // TODO: Must we strip some illegal signes - if we use the title?
 
     OUString sName(sUniqueName.makeStringAndClear());
-    String sExtension(rInfo.Extension);
-    String sPath(sBackupPath);
+    OUString sExtension(rInfo.Extension);
+    OUString sPath(sBackupPath);
     ::utl::TempFile aTempFile(sName, &sExtension, &sPath);
 
     rInfo.NewTempURL = aTempFile.GetURL();
diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx
index 6cf2cb0..d7f4289 100644
--- a/include/unotools/tempfile.hxx
+++ b/include/unotools/tempfile.hxx
@@ -59,14 +59,14 @@
                     The temporary object is created in the local file system, even if there is no 
UCB that can access it.
                     If the given folder is part of the local file system, the TempFile is created 
in this folder.
                     */
-                    TempFile( const String* pParent=NULL, sal_Bool bDirectory=sal_False );
+                    TempFile( const OUString* pParent=NULL, sal_Bool bDirectory=sal_False );
 
                     /**
                     Same as above; additionally the name starts with some given characters 
followed by a counter ( example:
                     rLeadingChars="abc" means "abc0","abc1" and so on, depending on existing files 
in the folder ).
                     The extension string may be f.e. ".txt" or "", if no extension string is 
given, ".tmp" is used
                     */
-                    TempFile( const String& rLeadingChars, const String* pExtension=NULL, const 
String* pParent=NULL,
+                    TempFile( const OUString& rLeadingChars, const OUString* pExtension=NULL, 
const OUString* pParent=NULL,
                                 sal_Bool bDirectory=sal_False);
 
                     /**
@@ -75,7 +75,8 @@
                     The extension string may be f.e. ".txt" or "", if no extension string is 
given, ".tmp" is used
                         @param  _bStartWithZero If set to false names will be generated like 
"abc","abc0","abc1"
                     */
-                    TempFile( const String& rLeadingChars,sal_Bool _bStartWithZero, const String* 
pExtension=NULL, const String* pParent=NULL,sal_Bool bDirectory=sal_False);
+                    TempFile( const OUString& rLeadingChars, sal_Bool _bStartWithZero, const 
OUString* pExtension=NULL,
+                              const OUString* pParent=NULL, sal_Bool bDirectory=sal_False);
 
                     /**
                     TempFile will be removed from disk in dtor if EnableKillingTempFile was called 
before.
@@ -96,7 +97,7 @@
                     If no UCP is available for the local file system, an empty URL is returned. In 
this case you can't access
                     the file as a UCB content !
                     */
-    String          GetURL() const;
+    OUString        GetURL() const;
 
                     /**
                     Returns the "physical" name of the tempfile in host notation ( should only be 
used for 3rd party code
@@ -104,7 +105,7 @@
                     If you want to have the URL, use the GetURL() method of this object, but never 
use any external
                     conversion functions for "physical" names into URLs.
                     */
-    String          GetFileName() const;
+    OUString        GetFileName() const;
 
                     /**
                     Returns a stream to the tempfiles data; the stream is owned by the tempfile 
object, so you have to keep this
@@ -133,7 +134,7 @@
                     If you want to convert file name into a URL, always use class LocalFileHelper, 
but never use any
                     conversion functions of osl.
                     */
-    static String   CreateTempName( const String* pParent=NULL );
+    static OUString CreateTempName( const OUString* pParent=NULL );
 
                     /**
                     The TempNameBaseDirectory is a subfolder in the folder that is passed as a 
"physical" file name in the
@@ -144,7 +145,7 @@
                     The return value of both methods is the complete "physical" name of the 
tempname base folder.
                     It is not a URL because alle URLs must be "UCB compatible", so there may be no 
suitable URL at all.
                     */
-    static String   SetTempNameBaseDirectory( const String &rBaseName );
+    static OUString SetTempNameBaseDirectory( const OUString &rBaseName );
 };
 
 }
diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx 
b/reportdesign/source/core/api/ReportEngineJFree.cxx
index e99d144..a61294f 100644
--- a/reportdesign/source/core/api/ReportEngineJFree.cxx
+++ b/reportdesign/source/core/api/ReportEngineJFree.cxx
@@ -172,7 +172,7 @@
             MimeConfigurationHelper aConfighelper(m_xContext);
             const OUString sMimeType = m_xReport->getMimeType();
             const SfxFilter* pFilter = SfxFilter::GetDefaultFilter( 
aConfighelper.GetDocServiceNameFromMediaType(sMimeType) );
-            String sExt;
+            OUString sExt;
             if ( pFilter )
                 sExt = ::comphelper::string::stripStart(pFilter->GetDefaultExtension(), '*');
             else
@@ -195,8 +195,8 @@
             aConvertedProperties[nPos].Name = OUString("OutputStorage");
 
             OUString sFileURL;
-            String sName = m_xReport->getCaption();
-            if ( !sName.Len() )
+            OUString sName = m_xReport->getCaption();
+            if ( sName.isEmpty() )
                 sName = m_xReport->getName();
             {
                 ::utl::TempFile aTestFile(sName,sal_False,&sExt);
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 543e8e8..2f60f5d 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2092,7 +2092,11 @@
     if ( !pImp->m_aBackupURL.isEmpty() )
         return; // the backup was done already
 
-    ::utl::TempFile aTransactTemp( aPrefix, &aExtension, &aDestDir );
+    OUString aExt(aExtension);
+    OUString aDest(aDestDir);
+    OUString aPre(aPrefix);
+
+    ::utl::TempFile aTransactTemp( aPre, &aExt, &aDest );
     aTransactTemp.EnableKillingFile( false );
 
     INetURLObject aBackObj( aTransactTemp.GetURL() );
@@ -3540,9 +3544,9 @@
     if ( !aURL.isEmpty() )
     {
         sal_Int32 nPrefixLen = aURL.lastIndexOf( '.' );
-        String aExt = ( nPrefixLen == -1 ) ? String() : String( aURL.copy( nPrefixLen ) );
+        OUString aExt = ( nPrefixLen == -1 ) ? OUString() : OUString( aURL.copy( nPrefixLen ) );
 
-        OUString aNewTempFileURL = ::utl::TempFile( String(), &aExt ).GetURL();
+        OUString aNewTempFileURL = ::utl::TempFile( OUString(), &aExt ).GetURL();
         if ( !aNewTempFileURL.isEmpty() )
         {
             INetURLObject aSource( aURL );
@@ -3614,8 +3618,8 @@
     if ( !aOrigURL.isEmpty() )
     {
         sal_Int32 nPrefixLen = aOrigURL.lastIndexOf( '.' );
-        String aExt = ( nPrefixLen == -1 ) ? String() : String( aOrigURL.copy( nPrefixLen ) );
-        OUString aNewURL = ::utl::TempFile( String(), &aExt ).GetURL();
+        OUString aExt = ( nPrefixLen == -1 ) ? String() : String( aOrigURL.copy( nPrefixLen ) );
+        OUString aNewURL = ::utl::TempFile( OUString(), &aExt ).GetURL();
 
         // TODO/LATER: In future the aLogicName should be set to shared folder URL
         //             and a temporary file should be created. Transport_Impl should be impossible 
then.
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index ed0a7f5..f8786d5 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -2274,7 +2274,7 @@
                         if ( bRet )
                         {
                             // create a stream to write the manifest file - use a temp file
-                            String aURL( aNewSubFolder.getURL() );
+                            OUString aURL( aNewSubFolder.getURL() );
                             ::utl::TempFile* pTempFile = new ::utl::TempFile( &aURL );
 
                             // get the stream from the temp file and create an output stream 
wrapper
@@ -3182,7 +3182,7 @@
     INetURLObject aFolderObj( rName );
     String aName = aFolderObj.GetName();
     aFolderObj.removeSegment();
-    String aFolderURL( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ) );
+    OUString aFolderURL( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ) );
     ::utl::TempFile* pTempFile = new ::utl::TempFile( &aFolderURL );
 
     // get the stream from the temp file
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 58dd033..208a195 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -214,16 +214,19 @@
     GetIDocumentUndoRedo().DoUndo(false);
     SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
 
-    String sExt = pFilter->GetSuffixes().getToken(0, ',');
-    if( !sExt.Len() )
-        sExt.AssignAscii( "sxw" );
-    if( '.' != sExt.GetChar( 0 ) )
-        sExt.Insert( '.', 0 );
-
+    OUString sExt = pFilter->GetSuffixes().getToken(0, ',');
+    if( sExt.isEmpty())
+    {
+        sExt = "sxw";
+    }
+    if( '.' != sExt[ 0] )
+    {
+        sExt = "." + sExt;
+    }
     INetURLObject aEntry(rPath);
-    String sLeading(aEntry.GetBase());
+    OUString sLeading(aEntry.GetBase());
     aEntry.removeSegment();
-    String sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
+    OUString sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
     utl::TempFile aTemp(sLeading,&sExt,&sPath );
     aTemp.EnableKillingFile();
 
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 35c0b6f..0f91ab1 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -396,10 +396,10 @@
 
             uno::Reference<sdb::XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW);
             uno::Reference<frame::XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW);
-            String sExt = OUString(".odb");
+            OUString sExt = OUString(".odb");
             String sTmpName;
             {
-                String sHomePath(SvtPathOptions().GetWorkPath());
+                OUString sHomePath(SvtPathOptions().GetWorkPath());
                 utl::TempFile aTempFile(sFind , &sExt, &sHomePath);
                 aTempFile.EnableKillingFile(sal_True);
                 sTmpName = aTempFile.GetURL();
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 1199d7a..230f481 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -974,7 +974,7 @@
             {
                 nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
                 {
-                    String sPath(sSubject);
+                    OUString sPath(sSubject);
 
                     String sAddress;
                     if( !bEMail && bColumnName )
@@ -992,7 +992,7 @@
                     if( 1 == nDocNo || (!rMergeDescriptor.bCreateSingleFile && !bAsSingleFile) )
                     {
                         INetURLObject aEntry(sPath);
-                        String sLeading;
+                        OUString sLeading;
                         //#i97667# if the name is from a database field then it will be used _as 
is_
                         if( sAddress.Len() )
                             sLeading = sAddress;
@@ -1000,7 +1000,7 @@
                             sLeading = aEntry.GetBase();
                         aEntry.removeSegment();
                         sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
-                        String 
sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*'));
+                        OUString 
sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*'));
                         aTempFile = std::auto_ptr< utl::TempFile >(
                                 new utl::TempFile(sLeading,&sExt,&sPath ));
                         if( bAsSingleFile )
@@ -1246,7 +1246,7 @@
                 if( rMergeDescriptor.nMergeType != DBMGR_MERGE_MAILMERGE )
                 {
                     OSL_ENSURE( aTempFile.get(), "Temporary file not available" );
-                    INetURLObject aTempFileURL(bAsSingleFile ? sSubject : aTempFile->GetURL());
+                    INetURLObject aTempFileURL(bAsSingleFile ? OUString(sSubject) : 
aTempFile->GetURL());
                     SfxMedium* pDstMed = new SfxMedium(
                         aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ),
                         STREAM_STD_READWRITE );
@@ -2175,7 +2175,7 @@
     sfx2::FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
     Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
 
-    String sHomePath(SvtPathOptions().GetWorkPath());
+    OUString sHomePath(SvtPathOptions().GetWorkPath());
     aDlgHelper.SetDisplayDirectory( sHomePath );
 
     Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
@@ -2335,7 +2335,7 @@
 
                 Reference<XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW);
                 Reference<XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW);
-                String sOutputExt = OUString(".odb");
+                OUString sOutputExt = OUString(".odb");
                 String sTmpName;
                 {
                     utl::TempFile aTempFile(sNewName , &sOutputExt, &sHomePath);
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index 44c7b9e..1fdc66f 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -110,8 +110,8 @@
     {
         //temp file needs it's own block
         //creating with extension is not supported by a static method :-(
-        String sLeading;
-        String sExt(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*'));
+        OUString sLeading;
+        OUString sExt(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*'));
         utl::TempFile aTempFile( sLeading, &sExt );
         m_sExampleURL = aTempFile.GetURL();
         aTempFile.EnableKillingFile();
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 4ecc12e..8c83593 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -77,7 +77,7 @@
 
     for (size_t i = 0; i < rPathArr.size(); ++i)
     {
-        String sPath(rPathArr[i]);
+        OUString sPath(rPathArr[i]);
         INetURLObject aTempURL(sPath);
         sPath = aTempURL.GetMainURL(INetURLObject::DECODE_WITH_CHARSET );
         m_pPathLB->InsertEntry(sPath);
diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx
index 681be51..62e4ecf 100644
--- a/sw/source/ui/misc/glosdoc.cxx
+++ b/sw/source/ui/misc/glosdoc.cxx
@@ -77,10 +77,11 @@
 
     if( !bOk )
     {
-        String rSG = SwGlossaries::GetExtension();
+        OUString rSG = SwGlossaries::GetExtension();
+        OUString sNF(rNewFilePath);
         //generate generic name
         utl::TempFile aTemp(OUString("group"),
-            &rSG, &rNewFilePath );
+            &rSG, &sNF );
         aTemp.EnableKillingFile();
 
         INetURLObject aTempURL( aTemp.GetURL() );
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 798f61b..6de151d 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -49,8 +49,8 @@
 
 struct TempFile_Impl
 {
-    String      aName;
-    String      aURL;
+    OUString    aName;
+    OUString    aURL;
     SvStream*   pStream;
     sal_Bool    bIsDirectory;
 
@@ -124,10 +124,10 @@
     return bSuccess;
 }
 
-String ConstructTempDir_Impl( const String* pParent )
+OUString ConstructTempDir_Impl( const OUString* pParent )
 {
-    String aName;
-    if ( pParent && pParent->Len() )
+    OUString aName;
+    if ( pParent && !pParent->isEmpty() )
     {
         com::sun::star::uno::Reference<
             com::sun::star::ucb::XUniversalContentBroker > pBroker(
@@ -154,7 +154,7 @@
         }
     }
 
-    if ( !aName.Len() )
+    if ( aName.isEmpty() )
     {
         OUString &rTempNameBase_Impl = TempNameBase_Impl::get();
         if (rTempNameBase_Impl.isEmpty())
@@ -172,30 +172,32 @@
     }
 
     // Make sure that directory ends with a separator
-    xub_StrLen i = aName.Len();
-    if( i>0 && aName.GetChar(i-1) != '/' )
-        aName += '/';
+    sal_Int32 i = aName.getLength();
+    if( i>0 && aName[i-1] != (sal_Unicode)'/' )
+    {
+        aName += "/";
+    }
 
     return aName;
 }
 
-void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_True )
+void CreateTempName_Impl( OUString& rName, sal_Bool bKeep, sal_Bool bDir = sal_True )
 {
     // add a suitable tempname
     // 36 ** 6 == 2176782336
     unsigned const nRadix = 36;
     unsigned long const nMax = (nRadix*nRadix*nRadix*nRadix*nRadix*nRadix);
-    String aName( rName );
+    OUString aName( rName );
     aName += OUString( "lu" );
 
-    rName.Erase();
+    rName = "";
     static unsigned long u = Time::GetSystemTicks() % nMax;
     for ( unsigned long nSeed = u; ++u != nSeed; )
     {
         u %= nMax;
-        String aTmp( aName );
+        OUString aTmp( aName );
         aTmp += OUString::valueOf(static_cast<sal_Int64>(u), nRadix);
-        aTmp += OUString( ".tmp" );
+        aTmp += ".tmp";
 
         if ( bDir )
         {
@@ -252,26 +254,27 @@
     }
 }
 
-void lcl_createName(TempFile_Impl& _rImpl,const String& rLeadingChars,sal_Bool _bStartWithZero, 
const String* pExtension, const String* pParent, sal_Bool bDirectory)
+void lcl_createName(TempFile_Impl& _rImpl,const OUString& rLeadingChars, sal_Bool _bStartWithZero,
+                    const OUString* pExtension, const OUString* pParent, sal_Bool bDirectory)
 {
     _rImpl.bIsDirectory = bDirectory;
 
     // get correct directory
-    String aName = ConstructTempDir_Impl( pParent );
+    OUString aName = ConstructTempDir_Impl( pParent );
 
     sal_Bool bUseNumber = _bStartWithZero;
     // now use special naming scheme ( name takes leading chars and an index counting up from zero
     aName += rLeadingChars;
     for ( sal_Int32 i=0;; i++ )
     {
-        String aTmp( aName );
+        OUString aTmp( aName );
         if ( bUseNumber )
             aTmp += OUString::number( i );
         bUseNumber = sal_True;
         if ( pExtension )
             aTmp += *pExtension;
         else
-            aTmp += OUString( ".tmp" );
+            aTmp += ".tmp";
         if ( bDirectory )
         {
             FileBase::RC err = Directory::create( aTmp );
@@ -320,22 +323,22 @@
 }
 
 
-String TempFile::CreateTempName( const String* pParent )
+OUString TempFile::CreateTempName( const OUString* pParent )
 {
     // get correct directory
-    String aName = ConstructTempDir_Impl( pParent );
+    OUString aName = ConstructTempDir_Impl( pParent );
 
     // get TempFile name with default naming scheme
     CreateTempName_Impl( aName, sal_False );
 
     // convert to file URL
     OUString aTmp;
-    if ( aName.Len() )
+    if ( !aName.isEmpty() )
         FileBase::getSystemPathFromFileURL( aName, aTmp );
     return aTmp;
 }
 
-TempFile::TempFile( const String* pParent, sal_Bool bDirectory )
+TempFile::TempFile( const OUString* pParent, sal_Bool bDirectory )
     : pImp( new TempFile_Impl )
     , bKillingFileEnabled( sal_False )
 {
@@ -348,13 +351,16 @@
     CreateTempName_Impl( pImp->aName, sal_True, bDirectory );
 }
 
-TempFile::TempFile( const String& rLeadingChars, const String* pExtension, const String* pParent, 
sal_Bool bDirectory)
+TempFile::TempFile( const OUString& rLeadingChars, const OUString* pExtension,
+                    const OUString* pParent, sal_Bool bDirectory)
     : pImp( new TempFile_Impl )
     , bKillingFileEnabled( sal_False )
 {
     lcl_createName(*pImp,rLeadingChars,sal_True, pExtension, pParent, bDirectory);
 }
-TempFile::TempFile( const String& rLeadingChars,sal_Bool _bStartWithZero, const String* 
pExtension, const String* pParent, sal_Bool bDirectory)
+
+TempFile::TempFile( const OUString& rLeadingChars, sal_Bool _bStartWithZero,
+                    const OUString* pExtension, const OUString* pParent, sal_Bool bDirectory)
     : pImp( new TempFile_Impl )
     , bKillingFileEnabled( sal_False )
 {
@@ -382,19 +388,19 @@
 
 sal_Bool TempFile::IsValid() const
 {
-    return pImp->aName.Len() != 0;
+    return !(pImp->aName.isEmpty());
 }
 
-String TempFile::GetFileName() const
+OUString TempFile::GetFileName() const
 {
     OUString aTmp;
     FileBase::getSystemPathFromFileURL( pImp->aName, aTmp );
     return aTmp;
 }
 
-String TempFile::GetURL() const
+OUString TempFile::GetURL() const
 {
-    if ( !pImp->aURL.Len() )
+    if ( pImp->aURL.isEmpty() )
     {
         OUString aTmp;
         LocalFileHelper::ConvertPhysicalNameToURL( GetFileName(), aTmp );
@@ -408,7 +414,7 @@
 {
     if ( !pImp->pStream )
     {
-        if ( GetURL().Len() )
+        if ( !GetURL().isEmpty() )
             pImp->pStream = UcbStreamHelper::CreateStream( pImp->aURL, eMode, sal_True /* 
bFileExists */ );
         else
             pImp->pStream = new SvMemoryStream( eMode );
@@ -426,16 +432,16 @@
     }
 }
 
-String TempFile::SetTempNameBaseDirectory( const String &rBaseName )
+OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName )
 {
-    if( !rBaseName.Len() )
-        return String();
+    if( rBaseName.isEmpty() )
+        return OUString();
 
     OUString aUnqPath( rBaseName );
 
     // remove trailing slash
-    if ( rBaseName.GetChar( rBaseName.Len() - 1 ) == sal_Unicode( '/' ) )
-        aUnqPath = rBaseName.Copy( 0, rBaseName.Len() - 1 );
+    if ( rBaseName[rBaseName.getLength() - 1 ] == sal_Unicode( '/' ) )
+        aUnqPath = rBaseName.copy( 0, rBaseName.getLength() - 1 );
 
     // try to create the directory
     sal_Bool bRet = sal_False;
@@ -454,7 +460,7 @@
         bRet = sal_True;
         OUString &rTempNameBase_Impl = TempNameBase_Impl::get();
         rTempNameBase_Impl = rBaseName;
-        rTempNameBase_Impl += OUString('/');
+        rTempNameBase_Impl += "/";
 
         TempFile aBase( NULL, sal_True );
         if ( aBase.IsValid() )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefab16211c66e25c724d5de4b565cddc418854d6
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.