LCOV - code coverage report
Current view: top level - include/osl - file.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 85 183 46.4 %
Date: 2014-04-14 Functions: 27 67 40.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_OSL_FILE_HXX
      21             : #define INCLUDED_OSL_FILE_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <string.h>
      26             : 
      27             : #include <cassert>
      28             : 
      29             : #include <osl/time.h>
      30             : #include <rtl/ustring.hxx>
      31             : 
      32             : #include <osl/file.h>
      33             : #include <rtl/byteseq.hxx>
      34             : 
      35             : #include <stdio.h>
      36             : 
      37             : namespace osl
      38             : {
      39             : 
      40             : 
      41             : 
      42             : /** Base class for all File System specific objects.
      43             : 
      44             :     @see Directory
      45             :     @see DirectoryItem
      46             :     @see File
      47             :  */
      48             : 
      49     1234559 : class FileBase
      50             : {
      51             : public:
      52             : 
      53             :     enum RC {
      54             :         E_None         = osl_File_E_None,
      55             :         E_PERM         = osl_File_E_PERM,
      56             :         E_NOENT        = osl_File_E_NOENT,
      57             :         E_SRCH         = osl_File_E_SRCH,
      58             :         E_INTR         = osl_File_E_INTR,
      59             :         E_IO           = osl_File_E_IO,
      60             :         E_NXIO         = osl_File_E_NXIO,
      61             :         E_2BIG         = osl_File_E_2BIG,
      62             :         E_NOEXEC       = osl_File_E_NOEXEC,
      63             :         E_BADF         = osl_File_E_BADF,
      64             :         E_CHILD        = osl_File_E_CHILD,
      65             :         E_AGAIN        = osl_File_E_AGAIN,
      66             :         E_NOMEM        = osl_File_E_NOMEM,
      67             :         E_ACCES        = osl_File_E_ACCES,
      68             :         E_FAULT        = osl_File_E_FAULT,
      69             :         E_BUSY         = osl_File_E_BUSY,
      70             :         E_EXIST        = osl_File_E_EXIST,
      71             :         E_XDEV         = osl_File_E_XDEV,
      72             :         E_NODEV        = osl_File_E_NODEV,
      73             :         E_NOTDIR       = osl_File_E_NOTDIR,
      74             :         E_ISDIR        = osl_File_E_ISDIR,
      75             :         E_INVAL        = osl_File_E_INVAL,
      76             :         E_NFILE        = osl_File_E_NFILE,
      77             :         E_MFILE        = osl_File_E_MFILE,
      78             :         E_NOTTY        = osl_File_E_NOTTY,
      79             :         E_FBIG         = osl_File_E_FBIG,
      80             :         E_NOSPC        = osl_File_E_NOSPC,
      81             :         E_SPIPE        = osl_File_E_SPIPE,
      82             :         E_ROFS         = osl_File_E_ROFS,
      83             :         E_MLINK        = osl_File_E_MLINK,
      84             :         E_PIPE         = osl_File_E_PIPE,
      85             :         E_DOM          = osl_File_E_DOM,
      86             :         E_RANGE        = osl_File_E_RANGE,
      87             :         E_DEADLK       = osl_File_E_DEADLK,
      88             :         E_NAMETOOLONG  = osl_File_E_NAMETOOLONG,
      89             :         E_NOLCK        = osl_File_E_NOLCK,
      90             :         E_NOSYS        = osl_File_E_NOSYS,
      91             :         E_NOTEMPTY     = osl_File_E_NOTEMPTY,
      92             :         E_LOOP         = osl_File_E_LOOP,
      93             :         E_ILSEQ        = osl_File_E_ILSEQ,
      94             :         E_NOLINK       = osl_File_E_NOLINK,
      95             :         E_MULTIHOP     = osl_File_E_MULTIHOP,
      96             :         E_USERS        = osl_File_E_USERS,
      97             :         E_OVERFLOW     = osl_File_E_OVERFLOW,
      98             :         E_NOTREADY     = osl_File_E_NOTREADY,
      99             :         E_invalidError = osl_File_E_invalidError,   /* unmapped error: always last entry in enum! */
     100             :         E_TIMEDOUT     = osl_File_E_TIMEDOUT,
     101             :         E_NETWORK      = osl_File_E_NETWORK
     102             :     };
     103             : 
     104             : 
     105             : public:
     106             : 
     107             :     /** Determine a valid unused canonical name for a requested name.
     108             : 
     109             :         Determines a valid unused canonical name for a requested name.
     110             :         Depending on the Operating System and the File System the illegal characters are replaced by valid ones.
     111             :         If a file or directory with the requested name already exists a new name is generated following
     112             :         the common rules on the actual Operating System and File System.
     113             : 
     114             :         @param ustrRequestedURL [in]
     115             :         Requested name of a file or directory.
     116             : 
     117             :         @param ustrValidURL [out]
     118             :         On success receives a name which is unused and valid on the actual Operating System and
     119             :         File System.
     120             : 
     121             :         @return
     122             :         E_None on success
     123             :         E_INVAL the format of the parameters was not valid
     124             : 
     125             :         @see DirectoryItem::getFileStatus()
     126             :     */
     127             : 
     128             :     static inline RC getCanonicalName( const ::rtl::OUString& ustrRequestedURL, ::rtl::OUString& ustrValidURL )
     129             :     {
     130             :         return static_cast< RC >( osl_getCanonicalName( ustrRequestedURL.pData, &ustrValidURL.pData ) );
     131             :     }
     132             : 
     133             :     /** Convert a path relative to a given directory into an full qualified file URL.
     134             : 
     135             :         Convert a path relative to a given directory into an full qualified file URL.
     136             :         The function resolves symbolic links if possible and path ellipses, so on success
     137             :         the resulting absolute path is fully resolved.
     138             : 
     139             :         @param ustrBaseDirectoryURL [in]
     140             :         Base directory URL to which the relative path is related to.
     141             : 
     142             :         @param ustrRelativeFileURL [in]
     143             :         An URL of a file or directory relative to the directory path specified by ustrBaseDirectoryURL
     144             :         or an absolute path.
     145             :         If ustrRelativeFileURL denotes an absolute path ustrBaseDirectoryURL will be ignored.
     146             : 
     147             :         @param ustrAbsoluteFileURL [out]
     148             :         On success it receives the full qualified absolute file URL.
     149             : 
     150             :         @return
     151             :         E_None on success
     152             :         E_INVAL the format of the parameters was not valid
     153             :         E_NOMEM not enough memory for allocating structures
     154             :         E_NOTDIR not a directory
     155             :         E_ACCES permission denied
     156             :         E_NOENT no such file or directory
     157             :         E_NAMETOOLONG file name too long
     158             :         E_OVERFLOW value too large for defined data type
     159             :         E_FAULT bad address
     160             :         E_INTR function call was interrupted
     161             :         E_LOOP too many symbolic links encountered
     162             :         E_MULTIHOP multihop attempted
     163             :         E_NOLINK link has been severed
     164             : 
     165             :         @see DirectoryItem::getFileStatus()
     166             :     */
     167             : 
     168           3 :     static inline RC getAbsoluteFileURL( const ::rtl::OUString& ustrBaseDirectoryURL, const ::rtl::OUString& ustrRelativeFileURL, ::rtl::OUString& ustrAbsoluteFileURL )
     169             :     {
     170           3 :         return static_cast< RC >( osl_getAbsoluteFileURL( ustrBaseDirectoryURL.pData, ustrRelativeFileURL.pData, &ustrAbsoluteFileURL.pData ) );
     171             :     }
     172             : 
     173             :     /** Convert a file URL into a system dependend path.
     174             : 
     175             :         @param ustrFileURL [in]
     176             :         A File URL.
     177             : 
     178             :         @param ustrSystemPath [out]
     179             :         On success it receives the system path.
     180             : 
     181             :         @return
     182             :         E_None on success
     183             :         E_INVAL the format of the parameters was not valid
     184             : 
     185             :         @see getFileURLFromSystemPath()
     186             :     */
     187             : 
     188      127538 :     static inline RC getSystemPathFromFileURL( const ::rtl::OUString& ustrFileURL, ::rtl::OUString& ustrSystemPath )
     189             :     {
     190      127538 :         return static_cast< RC >( osl_getSystemPathFromFileURL( ustrFileURL.pData, &ustrSystemPath.pData ) );
     191             :     }
     192             : 
     193             :     /** Convert a system dependend path into a file URL.
     194             : 
     195             :         @param ustrSystemPath [in]
     196             :         A System dependent path of a file or directory.
     197             : 
     198             :         @param ustrFileURL [out]
     199             :         On success it receives the file URL.
     200             : 
     201             :         @return
     202             :         E_None on success
     203             :         E_INVAL the format of the parameters was not valid
     204             : 
     205             :         @see getSystemPathFromFileURL()
     206             :     */
     207             : 
     208       85023 :     static inline RC getFileURLFromSystemPath( const ::rtl::OUString& ustrSystemPath, ::rtl::OUString& ustrFileURL )
     209             :     {
     210       85023 :         return static_cast< RC >( osl_getFileURLFromSystemPath( ustrSystemPath.pData, &ustrFileURL.pData ) );
     211             :     }
     212             : 
     213             :     /** Searche a full qualified system path or a file URL.
     214             : 
     215             :         @param ustrFileName [in]
     216             :         A system dependent path, a file URL, a file or relative directory
     217             : 
     218             :         @param ustrSearchPath [in]
     219             :         A list of system paths, in which a given file has to be searched. The Notation of a path list is
     220             :         system dependend, e.g. on UNIX system "/usr/bin:/bin" and on Windows "C:\BIN;C:\BATCH".
     221             :         These paths are only for the search of a file or a relative path, otherwise it will be ignored.
     222             :         If ustrSearchPath is NULL or while using the search path the search failed, the function searches for
     223             :         a matching file in all system directories and in the directories listed in the PATH environment
     224             :         variable.
     225             :         The value of an environment variable should be used (e.g. LD_LIBRARY_PATH) if the caller is not
     226             :         aware of the Operating System and so doesn't know which path list delimiter to use.
     227             : 
     228             :         @param ustrFileURL [out]
     229             :         On success it receives the full qualified file URL.
     230             : 
     231             :         @return
     232             :         E_None on success
     233             :         E_INVAL the format of the parameters was not valid
     234             :         E_NOTDIR not a directory
     235             :         E_NOENT no such file or directory not found
     236             : 
     237             :         @see getFileURLFromSystemPath()
     238             :         @see getSystemPathFromFileURL()
     239             :     */
     240             : 
     241           0 :     static inline RC searchFileURL( const ::rtl::OUString& ustrFileName, const ::rtl::OUString& ustrSearchPath, ::rtl::OUString& ustrFileURL )
     242             :     {
     243           0 :         return static_cast< RC >( osl_searchFileURL( ustrFileName.pData, ustrSearchPath.pData, &ustrFileURL.pData ) );
     244             :     }
     245             : 
     246             :     /** Retrieves the file URL of the system's temporary directory path.
     247             : 
     248             :         @param[out] ustrTempDirURL
     249             :         On success receives the URL of system's temporary directory path.
     250             : 
     251             :         @return
     252             :         E_None on success
     253             :         E_NOENT no such file or directory not found
     254             :     */
     255             : 
     256           0 :     static inline RC getTempDirURL( ::rtl::OUString& ustrTempDirURL )
     257             :     {
     258           0 :         return static_cast< RC >( osl_getTempDirURL( &ustrTempDirURL.pData ) );
     259             :     }
     260             : 
     261             :     /** Creates a temporary file in the directory provided by the caller or the
     262             :         directory returned by getTempDirURL.
     263             :         Under UNIX Operating Systems the file will be created with read and write
     264             :         access for the user exclusively.
     265             :         If the caller requests only a handle to the open file but not the name of
     266             :         it, the file will be automatically removed on close else the caller is
     267             :         responsible for removing the file on success.<br><br>
     268             : 
     269             :         @param  pustrDirectoryURL [in]
     270             :         Specifies the full qualified URL where the temporary file should be created.
     271             :         If pustrDirectoryURL is 0 the path returned by osl_getTempDirURL will be used.
     272             : 
     273             :         @param  pHandle [out]
     274             :         On success receives a handle to the open file.
     275             :         If pHandle is 0 the file will be closed on return, in this case
     276             :         pustrTempFileURL must not be 0.
     277             : 
     278             :         @param  pustrTempFileURL [out]
     279             :         On success receives the full qualified URL of the temporary file.
     280             :         If pustrTempFileURL is 0 the file will be automatically removed
     281             :         on close, in this case pHandle must not be 0.
     282             :         If pustrTempFileURL is not 0 the caller receives the name of the
     283             :         created file and is responsible for removing the file.
     284             : 
     285             :         Description of the different pHandle, ppustrTempFileURL parameter combinations.
     286             :         pHandle is 0 and pustrTempDirURL is 0 - this combination is invalid<br>
     287             :         pHandle is not 0 and pustrTempDirURL is 0 - a handle to the open file
     288             :         will be returned on success and the file will be automatically removed on close<br>
     289             :         pHandle is 0 and pustrTempDirURL is not 0 - the name of the file will be
     290             :         returned, the caller is responsible for opening, closing and removing the file.<br>
     291             :         pHandle is not 0 and pustrTempDirURL is not 0 - a handle to the open file as well as
     292             :         the file name will be returned, the caller is responsible for closing and removing
     293             :         the file.<br>
     294             : 
     295             :         @return
     296             :         E_None   on success
     297             :         E_INVAL  the format of the parameter is invalid
     298             :         E_NOMEM  not enough memory for allocating structures
     299             :         E_ACCES  Permission denied
     300             :         E_NOENT  No such file or directory
     301             :         E_NOTDIR Not a directory
     302             :         E_ROFS   Read-only file system
     303             :         E_NOSPC  No space left on device
     304             :         E_DQUOT  Quota exceeded
     305             : 
     306             :         @see getTempDirURL()
     307             :     */
     308             : 
     309           0 :     static inline RC createTempFile(
     310             :         ::rtl::OUString* pustrDirectoryURL,
     311             :         oslFileHandle*   pHandle,
     312             :         ::rtl::OUString* pustrTempFileURL)
     313             :     {
     314           0 :         rtl_uString*  pustr_dir_url       = pustrDirectoryURL ? pustrDirectoryURL->pData : 0;
     315           0 :         rtl_uString** ppustr_tmp_file_url = pustrTempFileURL  ? &pustrTempFileURL->pData : 0;
     316             : 
     317           0 :         return static_cast< RC >( osl_createTempFile(pustr_dir_url, pHandle, ppustr_tmp_file_url) );
     318             :     }
     319             : };
     320             : 
     321             : 
     322             : 
     323             : /** The VolumeDevice class.
     324             : 
     325             :     @see VolumeInfo
     326             : */
     327             : 
     328             : class VolumeDevice : public FileBase
     329             : {
     330             :     oslVolumeDeviceHandle   _aHandle;
     331             : 
     332             : public:
     333             : 
     334             :     /** Constructor.
     335             :     */
     336             : 
     337           0 :     VolumeDevice() : _aHandle( NULL )
     338             :     {
     339           0 :     }
     340             : 
     341             :     /** Copy constructor.
     342             : 
     343             :         @param rDevice
     344             :         The other volume device.
     345             :     */
     346             : 
     347             :     VolumeDevice( const VolumeDevice & rDevice )
     348             :     {
     349             :         _aHandle = rDevice._aHandle;
     350             :         if ( _aHandle )
     351             :             osl_acquireVolumeDeviceHandle( _aHandle );
     352             :     }
     353             : 
     354             :     /** Destructor.
     355             :     */
     356             : 
     357           0 :     ~VolumeDevice()
     358             :     {
     359           0 :         if ( _aHandle )
     360           0 :             osl_releaseVolumeDeviceHandle( _aHandle );
     361           0 :     }
     362             : 
     363             :     /** Assignment operator.
     364             : 
     365             :         @param rDevice
     366             :         The other volume device.
     367             :     */
     368             : 
     369             :     inline VolumeDevice & operator =( const VolumeDevice & rDevice )
     370             :     {
     371             :         oslVolumeDeviceHandle   newHandle = rDevice._aHandle;
     372             : 
     373             :         if ( newHandle )
     374             :             osl_acquireVolumeDeviceHandle( newHandle );
     375             : 
     376             :         if ( _aHandle )
     377             :             osl_releaseVolumeDeviceHandle( _aHandle );
     378             : 
     379             :         _aHandle = newHandle;
     380             : 
     381             :         return *this;
     382             :     }
     383             : 
     384             :     /** Get the full qualified URL where a device is mounted to.
     385             : 
     386             :            @return
     387             :         The full qualified URL where the device is mounted to.
     388             :     */
     389             :     inline rtl::OUString getMountPath()
     390             :     {
     391             :         rtl::OUString   aPath;
     392             :         osl_getVolumeDeviceMountPath( _aHandle, &aPath.pData );
     393             :         return aPath;
     394             :     }
     395             : 
     396             :     friend class VolumeInfo;
     397             : };
     398             : 
     399             : 
     400             : 
     401             : class Directory;
     402             : 
     403             : /** The VolumeInfo class.
     404             : 
     405             :     Neither copy nor assignment is allowed for this class.
     406             : 
     407             :     @see Directory::getVolumeInfo
     408             : */
     409             : 
     410             : 
     411             : class VolumeInfo
     412             : {
     413             :     oslVolumeInfo   _aInfo;
     414             :     sal_uInt32      _nMask;
     415             :     VolumeDevice    _aDevice;
     416             : 
     417             :     /** Copy constructor.
     418             :     */
     419             : 
     420             :     VolumeInfo( VolumeInfo& );
     421             : 
     422             :     /** Assginment operator.
     423             :     */
     424             : 
     425             :     VolumeInfo& operator = ( VolumeInfo& );
     426             : 
     427             : public:
     428             : 
     429             :     /** Constructor.
     430             : 
     431             :         @param nMask
     432             :         Set of flags decribing the demanded information.
     433             :     */
     434             : 
     435           0 :     VolumeInfo( sal_uInt32 nMask )
     436           0 :         : _nMask( nMask )
     437             :     {
     438           0 :         memset( &_aInfo, 0, sizeof( oslVolumeInfo ));
     439           0 :         _aInfo.uStructSize = sizeof( oslVolumeInfo );
     440           0 :         _aInfo.pDeviceHandle = &_aDevice._aHandle;
     441           0 :     }
     442             : 
     443             :     /** Destructor.
     444             :     */
     445             : 
     446           0 :     ~VolumeInfo()
     447           0 :     {
     448           0 :         if( _aInfo.ustrFileSystemName )
     449           0 :             rtl_uString_release( _aInfo.ustrFileSystemName );
     450           0 :     }
     451             : 
     452             :     /** Check if specified fields are valid.
     453             : 
     454             :         @param nMask
     455             :         Set of flags for the fields to check.
     456             : 
     457             :         @return true if all fields are valid else false.
     458             :     */
     459             : 
     460           0 :     inline bool isValid( sal_uInt32 nMask ) const
     461             :     {
     462           0 :         return ( nMask & _aInfo.uValidFields ) == nMask;
     463             :     }
     464             : 
     465             :     /** Check the remote flag.
     466             : 
     467             :         @return
     468             :         true if Attributes are valid and the volume is remote else false.
     469             :     */
     470             : 
     471           0 :     inline bool getRemoteFlag() const
     472             :     {
     473           0 :         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_Remote);
     474             :     }
     475             : 
     476             :     /** Check the removeable flag.
     477             : 
     478             :         @return
     479             :         true if attributes are valid and the volume is removable else false.
     480             :     */
     481             : 
     482           0 :     inline bool getRemoveableFlag() const
     483             :     {
     484           0 :         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_Removeable);
     485             :     }
     486             : 
     487             :     /** Check the compact disc flag.
     488             : 
     489             :         @return
     490             :         true if attributes are valid and the volume is a CDROM else false.
     491             :     */
     492             : 
     493           0 :     inline bool getCompactDiscFlag() const
     494             :     {
     495           0 :         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_CompactDisc);
     496             :     }
     497             : 
     498             :     /** Check the floppy disc flag.
     499             : 
     500             :         @return
     501             :         true if attributes are valid and the volume is a floppy disk else false.
     502             :     */
     503             : 
     504           0 :     inline bool getFloppyDiskFlag() const
     505             :     {
     506           0 :         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_FloppyDisk);
     507             :     }
     508             : 
     509             :     /** Check the fixed disk flag.
     510             : 
     511             :         @return
     512             :         true if attributes are valid and the volume is a fixed disk else false.
     513             :     */
     514             : 
     515             :     inline bool getFixedDiskFlag() const
     516             :     {
     517             :         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_FixedDisk);
     518             :     }
     519             : 
     520             :     /** Check the RAM disk flag.
     521             : 
     522             :         @return
     523             :         true if attributes are valid and the volume is a RAM disk else false.
     524             :     */
     525             : 
     526             :     inline bool getRAMDiskFlag() const
     527             :     {
     528             :         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_RAMDisk);
     529             :     }
     530             : 
     531             :     /** Determine the total space of a volume device.
     532             : 
     533             :         @return
     534             :         The total diskspace of this volume if this information is valid,
     535             :         0 otherwise.
     536             :     */
     537             : 
     538             :     inline sal_uInt64 getTotalSpace() const
     539             :     {
     540             :         return _aInfo.uTotalSpace;
     541             :     }
     542             : 
     543             :     /** Determine the free space of a volume device.
     544             : 
     545             :         @return
     546             :         The free diskspace of this volume if this information is valid,
     547             :         0 otherwise.
     548             :     */
     549             : 
     550           0 :     inline sal_uInt64 getFreeSpace() const
     551             :     {
     552           0 :         return _aInfo.uFreeSpace;
     553             :     }
     554             : 
     555             :     /** Determine the used space of a volume device.
     556             : 
     557             :         @return
     558             :         The used diskspace of this volume if this information is valid,
     559             :         0 otherwise.
     560             :     */
     561             : 
     562             :     inline sal_uInt64 getUsedSpace() const
     563             :     {
     564             :         return _aInfo.uUsedSpace;
     565             :     }
     566             : 
     567             :     /** Determine the maximal length of a file name.
     568             : 
     569             :         @return
     570             :         The maximal length of a file name if this information is valid,
     571             :         0 otherwise.
     572             :     */
     573             : 
     574             :     inline sal_uInt32 getMaxNameLength() const
     575             :     {
     576             :         return _aInfo.uMaxNameLength;
     577             :     }
     578             : 
     579             :     /** Determine the maximal length of a path name.
     580             : 
     581             :         @return
     582             :         The maximal length of a path if this information is valid,
     583             :         0 otherwise.
     584             :     */
     585             : 
     586             :     inline sal_uInt32 getMaxPathLength() const
     587             :     {
     588             :         return _aInfo.uMaxPathLength;
     589             :     }
     590             : 
     591             :     /** Determine the name of the volume device's File System.
     592             : 
     593             :         @return
     594             :         The name of the volume's fielsystem if this information is valid,
     595             :         otherwise an empty string.
     596             :     */
     597             : 
     598             :     inline ::rtl::OUString getFileSystemName() const
     599             :     {
     600             :         return _aInfo.ustrFileSystemName ? ::rtl::OUString( _aInfo.ustrFileSystemName ) : ::rtl::OUString();
     601             :     }
     602             : 
     603             : 
     604             :     /** Get the volume device handle.
     605             : 
     606             :         @return
     607             :         The device handle of the volume if this information is valid,
     608             :         otherwise returns NULL;
     609             :     */
     610             : 
     611             :     inline VolumeDevice getDeviceHandle() const
     612             :     {
     613             :         return _aDevice;
     614             :     }
     615             : 
     616             :     /** Return whether the file system is case sensitive or
     617             :         case insensitive
     618             : 
     619             :         @return
     620             :         true if the file system is case sensitive false otherwise
     621             :     */
     622             :     bool isCaseSensitiveFileSystem() const
     623             :     {
     624             :         return (_aInfo.uAttributes & osl_Volume_Attribute_Case_Sensitive);
     625             :     }
     626             : 
     627             :     /** Return whether the file system preserves the case of
     628             :         file and directory names or not
     629             : 
     630             :         @return
     631             :         true if the file system preserves the case of file and
     632             :         directory names false otherwise
     633             :     */
     634             :     bool isCasePreservingFileSystem() const
     635             :     {
     636             :         return (_aInfo.uAttributes & osl_Volume_Attribute_Case_Is_Preserved);
     637             :     }
     638             : 
     639             :     friend class Directory;
     640             : };
     641             : 
     642             : 
     643             : class DirectoryItem;
     644             : 
     645             : /** The FileStatus class.
     646             : 
     647             :     @see DirectoryItem::getFileStatus
     648             : */
     649             : 
     650             : class FileStatus
     651             : {
     652             :     oslFileStatus   _aStatus;
     653             :     sal_uInt32      _nMask;
     654             : 
     655             :     /** Copy constructor.
     656             :     */
     657             : 
     658             :     FileStatus( FileStatus& );
     659             : 
     660             :     /** Assignment operator.
     661             :     */
     662             : 
     663             :     FileStatus& operator = ( FileStatus& );
     664             : 
     665             : public:
     666             : 
     667             :     enum Type {
     668             :         Directory = osl_File_Type_Directory,
     669             :         Volume    = osl_File_Type_Volume,
     670             :         Regular   = osl_File_Type_Regular,
     671             :         Fifo      = osl_File_Type_Fifo,
     672             :         Socket    = osl_File_Type_Socket,
     673             :         Link      = osl_File_Type_Link,
     674             :         Special   = osl_File_Type_Special,
     675             :         Unknown   = osl_File_Type_Unknown
     676             :     };
     677             : 
     678             :     /** Constructor.
     679             : 
     680             :         @param nMask
     681             :         Set of flags decribing the demanded information.
     682             :     */
     683             : 
     684     1106867 :     FileStatus( sal_uInt32 nMask ): _nMask( nMask )
     685             :     {
     686     1106867 :         _aStatus.uStructSize = sizeof( oslFileStatus );
     687     1106867 :         memset( &_aStatus.uValidFields, 0, sizeof( oslFileStatus ) - sizeof( sal_uInt32 ) );
     688     1106867 :     }
     689             : 
     690             :     /** Destructor.
     691             :     */
     692             : 
     693     1106867 :     ~FileStatus()
     694             :     {
     695     1106867 :         if ( _aStatus.ustrFileURL )
     696      850275 :             rtl_uString_release( _aStatus.ustrFileURL );
     697     1106867 :         if ( _aStatus.ustrLinkTargetURL )
     698          25 :             rtl_uString_release( _aStatus.ustrLinkTargetURL );
     699     1106867 :         if ( _aStatus.ustrFileName )
     700           5 :             rtl_uString_release( _aStatus.ustrFileName );
     701     1106867 :     }
     702             : 
     703             :     /** Check if specified fields are valid.
     704             : 
     705             :         @param nMask
     706             :         Set of flags for the fields to check.
     707             : 
     708             :         @return
     709             :         true if all fields are valid else false.
     710             :     */
     711             : 
     712      850528 :     inline bool isValid( sal_uInt32 nMask ) const
     713             :     {
     714      850528 :         return ( nMask & _aStatus.uValidFields ) == nMask;
     715             :     }
     716             : 
     717             :     /** Get the file type.
     718             : 
     719             :         @return
     720             :         The file type.
     721             :     */
     722         229 :     inline Type getFileType() const
     723             :     {
     724             :         SAL_INFO_IF(
     725             :             !isValid(osl_FileStatus_Mask_Type), "sal.osl",
     726             :             "no FileStatus Type determined");
     727         229 :         return isValid(osl_FileStatus_Mask_Type)
     728         229 :             ? static_cast< Type >(_aStatus.eType) : Unknown;
     729             :     }
     730             : 
     731             :     /** Is it a directory?
     732             :         This method returns True for both directories, and volumes.
     733             : 
     734             :         @return
     735             :         True if it's a directory, False otherwise.
     736             : 
     737             :         @see getFileType
     738             :         @since LibreOffice 3.6
     739             :     */
     740           0 :     inline bool isDirectory() const
     741             :     {
     742           0 :         return ( getFileType() == Directory || getFileType() == Volume );
     743             :     }
     744             : 
     745             :     /** Is it a regular file?
     746             : 
     747             :         @return
     748             :         True if it's a regular file, False otherwise.
     749             : 
     750             :         @see getFileType
     751             :         @see isFile
     752             :         @see isLink
     753             :         @since LibreOffice 3.6
     754             :     */
     755           0 :     inline bool isRegular() const
     756             :     {
     757           0 :         return ( getFileType() == Regular );
     758             :     }
     759             : 
     760             :     /** Is it a link?
     761             : 
     762             :         @return
     763             :         True if it's a link, False otherwise.
     764             : 
     765             :         @see getFileType
     766             :         @since LibreOffice 3.6
     767             :     */
     768             :     inline bool isLink() const
     769             :     {
     770             :         return ( getFileType() == Link );
     771             :     }
     772             : 
     773             :     /** Get the file attributes.
     774             : 
     775             :         @return
     776             :         The set of attribute flags of this file.
     777             :     */
     778             : 
     779           0 :     inline sal_uInt64 getAttributes() const
     780             :     {
     781             :         SAL_INFO_IF(
     782             :             !isValid(osl_FileStatus_Mask_Attributes), "sal.osl",
     783             :             "no FileStatus Attributes determined");
     784           0 :         return _aStatus.uAttributes;
     785             :     }
     786             : 
     787             :     /** Get the creation time of this file.
     788             : 
     789             :         @return
     790             :         The creation time if this information is valid, an uninitialized
     791             :         TimeValue otherwise.
     792             :     */
     793             : 
     794             :     inline TimeValue getCreationTime() const
     795             :     {
     796             :         SAL_INFO_IF(
     797             :             !isValid(osl_FileStatus_Mask_CreationTime), "sal.osl",
     798             :             "no FileStatus CreationTime determined");
     799             :         return _aStatus.aCreationTime;
     800             :     }
     801             : 
     802             :     /** Get the file access time.
     803             : 
     804             :         @return
     805             :         The last access time if this information is valid, an uninitialized
     806             :         TimeValue otherwise.
     807             :     */
     808             : 
     809             :     inline TimeValue getAccessTime() const
     810             :     {
     811             :         SAL_INFO_IF(
     812             :             !isValid(osl_FileStatus_Mask_AccessTime), "sal.osl",
     813             :             "no FileStatus AccessTime determined");
     814             :         return _aStatus.aAccessTime;
     815             :     }
     816             : 
     817             :     /** Get the file modification time.
     818             : 
     819             :         @return
     820             :         The last modified time if this information is valid, an uninitialized
     821             :         TimeValue otherwise.
     822             :     */
     823             : 
     824           0 :     inline TimeValue getModifyTime() const
     825             :     {
     826             :         SAL_INFO_IF(
     827             :             !isValid(osl_FileStatus_Mask_ModifyTime), "sal.osl",
     828             :             "no FileStatus ModifyTime determined");
     829           0 :         return _aStatus.aModifyTime;
     830             :     }
     831             : 
     832             :     /** Get the size of the file.
     833             : 
     834             :         @return
     835             :         The actual file size if this information is valid, 0 otherwise.
     836             :     */
     837             : 
     838           0 :     inline sal_uInt64 getFileSize() const
     839             :     {
     840             :         SAL_INFO_IF(
     841             :             !isValid(osl_FileStatus_Mask_FileSize), "sal.osl",
     842             :             "no FileStatus FileSize determined");
     843           0 :         return _aStatus.uFileSize;
     844             :     }
     845             : 
     846             :     /** Get the file name.
     847             : 
     848             :         @return
     849             :         The file name if this information is valid, an empty string otherwise.
     850             :     */
     851             : 
     852           5 :     inline ::rtl::OUString getFileName() const
     853             :     {
     854             :         SAL_INFO_IF(
     855             :             !isValid(osl_FileStatus_Mask_FileName), "sal.osl",
     856             :             "no FileStatus FileName determined");
     857           5 :         return isValid(osl_FileStatus_Mask_FileName)
     858           5 :             ? rtl::OUString(_aStatus.ustrFileName) : rtl::OUString();
     859             :     }
     860             : 
     861             : 
     862             :     /** Get the URL of the file.
     863             : 
     864             :         @return
     865             :         The full qualified URL of the file if this information is valid, an
     866             :         empty string otherwise.
     867             :     */
     868             : 
     869      850269 :     inline ::rtl::OUString getFileURL() const
     870             :     {
     871             :         SAL_INFO_IF(
     872             :             !isValid(osl_FileStatus_Mask_FileURL), "sal.osl",
     873             :             "no FileStatus FileURL determined");
     874      850269 :         return isValid(osl_FileStatus_Mask_FileURL)
     875      850269 :             ? rtl::OUString(_aStatus.ustrFileURL) : rtl::OUString();
     876             :     }
     877             : 
     878             :     /** Get the link target URL.
     879             : 
     880             :         @return
     881             :         The link target URL if this information is valid, an empty string
     882             :         otherwise.
     883             :     */
     884             : 
     885          25 :     inline ::rtl::OUString getLinkTargetURL() const
     886             :     {
     887             :         SAL_INFO_IF(
     888             :             !isValid(osl_FileStatus_Mask_LinkTargetURL), "sal.osl",
     889             :             "no FileStatus LinkTargetURL determined");
     890          25 :         return isValid(osl_FileStatus_Mask_LinkTargetURL)
     891          25 :             ? rtl::OUString(_aStatus.ustrLinkTargetURL) : rtl::OUString();
     892             :     }
     893             : 
     894             :     friend class DirectoryItem;
     895             : };
     896             : 
     897             : 
     898             : 
     899             : /** The file class object provides access to file contents and attributes.
     900             : 
     901             :     @see Directory
     902             :     @see DirectoryItem
     903             :  */
     904             : 
     905             : class File: public FileBase
     906             : {
     907             :     oslFileHandle   _pData;
     908             :     ::rtl::OUString _aPath;
     909             : 
     910             :     /** Copy constructor.
     911             :     */
     912             : 
     913             :     File( File& );
     914             : 
     915             :     /** Assginment operator.
     916             :     */
     917             : 
     918             :     File& operator = ( File& );
     919             : 
     920             : public:
     921             : 
     922             :     /** Constructor.
     923             : 
     924             :         @param  ustrFileURL [in]
     925             :         The full qualified URL of the file. Relative paths are not allowed.
     926             :     */
     927             : 
     928           1 :     File( const ::rtl::OUString& ustrFileURL ): _pData( 0 ), _aPath( ustrFileURL ) {}
     929             : 
     930             :     /** Destructor
     931             :     */
     932             : 
     933           1 :     inline ~File()
     934           1 :     {
     935           1 :         close();
     936           1 :     }
     937             : 
     938             :     /** Obtain the URL.
     939             : 
     940             :         @return
     941             :         the URL with which this File instance was created.
     942             : 
     943             :         @since LibreOffice 4.1
     944             :     */
     945           0 :     inline rtl::OUString getURL() const { return _aPath; }
     946             : 
     947             :     /** Open a regular file.
     948             : 
     949             :         Open a file. Only regular files can be openend.
     950             : 
     951             :         @param uFlags [in]
     952             :         Specifies the open mode.
     953             : 
     954             :         @return
     955             :         E_None on success
     956             :         E_NOMEM not enough memory for allocating structures
     957             :         E_INVAL the format of the parameters was not valid
     958             :         E_NAMETOOLONG pathname was too long
     959             :         E_NOENT no such file or directory
     960             :         E_ACCES permission denied
     961             :         E_AGAIN a write lock could not be established
     962             :         E_NOTDIR not a directory
     963             :         E_NXIO no such device or address
     964             :         E_NODEV no such device
     965             :         E_ROFS read-only file system
     966             :         E_TXTBSY text file busy
     967             :         E_FAULT bad address
     968             :         E_LOOP too many symbolic links encountered
     969             :         E_NOSPC no space left on device
     970             :         E_ISDIR is a directory
     971             :         E_MFILE too many open files used by the process
     972             :         E_NFILE too many open files in the system
     973             :         E_DQUOT quota exceeded
     974             :         E_EXIST file exists
     975             :         E_INTR function call was interrupted
     976             :         E_IO on I/O errors
     977             :         E_MULTIHOP multihop attempted
     978             :         E_NOLINK link has been severed
     979             :         E_EOVERFLOW value too large for defined data type
     980             : 
     981             :         @see close()
     982             :         @see setPos()
     983             :         @see getPos()
     984             :         @see read()
     985             :         @see write()
     986             :         @see getSize()
     987             :         @see setSize()
     988             :     */
     989             : 
     990           1 :     inline RC open( sal_uInt32 uFlags )
     991             :     {
     992           1 :         return static_cast< RC >( osl_openFile( _aPath.pData, &_pData, uFlags ) );
     993             :     }
     994             : 
     995             :     /** Close an open file.
     996             : 
     997             :         @return
     998             :         E_None on success
     999             :         E_INVAL the format of the parameters was not valid
    1000             :         E_BADF Bad file
    1001             :         E_INTR function call was interrupted
    1002             :         E_NOLINK link has been severed
    1003             :         E_NOSPC no space left on device
    1004             :         E_IO on I/O errors
    1005             : 
    1006             :         @see open()
    1007             :     */
    1008             : 
    1009           2 :     inline RC close()
    1010             :     {
    1011           2 :         oslFileError Error = osl_File_E_BADF;
    1012             : 
    1013           2 :         if( _pData )
    1014             :         {
    1015           1 :             Error=osl_closeFile( _pData );
    1016           1 :             _pData = NULL;
    1017             :         }
    1018             : 
    1019           2 :         return static_cast< RC >( Error );
    1020             :     }
    1021             : 
    1022             :     /** Set the internal position pointer of an open file.
    1023             : 
    1024             :         @param uHow [in]
    1025             :         Distance to move the internal position pointer (from uPos).
    1026             : 
    1027             :         @param uPos [in]
    1028             :         Absolute position from the beginning of the file.
    1029             : 
    1030             :         @return
    1031             :         E_None on success
    1032             :         E_INVAL the format of the parameters was not valid
    1033             :         E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
    1034             : 
    1035             :         @see open()
    1036             :         @see getPos()
    1037             :     */
    1038             : 
    1039           0 :     inline RC setPos( sal_uInt32 uHow, sal_Int64 uPos ) SAL_WARN_UNUSED_RESULT
    1040             :     {
    1041           0 :         return static_cast< RC >( osl_setFilePos( _pData, uHow, uPos ) );
    1042             :     }
    1043             : 
    1044             :     /** Retrieve the current position of the internal pointer of an open file.
    1045             : 
    1046             :         @param uPos [out]
    1047             :         On success receives the current position of the file pointer.
    1048             : 
    1049             :         @return
    1050             :         E_None on success
    1051             :         E_INVAL the format of the parameters was not valid
    1052             :         E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
    1053             : 
    1054             :         @see open()
    1055             :         @see setPos()
    1056             :         @see read()
    1057             :         @see write()
    1058             :     */
    1059             : 
    1060           0 :     inline RC getPos( sal_uInt64& uPos )
    1061             :     {
    1062           0 :         return static_cast< RC >( osl_getFilePos( _pData, &uPos ) );
    1063             :     }
    1064             : 
    1065             :     /** Test if the end of a file is reached.
    1066             : 
    1067             :         @param pIsEOF [out]
    1068             :         Points to a variable that receives the end-of-file status.
    1069             : 
    1070             :         @return
    1071             :         E_None on success
    1072             :         E_INVAL the format of the parameters was not valid
    1073             :         E_INTR function call was interrupted
    1074             :         E_IO on I/O errors
    1075             :         E_ISDIR is a directory
    1076             :         E_BADF bad file
    1077             :         E_FAULT bad address
    1078             :         E_AGAIN operation would block
    1079             :         E_NOLINK link has been severed
    1080             : 
    1081             :         @see open()
    1082             :         @see read()
    1083             :         @see readLine()
    1084             :         @see setPos()
    1085             :     */
    1086             : 
    1087           0 :     inline RC isEndOfFile( sal_Bool *pIsEOF )
    1088             :     {
    1089           0 :         return static_cast< RC >( osl_isEndOfFile( _pData, pIsEOF ) );
    1090             :     }
    1091             : 
    1092             :     /** Set the file size of an open file.
    1093             : 
    1094             :         Sets the file size of an open file. The file can be truncated or enlarged by the function.
    1095             :         The position of the file pointer is not affeced by this function.
    1096             : 
    1097             :         @param uSize [in]
    1098             :         New size in bytes.
    1099             : 
    1100             :         @return
    1101             :         E_None on success
    1102             :         E_INVAL the format of the parameters was not valid
    1103             :         E_OVERFLOW the resulting file offset would be a value which cannot  be represented correctly for regular files
    1104             : 
    1105             :         @see open()
    1106             :         @see setPos()
    1107             :         @see getStatus()
    1108             :     */
    1109             : 
    1110           0 :     inline RC setSize( sal_uInt64 uSize )
    1111             :     {
    1112           0 :         return static_cast< RC >( osl_setFileSize( _pData, uSize ) );
    1113             :     }
    1114             : 
    1115             :     /** Get the file size of an open file.
    1116             : 
    1117             :         Gets the file size of an open file.
    1118             :         The position of the file pointer is not affeced by this function.
    1119             : 
    1120             :         @param rSize [out]
    1121             :         Current size in bytes.
    1122             : 
    1123             :         @return
    1124             :         E_None on success
    1125             :         E_INVAL the format of the parameters was not valid
    1126             :         E_OVERFLOW the resulting file offset would be a value which cannot  be represented correctly for regular files
    1127             : 
    1128             :         @see open()
    1129             :         @see setPos()
    1130             :         @see getSize()
    1131             :         @see setSize()
    1132             :         @see getStatus()
    1133             :     */
    1134             : 
    1135           0 :     inline RC getSize( sal_uInt64 &rSize )
    1136             :     {
    1137           0 :         return static_cast< RC >( osl_getFileSize( _pData, &rSize ) );
    1138             :     }
    1139             : 
    1140             :     /** Read a number of bytes from a file.
    1141             : 
    1142             :         Reads a number of bytes from a file. The internal file pointer is
    1143             :         increased by the number of bytes read.
    1144             : 
    1145             :         @param pBuffer [out]
    1146             :         Points to a buffer which receives data. The buffer must be large enough
    1147             :         to hold uBytesRequested bytes.
    1148             : 
    1149             :         @param uBytesRequested [in]
    1150             :         Number of bytes which should be retrieved.
    1151             : 
    1152             :         @param rBytesRead [out]
    1153             :         On success the number of bytes which have actually been retrieved.
    1154             : 
    1155             :         @return
    1156             :         E_None on success
    1157             :         E_INVAL the format of the parameters was not valid
    1158             :         E_INTR function call was interrupted
    1159             :         E_IO on I/O errors
    1160             :         E_ISDIR is a directory
    1161             :         E_BADF bad file
    1162             :         E_FAULT bad address
    1163             :         E_AGAIN operation would block
    1164             :         E_NOLINK link has been severed
    1165             : 
    1166             :         @see open()
    1167             :         @see write()
    1168             :         @see readLine()
    1169             :         @see setPos()
    1170             :     */
    1171             : 
    1172           0 :     inline RC read( void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64& rBytesRead )
    1173             :     {
    1174           0 :         return static_cast< RC >( osl_readFile( _pData, pBuffer, uBytesRequested, &rBytesRead ) );
    1175             :     }
    1176             : 
    1177             :     /** Write a number of bytes to a file.
    1178             : 
    1179             :         Writes a number of bytes to a file.
    1180             :         The internal file pointer is increased by the number of bytes read.
    1181             : 
    1182             :         @param pBuffer [in]
    1183             :         Points to a buffer which contains the data.
    1184             : 
    1185             :         @param uBytesToWrite [in]
    1186             :         Number of bytes which should be written.
    1187             : 
    1188             :         @param rBytesWritten [out]
    1189             :         On success the number of bytes which have actually been written.
    1190             : 
    1191             :         @return
    1192             :         E_None on success
    1193             :         E_INVAL the format of the parameters was not valid
    1194             :         E_FBIG file too large
    1195             :         E_DQUOT quota exceeded
    1196             :         E_AGAIN operation would block
    1197             :         E_BADF bad file
    1198             :         E_FAULT bad address
    1199             :         E_INTR function call was interrupted
    1200             :         E_IO on I/O errosr
    1201             :         E_NOLCK no record locks available
    1202             :         E_NOLINK link has been severed
    1203             :         E_NOSPC no space left on device
    1204             :         E_NXIO no such device or address
    1205             : 
    1206             :         @see open()
    1207             :         @see read()
    1208             :         @see setPos()
    1209             :     */
    1210             : 
    1211           0 :     inline RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten)
    1212             :     {
    1213           0 :         return static_cast< RC >( osl_writeFile( _pData, pBuffer, uBytesToWrite, &rBytesWritten ) );
    1214             :     }
    1215             : 
    1216             : 
    1217             :     /** Read a line from a file.
    1218             : 
    1219             :         Reads a line from a file. The new line delimiter is NOT returned!
    1220             : 
    1221             :         @param  aSeq [in/out]
    1222             :         A reference to a ::rtl::ByteSequence that will hold the line read on success.
    1223             : 
    1224             :         @return
    1225             :         E_None on success
    1226             :         E_INVAL the format of the parameters was not valid
    1227             :         E_INTR function call was interrupted
    1228             :         E_IO on I/O errors
    1229             :         E_ISDIR is a directory
    1230             :         E_BADF bad file
    1231             :         E_FAULT bad address
    1232             :         E_AGAIN operation would block
    1233             :         E_NOLINK link has been severed
    1234             : 
    1235             :         @see open()
    1236             :         @see read()
    1237             :         @see write()
    1238             :         @see setPos()
    1239             :     */
    1240             : 
    1241           1 :     inline RC readLine( ::rtl::ByteSequence& aSeq )
    1242             :     {
    1243           1 :         return static_cast< RC >( osl_readLine( _pData, reinterpret_cast<sal_Sequence**>(&aSeq) ) );
    1244             :     }
    1245             : 
    1246             :     /** Synchronize the memory representation of a file with that on the physical medium.
    1247             : 
    1248             :     The function ensures that all modified data and attributes of the file associated with
    1249             :     the given file handle have been written to the physical medium.
    1250             :     In case the hard disk has a write cache enabled, the data may not really be on
    1251             :     permanent storage when osl_syncFile returns.
    1252             : 
    1253             :     @return
    1254             :     <dl>
    1255             :     <dt>E_None</dt>
    1256             :     <dd>On success</dd>
    1257             :     <dt>E_INVAL</dt>
    1258             :     <dd>The value of the input parameter is invalid</dd>
    1259             :     <br><p><strong>In addition to these error codes others may occur as well, for instance:</strong></p><br>
    1260             :     <dt>E_BADF</dt>
    1261             :     <dd>The file is not open for writing</dd>
    1262             :     <dt>E_IO</dt>
    1263             :     <dd>An I/O error occurred</dd>
    1264             :     <dt>E_NOSPC</dt>
    1265             :     <dd>There is no enough space on the target device</dd>
    1266             :     <dt>E_ROFS</dt>
    1267             :     <dd>The file is located on a read only file system</dd>
    1268             :     <dt>E_TIMEDOUT</dt>
    1269             :     <dd>A remote connection timed out. This may happen when a file is on a remote location</dd>
    1270             :     </dl>
    1271             : 
    1272             :     @see osl_syncFile()
    1273             :     @see open()
    1274             :     @see write()
    1275             :     */
    1276           0 :     inline RC sync() const
    1277             :     {
    1278             :         OSL_PRECOND(_pData, "File::sync(): File not open");
    1279           0 :         return static_cast< RC >(osl_syncFile(_pData));
    1280             :     }
    1281             : 
    1282             :     /** Copy a file to a new destination.
    1283             : 
    1284             :         Copies a file to a new destination. Copies only files not directories.
    1285             :         No assumptions should be made about preserving attributes or file time.
    1286             : 
    1287             :         @param ustrSourceFileURL [in]
    1288             :         Full qualified URL of the source file.
    1289             : 
    1290             :         @param ustrDestFileURL [in]
    1291             :         Full qualified URL of the destination file. A directory is NOT a valid destination file!
    1292             : 
    1293             :         @return
    1294             :         E_None on success
    1295             :         E_INVAL the format of the parameters was not valid
    1296             :         E_NOMEM not enough memory for allocating structures
    1297             :         E_ACCES permission denied
    1298             :         E_PERM operation not permitted
    1299             :         E_NAMETOOLONG file name too long
    1300             :         E_NOENT no such file or directory
    1301             :         E_ISDIR is a directory
    1302             :         E_ROFS read-only file system
    1303             : 
    1304             :         @see move()
    1305             :         @see remove()
    1306             :     */
    1307             : 
    1308           0 :     inline static RC copy( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
    1309             :     {
    1310           0 :         return static_cast< RC >( osl_copyFile( ustrSourceFileURL.pData, ustrDestFileURL.pData ) );
    1311             :     }
    1312             : 
    1313             :     /** Move a file or directory to a new destination or renames it.
    1314             : 
    1315             :         Moves a file or directory to a new destination or renames it.
    1316             :         File time and attributes are preserved.
    1317             : 
    1318             :         @param ustrSourceFileURL [in]
    1319             :         Full qualified URL of the source file.
    1320             : 
    1321             :         @param ustrDestFileURL [in]
    1322             :         Full qualified URL of the destination file. An existing directory is NOT a valid destination !
    1323             : 
    1324             :         @return
    1325             :         E_None on success
    1326             :         E_INVAL the format of the parameters was not valid
    1327             :         E_NOMEM not enough memory for allocating structures
    1328             :         E_ACCES permission denied
    1329             :         E_PERM operation not permitted
    1330             :         E_NAMETOOLONG file name too long
    1331             :         E_NOENT no such file or directory
    1332             :         E_ROFS read-only file system
    1333             : 
    1334             :         @see copy()
    1335             :     */
    1336             : 
    1337           0 :     inline static RC move( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
    1338             :     {
    1339           0 :         return static_cast< RC >( osl_moveFile( ustrSourceFileURL.pData, ustrDestFileURL.pData ) );
    1340             :     }
    1341             : 
    1342             :     /** Remove a regular file.
    1343             : 
    1344             :         @param ustrFileURL [in]
    1345             :         Full qualified URL of the file to remove.
    1346             : 
    1347             :         @return
    1348             :         E_None on success
    1349             :         E_INVAL the format of the parameters was not valid
    1350             :         E_NOMEM not enough memory for allocating structures
    1351             :         E_ACCES permission denied
    1352             :         E_PERM operation not permitted
    1353             :         E_NAMETOOLONG file name too long
    1354             :         E_NOENT no such file or directory
    1355             :         E_ISDIR is a directory
    1356             :         E_ROFS read-only file system
    1357             :         E_FAULT bad address
    1358             :         E_LOOP too many symbolic links encountered
    1359             :         E_IO on I/O errors
    1360             :         E_BUSY device or resource busy
    1361             :         E_INTR function call was interrupted
    1362             :         E_LOOP too many symbolic links encountered
    1363             :         E_MULTIHOP multihop attempted
    1364             :         E_NOLINK link has been severed
    1365             :         E_TXTBSY text file busy
    1366             : 
    1367             :         @see open()
    1368             :     */
    1369             : 
    1370           0 :     inline static RC remove( const ::rtl::OUString& ustrFileURL )
    1371             :     {
    1372           0 :         return static_cast< RC >( osl_removeFile( ustrFileURL.pData ) );
    1373             :     }
    1374             : 
    1375             :     /** Set file attributes.
    1376             : 
    1377             :         @param ustrFileURL [in]
    1378             :         The full qualified file URL.
    1379             : 
    1380             :         @param uAttributes [in]
    1381             :         Attributes of the file to be set.
    1382             : 
    1383             :         @return
    1384             :         E_None on success
    1385             :         E_INVAL the format of the parameters was not valid
    1386             : 
    1387             :         @see FileStatus
    1388             :     */
    1389             : 
    1390           0 :     inline static RC setAttributes( const ::rtl::OUString& ustrFileURL, sal_uInt64 uAttributes )
    1391             :     {
    1392           0 :         return static_cast< RC >( osl_setFileAttributes( ustrFileURL.pData, uAttributes ) );
    1393             :     }
    1394             : 
    1395             :     /** Set the file time.
    1396             : 
    1397             :         @param ustrFileURL [in]
    1398             :         The full qualified URL of the file.
    1399             : 
    1400             :         @param rCreationTime [in]
    1401             :         Creation time of the given file.
    1402             : 
    1403             :         @param rLastAccessTime [in]
    1404             :         Time of the last access of the given file.
    1405             : 
    1406             :         @param rLastWriteTime [in]
    1407             :         Time of the last modifying of the given file.
    1408             : 
    1409             :         @return
    1410             :         E_None on success
    1411             :         E_INVAL the format of the parameters was not valid
    1412             :         E_NOENT no such file or directory not found
    1413             : 
    1414             :         @see FileStatus
    1415             :     */
    1416             : 
    1417             :     inline static RC setTime(
    1418             :         const ::rtl::OUString& ustrFileURL,
    1419             :         const TimeValue& rCreationTime,
    1420             :         const TimeValue& rLastAccessTime,
    1421             :         const TimeValue& rLastWriteTime )
    1422             :     {
    1423             :         return static_cast< RC >( osl_setFileTime(
    1424             :             ustrFileURL.pData,
    1425             :             &rCreationTime,
    1426             :             &rLastAccessTime,
    1427             :             &rLastWriteTime ) );
    1428             :     }
    1429             : 
    1430             :     friend class DirectoryItem;
    1431             : };
    1432             : 
    1433             : 
    1434             : /** The directory item class object provides access to file status information.
    1435             : 
    1436             :     @see FileStatus
    1437             :  */
    1438             : 
    1439             : class DirectoryItem: public FileBase
    1440             : {
    1441             :     oslDirectoryItem _pData;
    1442             : 
    1443             : public:
    1444             : 
    1445             :     /** Constructor.
    1446             :     */
    1447             : 
    1448     1234482 :     DirectoryItem(): _pData( NULL )
    1449             :     {
    1450     1234482 :     }
    1451             : 
    1452             :     /** Copy constructor.
    1453             :     */
    1454             : 
    1455           0 :     DirectoryItem( const DirectoryItem& rItem ): _pData( rItem._pData)
    1456             :     {
    1457           0 :         if( _pData )
    1458           0 :             osl_acquireDirectoryItem( _pData );
    1459           0 :     }
    1460             : 
    1461             :     /** Destructor.
    1462             :     */
    1463             : 
    1464     1234482 :     ~DirectoryItem()
    1465             :     {
    1466     1234482 :         if( _pData )
    1467     1105302 :             osl_releaseDirectoryItem( _pData );
    1468     1234482 :     }
    1469             : 
    1470             :     /** Assignment operator.
    1471             :     */
    1472             : 
    1473           0 :     DirectoryItem& operator=(const DirectoryItem& rItem )
    1474             :     {
    1475           0 :         if (&rItem != this)
    1476             :         {
    1477           0 :             if( _pData )
    1478           0 :                 osl_releaseDirectoryItem( _pData );
    1479             : 
    1480           0 :             _pData = rItem._pData;
    1481             : 
    1482           0 :             if( _pData )
    1483           0 :                 osl_acquireDirectoryItem( _pData );
    1484             :         }
    1485           0 :         return *this;
    1486             :     }
    1487             : 
    1488             :     /** Check for validity of this instance.
    1489             : 
    1490             :         @return
    1491             :         true if object is valid directory item else false.
    1492             :      */
    1493             : 
    1494           0 :     inline bool is()
    1495             :     {
    1496           0 :         return _pData != NULL;
    1497             :     }
    1498             : 
    1499             :     /** Retrieve a single directory item.
    1500             : 
    1501             :         Retrieves a single directory item. The returned handle has an initial refcount of 1.
    1502             :         Due to performance issues it is not recommended to use this function while
    1503             :         enumerating the contents of a directory. In this case use osl_getNextDirectoryItem() instead.
    1504             : 
    1505             :         @param ustrFileURL [in]
    1506             :         An absolute file URL.
    1507             : 
    1508             :         @param rItem [out]
    1509             :         On success it receives a handle which can be used for subsequent calls to osl_getFileStatus().
    1510             :         The handle has to be released by a call to osl_releaseDirectoryItem().
    1511             : 
    1512             :         @return
    1513             :         E_None on success
    1514             :         E_INVAL the format of the parameters was not valid
    1515             :         E_NOMEM not enough memory for allocating structures
    1516             :         E_ACCES permission denied
    1517             :         E_MFILE too many open files used by the process
    1518             :         E_NFILE too many open files in the system
    1519             :         E_NOENT no such file or directory
    1520             :         E_LOOP  too many symbolic links encountered
    1521             :         E_NAMETOOLONG the file name is too long
    1522             :         E_NOTDIR a component of the path prefix of path is not a directory
    1523             :         E_IO on I/O errors
    1524             :         E_MULTIHOP multihop attempted
    1525             :         E_NOLINK link has been severed
    1526             :         E_FAULT bad address
    1527             :         E_INTR the function call was interrupted
    1528             : 
    1529             :         @see FileStatus
    1530             :         @see Directory::getNextItem()
    1531             :     */
    1532             : 
    1533     1234496 :     static inline RC get( const ::rtl::OUString& ustrFileURL, DirectoryItem& rItem )
    1534             :     {
    1535     1234496 :         if( rItem._pData)
    1536             :         {
    1537          49 :             osl_releaseDirectoryItem( rItem._pData );
    1538          49 :             rItem._pData = NULL;
    1539             :         }
    1540             : 
    1541     1234496 :         return static_cast< RC >( osl_getDirectoryItem( ustrFileURL.pData, &rItem._pData ) );
    1542             :     }
    1543             : 
    1544             :     /** Retrieve information about a single file or directory.
    1545             : 
    1546             :         @param  rStatus [in|out]
    1547             :         Reference to a class which receives the information of the file or directory
    1548             :         represented by this directory item.
    1549             : 
    1550             :         @return
    1551             :         E_None on success
    1552             :         E_NOMEM not enough memory for allocating structures
    1553             :         E_INVAL the format of the parameters was not valid
    1554             :         E_LOOP too many symbolic links encountered
    1555             :         E_ACCES permission denied
    1556             :         E_NOENT no such file or directory
    1557             :         E_NAMETOOLONG file name too long
    1558             :         E_BADF invalid oslDirectoryItem parameter
    1559             :         E_FAULT bad address
    1560             :         E_OVERFLOW value too large for defined data type
    1561             :         E_INTR function call was interrupted
    1562             :         E_NOLINK link has been severed
    1563             :         E_MULTIHOP components of path require hopping to multiple remote machines and the file system does not allow it
    1564             :         E_MFILE too many open files used by the process
    1565             :         E_NFILE too many open files in the system
    1566             :         E_NOSPC no space left on device
    1567             :         E_NXIO no such device or address
    1568             :         E_IO on I/O errors
    1569             :         E_NOSYS function not implemented
    1570             : 
    1571             :         @see get()
    1572             :         @see Directory::getNextItem()
    1573             :         @see FileStatus
    1574             :     */
    1575             : 
    1576     1062833 :     inline RC getFileStatus( FileStatus& rStatus )
    1577             :     {
    1578     1062833 :         return static_cast< RC >( osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask ) );
    1579             :     }
    1580             : 
    1581             : /** Determine if a directory item point the same underlying file
    1582             : 
    1583             :     The comparison is done first by URL, and then by resolving links to
    1584             :     find the target, and finally by comparing inodes on unix.
    1585             : 
    1586             :     @param[in]  pOther
    1587             :     A directory handle to compare with the underlying object's item
    1588             : 
    1589             :     @return
    1590             :     true: if the items point to an identical resource<br>
    1591             :     false: if the items point to a different resource, or a fatal error occured<br>
    1592             : 
    1593             :     @see osl_getDirectoryItem()
    1594             : 
    1595             :     @since LibreOffice 3.6
    1596             : */
    1597           0 :     inline bool isIdenticalTo( const DirectoryItem &pOther )
    1598             :     {
    1599           0 :         return osl_identicalDirectoryItem( _pData, pOther._pData );
    1600             :     }
    1601             : 
    1602             :     friend class Directory;
    1603             : };
    1604             : 
    1605             : 
    1606             : 
    1607             : /** Base class for observers of directory creation notifications.
    1608             : 
    1609             :     Clients which uses the method createDirectoryPath of the class
    1610             :     Directory may want to be informed about the directories that
    1611             :     have been created. This may be accomplished by deriving from
    1612             :     this base class and overwriting the virtual function
    1613             :     DirectoryCreated.
    1614             : 
    1615             :     @see Directory::createPath
    1616             : */
    1617             : class DirectoryCreationObserver
    1618             : {
    1619             : public:
    1620             :     virtual ~DirectoryCreationObserver() {}
    1621             : 
    1622             :     /** This method will be called when a new directory has been
    1623             :         created and needs to be overwritten by derived classes.
    1624             :         You must not delete the directory that was just created
    1625             :         otherwise you will run into an endless loop.
    1626             : 
    1627             :         @param aDirectoryUrl
    1628             :         [in]The absolute file URL of the directory that was just created by
    1629             :         ::osl::Directory::createPath.
    1630             :     */
    1631             :     virtual void DirectoryCreated(const rtl::OUString& aDirectoryUrl) = 0;
    1632             : };
    1633             : 
    1634             : 
    1635             : // This just an internal helper function for
    1636             : // private use.
    1637           0 : extern "C" inline void SAL_CALL onDirectoryCreated(void* pData, rtl_uString* aDirectoryUrl)
    1638             : {
    1639           0 :     (static_cast<DirectoryCreationObserver*>(pData))->DirectoryCreated(aDirectoryUrl);
    1640           0 : }
    1641             : 
    1642             : /** The directory class object provides a enumeration of DirectoryItems.
    1643             : 
    1644             :     @see DirectoryItem
    1645             :     @see File
    1646             :  */
    1647             : 
    1648             : class Directory: public FileBase
    1649             : {
    1650             :     oslDirectory    _pData;
    1651             :     ::rtl::OUString _aPath;
    1652             : 
    1653             :     /** Copy constructor.
    1654             :     */
    1655             : 
    1656             :     Directory( Directory& );
    1657             : 
    1658             :     /**  Assignment operator.
    1659             :     */
    1660             : 
    1661             :     Directory& operator = ( Directory& );
    1662             : 
    1663             : public:
    1664             : 
    1665             :     /** Constructor.
    1666             : 
    1667             :         @param strPath [in]
    1668             :         The full qualified URL of the directory.
    1669             :         Relative URLs are not allowed.
    1670             :      */
    1671             : 
    1672          76 :     Directory( const ::rtl::OUString& strPath ): _pData( 0 ), _aPath( strPath )
    1673             :     {
    1674          76 :     }
    1675             : 
    1676             :     /** Destructor.
    1677             :     */
    1678             : 
    1679          76 :     ~Directory()
    1680          76 :     {
    1681          76 :         close();
    1682          76 :     }
    1683             : 
    1684             :     /** Obtain the URL.
    1685             : 
    1686             :         @return
    1687             :         the URL with which this Directory instance was created.
    1688             : 
    1689             :         @since LibreOffice 4.1
    1690             :     */
    1691             :     inline rtl::OUString getURL() const { return _aPath; }
    1692             : 
    1693             :     /** Open a directory for enumerating its contents.
    1694             : 
    1695             :         @return
    1696             :         E_None on success
    1697             :         E_INVAL the format of the parameters was not valid
    1698             :         E_NOENT the specified path doesn't exist
    1699             :         E_NOTDIR the specified path is not an directory
    1700             :         E_NOMEM not enough memory for allocating structures
    1701             :         E_ACCES permission denied
    1702             :         E_MFILE too many open files used by the process
    1703             :         E_NFILE too many open files in the system
    1704             :         E_NAMETOOLONG File name too long
    1705             :         E_LOOP Too many symbolic links encountered
    1706             : 
    1707             :         @see getNextItem()
    1708             :         @see close()
    1709             :     */
    1710             : 
    1711          76 :     inline RC open()
    1712             :     {
    1713          76 :         return static_cast< RC >( osl_openDirectory( _aPath.pData, &_pData ) );
    1714             :     }
    1715             : 
    1716             :     /** Query if directory is open.
    1717             : 
    1718             :         Query if directory is open and so item enumeration is valid.
    1719             : 
    1720             :         @return
    1721             :         true if the directory is open else false.
    1722             : 
    1723             :         @see open()
    1724             :         @see close()
    1725             :     */
    1726             : 
    1727           0 :     inline bool isOpen() { return _pData != NULL; }
    1728             : 
    1729             :     /** Close a directory.
    1730             : 
    1731             :          @return
    1732             :         E_None on success
    1733             :         E_INVAL the format of the parameters was not valid
    1734             :         E_NOMEM not enough memory for allocating structures
    1735             :         E_BADF invalid oslDirectory parameter
    1736             :         E_INTR the function call was interrupted
    1737             : 
    1738             :         @see open()
    1739             :     */
    1740             : 
    1741          80 :     inline RC close()
    1742             :     {
    1743          80 :         oslFileError Error = osl_File_E_BADF;
    1744             : 
    1745          80 :         if( _pData )
    1746             :         {
    1747           6 :             Error=osl_closeDirectory( _pData );
    1748           6 :             _pData = NULL;
    1749             :         }
    1750             : 
    1751          80 :         return static_cast< RC >( Error );
    1752             :     }
    1753             : 
    1754             : 
    1755             :     /** Resets the directory item enumeration to the beginning.
    1756             : 
    1757             :         @return
    1758             :         E_None on success
    1759             :         E_INVAL the format of the parameters was not valid
    1760             :         E_NOENT the specified path doesn't exist
    1761             :         E_NOTDIR the specified path is not an directory
    1762             :         E_NOMEM not enough memory for allocating structures
    1763             :         E_ACCES permission denied
    1764             :         E_MFILE too many open files used by the process
    1765             :         E_NFILE too many open files in the system
    1766             :         E_NAMETOOLONG File name too long
    1767             :         E_LOOP Too many symbolic links encountered
    1768             : 
    1769             :         @see open()
    1770             :     */
    1771             : 
    1772           4 :     inline RC reset()
    1773             :     {
    1774           4 :         close();
    1775           4 :         return open();
    1776             :     }
    1777             : 
    1778             :     /** Retrieve the next item of a previously opened directory.
    1779             : 
    1780             :         Retrieves the next item of a previously opened directory.
    1781             : 
    1782             :         @param  rItem [out]
    1783             :         On success a valid DirectoryItem.
    1784             : 
    1785             :         @param  nHint [in]
    1786             :         With this parameter the caller can tell the implementation that (s)he
    1787             :         is going to call this function uHint times afterwards. This enables the implementation to
    1788             :         get the information for more than one file and cache it until the next calls.
    1789             : 
    1790             :         @return
    1791             :         E_None on success
    1792             :         E_INVAL the format of the parameters was not valid
    1793             :         E_NOMEM not enough memory for allocating structures
    1794             :         E_NOENT no more entries in this directory
    1795             :         E_BADF invalid oslDirectory parameter
    1796             :         E_OVERFLOW the value too large for defined data type
    1797             : 
    1798             :         @see DirectoryItem
    1799             :     */
    1800             : 
    1801          33 :     inline RC getNextItem( DirectoryItem& rItem, sal_uInt32 nHint = 0 )
    1802             :     {
    1803          33 :         if( rItem._pData )
    1804             :         {
    1805          22 :             osl_releaseDirectoryItem( rItem._pData );
    1806          22 :             rItem._pData = 0;
    1807             :         }
    1808          33 :         return ( RC) osl_getNextDirectoryItem( _pData, &rItem._pData, nHint );
    1809             :     }
    1810             : 
    1811             : 
    1812             :     /** Retrieve information about a volume.
    1813             : 
    1814             :         Retrieves information about a volume. A volume can either be a mount point, a network
    1815             :         resource or a drive depending on Operating System and File System.
    1816             : 
    1817             :         @param ustrDirectoryURL [in]
    1818             :         Full qualified URL of the volume
    1819             : 
    1820             :         @param rInfo [out]
    1821             :         On success it receives information about the volume.
    1822             : 
    1823             :         @return
    1824             :         E_None on success
    1825             :         E_NOMEM not enough memory for allocating structures
    1826             :         E_INVAL the format of the parameters was not valid
    1827             :         E_NOTDIR not a directory
    1828             :         E_NAMETOOLONG file name too long
    1829             :         E_NOENT no such file or directory
    1830             :         E_ACCES permission denied
    1831             :         E_LOOP too many symbolic links encountered
    1832             :         E_FAULT Bad address
    1833             :         E_IO on I/O errors
    1834             :         E_NOSYS function not implemented
    1835             :         E_MULTIHOP multihop attempted
    1836             :         E_NOLINK link has been severed
    1837             :         E_INTR function call was interrupted
    1838             : 
    1839             :         @see FileStatus
    1840             :         @see VolumeInfo
    1841             :     */
    1842             : 
    1843           0 :     inline static RC getVolumeInfo( const ::rtl::OUString& ustrDirectoryURL, VolumeInfo& rInfo )
    1844             :     {
    1845           0 :         return static_cast< RC >( osl_getVolumeInformation( ustrDirectoryURL.pData, &rInfo._aInfo, rInfo._nMask ) );
    1846             :     }
    1847             : 
    1848             :     /** Create a directory.
    1849             : 
    1850             :         @param ustrDirectoryURL [in]
    1851             :         Full qualified URL of the directory to create.
    1852             : 
    1853             :         @return
    1854             :         E_None on success
    1855             :         E_INVAL the format of the parameters was not valid
    1856             :         E_NOMEM not enough memory for allocating structures
    1857             :         E_EXIST file exists
    1858             :         E_ACCES permission denied
    1859             :         E_NAMETOOLONG file name too long
    1860             :         E_NOENT no such file or directory
    1861             :         E_NOTDIR not a directory
    1862             :         E_ROFS read-only file system
    1863             :         E_NOSPC no space left on device
    1864             :         E_DQUOT quota exceeded
    1865             :         E_LOOP too many symbolic links encountered
    1866             :         E_FAULT bad address
    1867             :         E_IO on I/O errors
    1868             :         E_MLINK too many links
    1869             :         E_MULTIHOP multihop attempted
    1870             :         E_NOLINK link has been severed
    1871             : 
    1872             :         @see remove()
    1873             :     */
    1874             : 
    1875           0 :     inline static RC create( const ::rtl::OUString& ustrDirectoryURL )
    1876             :     {
    1877           0 :         return static_cast< RC >( osl_createDirectory( ustrDirectoryURL.pData ) );
    1878             :     }
    1879             : 
    1880             :     /** Remove an empty directory.
    1881             : 
    1882             :         @param ustrDirectoryURL [in]
    1883             :         Full qualified URL of the directory.
    1884             : 
    1885             :         @return
    1886             :         E_None on success
    1887             :         E_INVAL the format of the parameters was not valid
    1888             :         E_NOMEM not enough memory for allocating structures
    1889             :         E_PERM operation not permitted
    1890             :         E_ACCES permission denied
    1891             :         E_NOENT no such file or directory
    1892             :         E_NOTDIR not a directory
    1893             :         E_NOTEMPTY directory not empty
    1894             :         E_FAULT bad address
    1895             :         E_NAMETOOLONG file name too long
    1896             :         E_BUSY device or resource busy
    1897             :         E_ROFS read-only file system
    1898             :         E_LOOP too many symbolic links encountered
    1899             :         E_BUSY device or resource busy
    1900             :         E_EXIST file exists
    1901             :         E_IO on I/O errors
    1902             :         E_MULTIHOP multihop attempted
    1903             :         E_NOLINK link has been severed
    1904             : 
    1905             :         @see create()
    1906             :     */
    1907             : 
    1908           0 :     inline static RC remove( const ::rtl::OUString& ustrDirectoryURL )
    1909             :     {
    1910           0 :         return static_cast< RC >( osl_removeDirectory( ustrDirectoryURL.pData ) );
    1911             :     }
    1912             : 
    1913             :     /** Create a directory path.
    1914             : 
    1915             :         The osl_createDirectoryPath function creates a specified directory path.
    1916             :         All nonexisting sub directories will be created.
    1917             :         <p><strong>PLEASE NOTE:</strong> You cannot rely on getting the error code
    1918             :         E_EXIST for existing directories. Programming against this error code is
    1919             :         in general a strong indication of a wrong usage of osl_createDirectoryPath.</p>
    1920             : 
    1921             :         @param aDirectoryUrl
    1922             :         [in] The absolute file URL of the directory path to create.
    1923             :         A relative file URL will not be accepted.
    1924             : 
    1925             :         @param aDirectoryCreationObserver
    1926             :         [in] Pointer to an instance of type DirectoryCreationObserver that will
    1927             :         be informed about the creation of a directory. The value of this
    1928             :         parameter may be NULL, in this case notifications will not be sent.
    1929             : 
    1930             :         @return
    1931             :         <dl>
    1932             :         <dt>E_None</dt>
    1933             :         <dd>On success</dd>
    1934             :         <dt>E_INVAL</dt>
    1935             :         <dd>The format of the parameters was not valid</dd>
    1936             :         <dt>E_ACCES</dt>
    1937             :         <dd>Permission denied</dd>
    1938             :         <dt>E_EXIST</dt>
    1939             :         <dd>The final node of the specified directory path already exist</dd>
    1940             :         <dt>E_NAMETOOLONG</dt>
    1941             :         <dd>The name of the specified directory path exceeds the maximum allowed length</dd>
    1942             :         <dt>E_NOTDIR</dt>
    1943             :         <dd>A component of the specified directory path already exist as file in any part of the directory path</dd>
    1944             :         <dt>E_ROFS</dt>
    1945             :         <dd>Read-only file system</dd>
    1946             :         <dt>E_NOSPC</dt>
    1947             :         <dd>No space left on device</dd>
    1948             :         <dt>E_DQUOT</dt>
    1949             :         <dd>Quota exceeded</dd>
    1950             :         <dt>E_FAULT</dt>
    1951             :         <dd>Bad address</dd>
    1952             :         <dt>E_IO</dt>
    1953             :         <dd>I/O error</dd>
    1954             :         <dt>E_LOOP</dt>
    1955             :         <dd>Too many symbolic links encountered</dd>
    1956             :         <dt>E_NOLINK</dt>
    1957             :         <dd>Link has been severed</dd>
    1958             :         <dt>E_invalidError</dt>
    1959             :         <dd>An unknown error occurred</dd>
    1960             :         </dl>
    1961             : 
    1962             :         @see DirectoryCreationObserver
    1963             :         @see create
    1964             :     */
    1965           1 :     static RC createPath(
    1966             :         const ::rtl::OUString& aDirectoryUrl,
    1967             :         DirectoryCreationObserver* aDirectoryCreationObserver = NULL)
    1968             :     {
    1969             :         return static_cast< RC >(osl_createDirectoryPath(
    1970             :             aDirectoryUrl.pData,
    1971             :             (aDirectoryCreationObserver) ? onDirectoryCreated : NULL,
    1972           1 :             aDirectoryCreationObserver));
    1973             :     }
    1974             : };
    1975             : 
    1976             : } /* namespace osl */
    1977             : 
    1978             : #endif // INCLUDED_OSL_FILE_HXX
    1979             : 
    1980             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10