Kaydet (Commit) 8692fc43 authored tarafından Noel Grandin's avatar Noel Grandin

convert sw/inc/swunohelper.hxx from String to OUString

and simplify GetFileListOfFolder to take a vector<OUString>
instead of vector<OUString*>

Change-Id: Ie2871bc01880c35b88d9e693a3d8d8c9b92055fb
üst 781751b3
......@@ -33,7 +33,6 @@ namespace com { namespace sun { namespace star {
namespace rtl {class OUString;}
class String;
class DateTime;
namespace SWUnoHelper {
......@@ -45,17 +44,17 @@ sal_Int32 GetEnumAsInt32( const com::sun::star::uno::Any& rVal );
// methods for UCB actions:
// delete the file under this URL
SW_DLLPUBLIC sal_Bool UCB_DeleteFile( const String& rURL );
SW_DLLPUBLIC sal_Bool UCB_DeleteFile( const OUString& rURL );
// copy/move the file to a new location
sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL,
sal_Bool UCB_CopyFile( const OUString& rURL, const OUString& rNewURL,
sal_Bool bCopyIsMove = sal_False );
// is the URL on the current system case sentive?
SW_DLLPUBLIC sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL );
SW_DLLPUBLIC sal_Bool UCB_IsCaseSensitiveFileName( const OUString& rURL );
// is the URL readonly?
SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL );
SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const OUString& rURL );
// get a list of files from the folder of the URL
// options: pExtension = 0 -> all, else this specific extension
......@@ -63,15 +62,15 @@ SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL );
// the files in a vector -->
// !! objects must be deleted from the caller!!
bool UCB_GetFileListOfFolder( const OUString& rURL,
std::vector<OUString*>& rList,
std::vector<OUString>& rList,
const OUString* pExtension = 0,
std::vector<DateTime*>* pDateTimeList = 0 );
// is the URL an existing file?
SW_DLLPUBLIC sal_Bool UCB_IsFile( const String& rURL );
SW_DLLPUBLIC sal_Bool UCB_IsFile( const OUString& rURL );
// is the URL a existing directory?
sal_Bool UCB_IsDirectory( const String& rURL );
sal_Bool UCB_IsDirectory( const OUString& rURL );
}
#endif
......
......@@ -56,7 +56,7 @@ sal_Int32 GetEnumAsInt32( const ::com::sun::star::uno::Any& rVal )
// methods for UCB actions
sal_Bool UCB_DeleteFile( const String& rURL )
sal_Bool UCB_DeleteFile( const OUString& rURL )
{
sal_Bool bRemoved;
try
......@@ -76,7 +76,7 @@ sal_Bool UCB_DeleteFile( const String& rURL )
return bRemoved;
}
sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL, sal_Bool bCopyIsMove )
sal_Bool UCB_CopyFile( const OUString& rURL, const OUString& rNewURL, sal_Bool bCopyIsMove )
{
sal_Bool bCopyCompleted = sal_True;
try
......@@ -108,7 +108,7 @@ sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL, sal_Bool bCopy
return bCopyCompleted;
}
sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL )
sal_Bool UCB_IsCaseSensitiveFileName( const OUString& rURL )
{
sal_Bool bCaseSensitive;
try
......@@ -136,7 +136,7 @@ sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL )
return bCaseSensitive;
}
sal_Bool UCB_IsReadOnlyFileName( const String& rURL )
sal_Bool UCB_IsReadOnlyFileName( const OUString& rURL )
{
sal_Bool bIsReadOnly = sal_False;
try
......@@ -154,7 +154,7 @@ sal_Bool UCB_IsReadOnlyFileName( const String& rURL )
return bIsReadOnly;
}
sal_Bool UCB_IsFile( const String& rURL )
sal_Bool UCB_IsFile( const OUString& rURL )
{
sal_Bool bExists = sal_False;
try
......@@ -168,7 +168,7 @@ sal_Bool UCB_IsFile( const String& rURL )
return bExists;
}
sal_Bool UCB_IsDirectory( const String& rURL )
sal_Bool UCB_IsDirectory( const OUString& rURL )
{
sal_Bool bExists = sal_False;
try
......@@ -188,7 +188,7 @@ sal_Bool UCB_IsDirectory( const String& rURL )
// the files in a std::vector<String*> -->
// !! objects must be deleted from the caller!!
bool UCB_GetFileListOfFolder( const OUString& rURL,
std::vector<OUString*>& rList,
std::vector<OUString>& rList,
const OUString* pExtension,
std::vector< ::DateTime* >* pDateTimeList )
{
......@@ -228,7 +228,7 @@ bool UCB_GetFileListOfFolder( const OUString& rURL,
( sTitle.getLength() > nExtLen &&
sTitle.endsWith( *pExtension )) )
{
rList.push_back( new OUString(sTitle) );
rList.push_back( sTitle );
if( pDateTimeList )
{
......
......@@ -342,19 +342,16 @@ std::vector<OUString> & SwGlossaries::GetNameList()
const OUString sExt( SwGlossaries::GetExtension() );
for (size_t i = 0; i < m_PathArr.size(); ++i)
{
std::vector<OUString*> aFiles;
std::vector<OUString> aFiles;
SWUnoHelper::UCB_GetFileListOfFolder(m_PathArr[i], aFiles, &sExt);
for( std::vector<OUString*>::const_iterator filesIt(aFiles.begin());
for( std::vector<OUString>::const_iterator filesIt(aFiles.begin());
filesIt != aFiles.end(); ++filesIt)
{
const OUString *pTitle = *filesIt;
const OUString sName( pTitle->copy( 0, pTitle->getLength() - sExt.getLength() )
const OUString aTitle = *filesIt;
const OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() )
+ OUString(GLOS_DELIM) + OUString::number( static_cast<sal_Int16>(i) ));
m_GlosArr.push_back(sName);
// don't need any more these pointers
delete pTitle;
}
}
if (m_GlosArr.empty())
......
......@@ -278,17 +278,17 @@ void SwGlossaryList::Update()
for( size_t nPath = 0; nPath < rPathArr.size(); nPath++ )
{
std::vector<String> aFoundGroupNames;
std::vector<OUString*> aFiles;
std::vector<OUString> aFiles;
std::vector<DateTime*> aDateTimeArr;
SWUnoHelper::UCB_GetFileListOfFolder( rPathArr[nPath], aFiles,
&sExt, &aDateTimeArr );
for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles )
{
const OUString* pTitle = aFiles[ nFiles ];
const OUString aTitle = aFiles[ nFiles ];
::DateTime* pDT = (::DateTime*) aDateTimeArr[ static_cast<sal_uInt16>(nFiles) ];
OUString sName( pTitle->copy( 0, pTitle->getLength() - sExt.getLength() ));
OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() ));
aFoundGroupNames.push_back(sName);
sName += OUString(GLOS_DELIM) + OUString::number( static_cast<sal_uInt16>(nPath) );
......@@ -309,7 +309,6 @@ void SwGlossaryList::Update()
}
// don't need any more these pointers
delete pTitle;
delete pDT;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment