summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-22 13:31:57 +0200
committerNoel Grandin <noel@peralex.com>2015-07-23 08:41:46 +0200
commit95aad95fbec35c3aab777b176218a29821f79574 (patch)
tree860e5fc0890830b27c391b4492d6b91631ef9850 /ucb
parente412e16d56caf426bac04c7e5966e2a9efa7c408 (diff)
inline a handful of use-once #defines
Change-Id: Id2654555c4042f8c0bdbd6bab6507e705f08326b
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/file/shell.cxx31
-rw-r--r--ucb/source/ucp/file/shell.hxx12
-rw-r--r--ucb/source/ucp/webdav-neon/webdavprovider.hxx22
-rw-r--r--ucb/source/ucp/webdav/webdavprovider.hxx22
4 files changed, 28 insertions, 59 deletions
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 6b0ad355491c..982e68480b35 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -1347,7 +1347,7 @@ shell::copy(
bool isDocument
= type != osl::FileStatus::Directory && type != osl::FileStatus::Volume;
- sal_Int32 IsWhat = isDocument ? -1 : 1;
+ FileUrlType IsWhat = isDocument ? FileUrlType::File : FileUrlType::Folder;
switch( NameClash )
{
@@ -1485,7 +1485,7 @@ shell::copy(
bool SAL_CALL
shell::remove( sal_Int32 CommandId,
const OUString& aUnqPath,
- sal_Int32 IsWhat,
+ FileUrlType IsWhat,
bool MustExist )
{
sal_Int32 nMask = osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL;
@@ -1494,7 +1494,7 @@ shell::remove( sal_Int32 CommandId,
osl::FileStatus aStatus( nMask );
osl::FileBase::RC nError;
- if( IsWhat == 0 ) // Determine whether we are removing a directory or a file
+ if( IsWhat == FileUrlType::Unknown ) // Determine whether we are removing a directory or a file
{
nError = osl::DirectoryItem::get( aUnqPath, aItem );
if( nError != osl::FileBase::E_None )
@@ -1519,14 +1519,14 @@ shell::remove( sal_Int32 CommandId,
if( aStatus.getFileType() == osl::FileStatus::Regular ||
aStatus.getFileType() == osl::FileStatus::Link )
- IsWhat = -1; // RemoveFile
+ IsWhat = FileUrlType::File;
else if( aStatus.getFileType() == osl::FileStatus::Directory ||
aStatus.getFileType() == osl::FileStatus::Volume )
- IsWhat = +1; // RemoveDirectory
+ IsWhat = FileUrlType::Folder;
}
- if( IsWhat == -1 ) // Removing a file
+ if( IsWhat == FileUrlType::File )
{
nError = osl::File::remove( aUnqPath );
if( nError != osl::FileBase::E_None )
@@ -1545,7 +1545,7 @@ shell::remove( sal_Int32 CommandId,
erasePersistentSet( aUnqPath ); // Removes from XPersistentPropertySet
}
}
- else if( IsWhat == +1 ) // Removing a directory
+ else if( IsWhat == FileUrlType::Folder )
{
osl::Directory aDirectory( aUnqPath );
@@ -1562,7 +1562,7 @@ shell::remove( sal_Int32 CommandId,
}
bool whileSuccess = true;
- sal_Int32 recurse = 0;
+ FileUrlType recurse = FileUrlType::Unknown;
OUString name;
nError = aDirectory.getNextItem( aItem );
@@ -1580,14 +1580,13 @@ shell::remove( sal_Int32 CommandId,
if( aStatus.getFileType() == osl::FileStatus::Regular ||
aStatus.getFileType() == osl::FileStatus::Link )
- recurse = -1;
+ recurse = FileUrlType::File;
else if( aStatus.getFileType() == osl::FileStatus::Directory ||
aStatus.getFileType() == osl::FileStatus::Volume )
- recurse = +1;
+ recurse = FileUrlType::Folder;
name = aStatus.getFileURL();
- whileSuccess = remove(
- CommandId, name, recurse, MustExist );
+ whileSuccess = remove( CommandId, name, recurse, MustExist );
if( !whileSuccess )
break;
@@ -1973,16 +1972,16 @@ bool SAL_CALL shell::getUrlFromUnq( const OUString& Unq,OUString& Url )
osl::FileBase::RC SAL_CALL
shell::copy_recursive( const OUString& srcUnqPath,
const OUString& dstUnqPath,
- sal_Int32 TypeToCopy,
+ FileUrlType TypeToCopy,
bool testExistBeforeCopy )
{
osl::FileBase::RC err = osl::FileBase::E_None;
- if( TypeToCopy == -1 ) // Document
+ if( TypeToCopy == FileUrlType::File ) // Document
{
err = osl_File_copy( srcUnqPath,dstUnqPath,testExistBeforeCopy );
}
- else if( TypeToCopy == +1 ) // Folder
+ else if( TypeToCopy == FileUrlType::Folder )
{
osl::Directory aDir( srcUnqPath );
aDir.open();
@@ -2004,7 +2003,7 @@ shell::copy_recursive( const OUString& srcUnqPath,
IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular;
// Getting the information for the next recursive copy
- sal_Int32 newTypeToCopy = IsDoc ? -1 : +1;
+ FileUrlType newTypeToCopy = IsDoc ? FileUrlType::File : FileUrlType::Folder;
OUString newSrcUnqPath;
if( aFileStatus.isValid( osl_FileStatus_Mask_FileURL ) )
diff --git a/ucb/source/ucp/file/shell.hxx b/ucb/source/ucp/file/shell.hxx
index 2a05712557d3..5b1ff4249537 100644
--- a/ucb/source/ucp/file/shell.hxx
+++ b/ucb/source/ucp/file/shell.hxx
@@ -301,9 +301,7 @@ namespace fileaccess {
const OUString& dstUnqPath,
sal_Int32 NameClash );
-#define RemoveFolder 1
-#define RemoveFile -1
-#define RemoveUnknown 0
+ enum class FileUrlType { Folder = 1, File = -1, Unknown = 0 };
/**
* Deletes the content belonging to fileURL aUnqPath( recursively in case of directory )
@@ -312,13 +310,9 @@ namespace fileaccess {
bool SAL_CALL
remove( sal_Int32 CommandId,
const OUString& aUnqPath,
- sal_Int32 TypeToMove = RemoveUnknown,
+ FileUrlType eTypeToMove = FileUrlType::Unknown,
bool MustExist = true );
-#undef RemoveUnknown
-#undef RemoveFile
-#undef RemoveFolder
-
/********************************************************************************/
/* write and create - commandos */
@@ -503,7 +497,7 @@ namespace fileaccess {
copy_recursive(
const OUString& srcUnqPath,
const OUString& dstUnqPath,
- sal_Int32 TypeToCopy,
+ FileUrlType TypeToCopy,
bool testExistence );
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.hxx b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
index a93f75286c2c..da789cf73dd6 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
@@ -42,39 +42,30 @@ namespace webdav_ucp {
// UNO service name for the provider. This name will be used by the UCB to
// create instances of the provider.
-#define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME \
- "com.sun.star.ucb.WebDAVContentProvider"
-#define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 38
+#define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.WebDAVContentProvider"
// URL scheme. This is the scheme the provider will be able to create
// contents for. The UCB will select the provider ( i.e. in order to create
// contents ) according to this scheme.
-#define WEBDAV_URL_SCHEME \
- "vnd.sun.star.webdav"
+#define WEBDAV_URL_SCHEME "vnd.sun.star.webdav"
#define WEBDAV_URL_SCHEME_LENGTH 19
#define HTTP_URL_SCHEME "http"
-#define HTTP_URL_SCHEME_LENGTH 4
#define HTTPS_URL_SCHEME "https"
-#define HTTPS_URL_SCHEME_LENGTH 5
#define DAV_URL_SCHEME "dav"
#define DAV_URL_SCHEME_LENGTH 3
-#define DAVS_URL_SCHEME "davs"
+#define DAVS_URL_SCHEME "davs"
#define DAVS_URL_SCHEME_LENGTH 4
-
-
#define FTP_URL_SCHEME "ftp"
-#define HTTP_CONTENT_TYPE \
- "application/" HTTP_URL_SCHEME "-content"
+#define HTTP_CONTENT_TYPE "application/" HTTP_URL_SCHEME "-content"
#define WEBDAV_CONTENT_TYPE HTTP_CONTENT_TYPE
-#define WEBDAV_COLLECTION_TYPE \
- "application/" WEBDAV_URL_SCHEME "-collection"
+#define WEBDAV_COLLECTION_TYPE "application/" WEBDAV_URL_SCHEME "-collection"
@@ -126,9 +117,6 @@ public:
::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
- // Additional interfaces
-
-
// Non-interface methods.
bool getProperty( const OUString & rPropName,
diff --git a/ucb/source/ucp/webdav/webdavprovider.hxx b/ucb/source/ucp/webdav/webdavprovider.hxx
index d0c40e06c8da..68ea8532453a 100644
--- a/ucb/source/ucp/webdav/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav/webdavprovider.hxx
@@ -34,35 +34,28 @@ namespace http_dav_ucp {
// UNO service name for the provider. This name will be used by the UCB to
// create instances of the provider.
-#define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME \
- "com.sun.star.ucb.WebDAVContentProvider"
-#define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 38
+#define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.WebDAVContentProvider"
// URL scheme. This is the scheme the provider will be able to create
// contents for. The UCB will select the provider ( i.e. in order to create
// contents ) according to this scheme.
-#define WEBDAV_URL_SCHEME \
- "vnd.sun.star.webdav"
+#define WEBDAV_URL_SCHEME "vnd.sun.star.webdav"
#define WEBDAV_URL_SCHEME_LENGTH 19
#define HTTP_URL_SCHEME "http"
-#define HTTP_URL_SCHEME_LENGTH 4
#define HTTPS_URL_SCHEME "https"
-#define HTTPS_URL_SCHEME_LENGTH 5
#define DAV_URL_SCHEME "dav"
#define DAV_URL_SCHEME_LENGTH 3
-#define DAVS_URL_SCHEME "davs"
+#define DAVS_URL_SCHEME "davs"
#define DAVS_URL_SCHEME_LENGTH 4
-#define HTTP_CONTENT_TYPE \
- "application/" HTTP_URL_SCHEME "-content"
+#define HTTP_CONTENT_TYPE "application/" HTTP_URL_SCHEME "-content"
#define WEBDAV_CONTENT_TYPE HTTP_CONTENT_TYPE
-#define WEBDAV_COLLECTION_TYPE \
- "application/" WEBDAV_URL_SCHEME "-collection"
+#define WEBDAV_COLLECTION_TYPE "application/" WEBDAV_URL_SCHEME "-collection"
@@ -114,13 +107,8 @@ public:
::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
- // Additional interfaces
-
-
-
// Non-interface methods.
-
bool getProperty( const OUString & rPropName,
::com::sun::star::beans::Property & rProp,
bool bStrict = false );