AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
file.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 
4 #ifndef INCLUDED_OSL_FILE_HXX
5 #define INCLUDED_OSL_FILE_HXX
6 
7 #include "sal/config.h"
8 
9 #include <string.h>
10 
11 #include <cstddef>
12 
13 #include "sal/log.hxx"
14 #include "osl/time.h"
15 #include "rtl/ustring.hxx"
16 
17 #include "osl/file.h"
18 #include "osl/diagnose.h"
19 
20 namespace rtl { class ByteSequence; }
21 
22 namespace osl
23 {
24 
25 
33 class FileBase
34 {
35 public:
36 
37  enum RC {
86  };
87 
88 
89 public:
90 
111  static RC getCanonicalName( const ::rtl::OUString& ustrRequestedURL, ::rtl::OUString& ustrValidURL )
112  {
113  return static_cast< RC >( osl_getCanonicalName( ustrRequestedURL.pData, &ustrValidURL.pData ) );
114  }
115 
150  static RC getAbsoluteFileURL( const ::rtl::OUString& ustrBaseDirectoryURL, const ::rtl::OUString& ustrRelativeFileURL, ::rtl::OUString& ustrAbsoluteFileURL )
151  {
152  return static_cast< RC >( osl_getAbsoluteFileURL( ustrBaseDirectoryURL.pData, ustrRelativeFileURL.pData, &ustrAbsoluteFileURL.pData ) );
153  }
154 
169  static RC getSystemPathFromFileURL( const ::rtl::OUString& ustrFileURL, ::rtl::OUString& ustrSystemPath )
170  {
171  return static_cast< RC >( osl_getSystemPathFromFileURL( ustrFileURL.pData, &ustrSystemPath.pData ) );
172  }
173 
188  static RC getFileURLFromSystemPath( const ::rtl::OUString& ustrSystemPath, ::rtl::OUString& ustrFileURL )
189  {
190  return static_cast< RC >( osl_getFileURLFromSystemPath( ustrSystemPath.pData, &ustrFileURL.pData ) );
191  }
192 
220  static RC searchFileURL( const ::rtl::OUString& ustrFileName, const ::rtl::OUString& ustrSearchPath, ::rtl::OUString& ustrFileURL )
221  {
222  return static_cast< RC >( osl_searchFileURL( ustrFileName.pData, ustrSearchPath.pData, &ustrFileURL.pData ) );
223  }
224 
234  static RC getTempDirURL( ::rtl::OUString& ustrTempDirURL )
235  {
236  return static_cast< RC >( osl_getTempDirURL( &ustrTempDirURL.pData ) );
237  }
238 
287  ::rtl::OUString* pustrDirectoryURL,
288  oslFileHandle* pHandle,
289  ::rtl::OUString* pustrTempFileURL)
290  {
291  rtl_uString* pustr_dir_url = pustrDirectoryURL ? pustrDirectoryURL->pData : NULL;
292  rtl_uString** ppustr_tmp_file_url = pustrTempFileURL ? &pustrTempFileURL->pData : NULL;
293 
294  return static_cast< RC >( osl_createTempFile(pustr_dir_url, pHandle, ppustr_tmp_file_url) );
295  }
296 };
297 
298 
304 class VolumeDevice : public FileBase
305 {
306  oslVolumeDeviceHandle _aHandle;
307 
308 public:
309 
313  VolumeDevice() : _aHandle( NULL )
314  {
315  }
316 
323  VolumeDevice( const VolumeDevice & rDevice )
324  {
325  _aHandle = rDevice._aHandle;
326  if ( _aHandle )
327  osl_acquireVolumeDeviceHandle( _aHandle );
328  }
329 
334  {
335  if ( _aHandle )
336  osl_releaseVolumeDeviceHandle( _aHandle );
337  }
338 
345  VolumeDevice & operator =( const VolumeDevice & rDevice )
346  {
347  oslVolumeDeviceHandle newHandle = rDevice._aHandle;
348 
349  if ( newHandle )
350  osl_acquireVolumeDeviceHandle( newHandle );
351 
352  if ( _aHandle )
353  osl_releaseVolumeDeviceHandle( _aHandle );
354 
355  _aHandle = newHandle;
356 
357  return *this;
358  }
359 
366  {
367  rtl::OUString aPath;
368  osl_getVolumeDeviceMountPath( _aHandle, &aPath.pData );
369  return aPath;
370  }
371 
372  friend class VolumeInfo;
373 };
374 
375 
376 class Directory;
377 
387 {
388  oslVolumeInfo _aInfo;
389  sal_uInt32 _nMask;
390  VolumeDevice _aDevice;
391 
396 
400  VolumeInfo& operator = ( VolumeInfo& ) SAL_DELETED_FUNCTION;
401 
402 public:
403 
409  VolumeInfo( sal_uInt32 nMask )
410  : _nMask( nMask )
411  {
412  memset( &_aInfo, 0, sizeof( oslVolumeInfo ));
413  _aInfo.uStructSize = sizeof( oslVolumeInfo );
414  _aInfo.pDeviceHandle = &_aDevice._aHandle;
415  }
416 
418  {
419  if( _aInfo.ustrFileSystemName )
421  }
422 
430  bool isValid( sal_uInt32 nMask ) const
431  {
432  return ( nMask & _aInfo.uValidFields ) == nMask;
433  }
434 
440  bool getRemoteFlag() const
441  {
442  return (_aInfo.uAttributes & osl_Volume_Attribute_Remote) != 0;
443  }
444 
450  bool getRemoveableFlag() const
451  {
452  return (_aInfo.uAttributes & osl_Volume_Attribute_Removeable) != 0;
453  }
454 
461  bool getCompactDiscFlag() const
462  {
463  return (_aInfo.uAttributes & osl_Volume_Attribute_CompactDisc) != 0;
464  }
465 
472  bool getFloppyDiskFlag() const
473  {
474  return (_aInfo.uAttributes & osl_Volume_Attribute_FloppyDisk) != 0;
475  }
476 
483  bool getFixedDiskFlag() const
484  {
485  return (_aInfo.uAttributes & osl_Volume_Attribute_FixedDisk) != 0;
486  }
487 
494  bool getRAMDiskFlag() const
495  {
496  return (_aInfo.uAttributes & osl_Volume_Attribute_RAMDisk) != 0;
497  }
498 
506  sal_uInt64 getTotalSpace() const
507  {
508  return _aInfo.uTotalSpace;
509  }
510 
518  sal_uInt64 getFreeSpace() const
519  {
520  return _aInfo.uFreeSpace;
521  }
522 
530  sal_uInt64 getUsedSpace() const
531  {
532  return _aInfo.uUsedSpace;
533  }
534 
542  sal_uInt32 getMaxNameLength() const
543  {
544  return _aInfo.uMaxNameLength;
545  }
546 
554  sal_uInt32 getMaxPathLength() const
555  {
556  return _aInfo.uMaxPathLength;
557  }
558 
567  {
569  }
570 
571 
580  {
581  return _aDevice;
582  }
583 
591  {
592  return (_aInfo.uAttributes & osl_Volume_Attribute_Case_Sensitive) != 0;
593  }
594 
603  {
605  }
606 
607  friend class Directory;
608 };
609 
610 
611 class DirectoryItem;
612 
619 {
620  oslFileStatus _aStatus;
621  sal_uInt32 _nMask;
622 
627 
631  FileStatus& operator = ( FileStatus& ) SAL_DELETED_FUNCTION;
632 
633 public:
634 
635  enum Type {
644  };
645 
651  FileStatus(sal_uInt32 nMask)
652  : _nMask(nMask)
653  {
654  memset(&_aStatus, 0, sizeof(_aStatus));
655  _aStatus.uStructSize = sizeof(_aStatus);
656  }
657 
661  {
662  if ( _aStatus.ustrFileURL )
663  rtl_uString_release( _aStatus.ustrFileURL );
664  if ( _aStatus.ustrLinkTargetURL )
666  if ( _aStatus.ustrFileName )
667  rtl_uString_release( _aStatus.ustrFileName );
668  }
669 
679  bool isValid( sal_uInt32 nMask ) const
680  {
681  return ( nMask & _aStatus.uValidFields ) == nMask;
682  }
683 
690  {
691  SAL_INFO_IF(
692  !isValid(osl_FileStatus_Mask_Type), "sal.osl",
693  "no FileStatus Type determined");
695  ? static_cast< Type >(_aStatus.eType) : Unknown;
696  }
697 
707  bool isDirectory() const
708  {
709  return ( getFileType() == Directory || getFileType() == Volume );
710  }
711 
722  bool isRegular() const
723  {
724  return ( getFileType() == Regular );
725  }
726 
735  bool isLink() const
736  {
737  return ( getFileType() == Link );
738  }
739 
746  sal_uInt64 getAttributes() const
747  {
748  SAL_INFO_IF(
750  "no FileStatus Attributes determined");
751  return _aStatus.uAttributes;
752  }
753 
762  {
763  SAL_INFO_IF(
765  "no FileStatus CreationTime determined");
766  return _aStatus.aCreationTime;
767  }
768 
777  {
778  SAL_INFO_IF(
780  "no FileStatus AccessTime determined");
781  return _aStatus.aAccessTime;
782  }
783 
792  {
793  SAL_INFO_IF(
795  "no FileStatus ModifyTime determined");
796  return _aStatus.aModifyTime;
797  }
798 
805  sal_uInt64 getFileSize() const
806  {
807  SAL_INFO_IF(
809  "no FileStatus FileSize determined");
810  return _aStatus.uFileSize;
811  }
812 
820  {
821  SAL_INFO_IF(
823  "no FileStatus FileName determined");
825  ? rtl::OUString(_aStatus.ustrFileName) : rtl::OUString();
826  }
827 
828 
837  {
838  SAL_INFO_IF(
840  "no FileStatus FileURL determined");
842  ? rtl::OUString(_aStatus.ustrFileURL) : rtl::OUString();
843  }
844 
853  {
854  SAL_INFO_IF(
856  "no FileStatus LinkTargetURL determined");
859  }
860 
861  friend class DirectoryItem;
862 };
863 
864 
871 class File: public FileBase
872 {
873  oslFileHandle _pData;
874  ::rtl::OUString _aPath;
875 
880 
884  File& operator = ( File& ) SAL_DELETED_FUNCTION;
885 
886 public:
887 
894  File( const ::rtl::OUString& ustrFileURL ): _pData( NULL ), _aPath( ustrFileURL ) {}
895 
900  {
901  close();
902  }
903 
911  rtl::OUString getURL() const { return _aPath; }
912 
955  RC open( sal_uInt32 uFlags )
956  {
957  return static_cast< RC >( osl_openFile( _aPath.pData, &_pData, uFlags ) );
958  }
959 
974  {
976 
977  if( _pData )
978  {
979  Error=osl_closeFile( _pData );
980  _pData = NULL;
981  }
982 
983  return static_cast< RC >( Error );
984  }
985 
1002  SAL_WARN_UNUSED_RESULT RC setPos( sal_uInt32 uHow, sal_Int64 uPos )
1003  {
1004  return static_cast< RC >( osl_setFilePos( _pData, uHow, uPos ) );
1005  }
1006 
1022  RC getPos( sal_uInt64& uPos )
1023  {
1024  return static_cast< RC >( osl_getFilePos( _pData, &uPos ) );
1025  }
1026 
1049  {
1050  return static_cast< RC >( osl_isEndOfFile( _pData, pIsEOF ) );
1051  }
1052 
1070  RC setSize( sal_uInt64 uSize )
1071  {
1072  return static_cast< RC >( osl_setFileSize( _pData, uSize ) );
1073  }
1074 
1094  RC getSize( sal_uInt64 &rSize )
1095  {
1096  return static_cast< RC >( osl_getFileSize( _pData, &rSize ) );
1097  }
1098 
1130  RC read( void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64& rBytesRead )
1131  {
1132  return static_cast< RC >( osl_readFile( _pData, pBuffer, uBytesRequested, &rBytesRead ) );
1133  }
1134 
1168  RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten)
1169  {
1170  return static_cast< RC >( osl_writeFile( _pData, pBuffer, uBytesToWrite, &rBytesWritten ) );
1171  }
1172 
1173 
1198  {
1199  return static_cast< RC >( osl_readLine( _pData, reinterpret_cast<sal_Sequence**>(&aSeq) ) );
1200  }
1201 
1221  RC sync() const
1222  {
1223  OSL_PRECOND(_pData, "File::sync(): File not open");
1224  return static_cast< RC >(osl_syncFile(_pData));
1225  }
1226 
1252  static RC copy( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
1253  {
1254  return static_cast< RC >( osl_copyFile( ustrSourceFileURL.pData, ustrDestFileURL.pData ) );
1255  }
1256 
1280  static RC move( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
1281  {
1282  return static_cast< RC >( osl_moveFile( ustrSourceFileURL.pData, ustrDestFileURL.pData ) );
1283  }
1284 
1312  static RC replace(const ::rtl::OUString& ustrSourceFileURL,
1313  const ::rtl::OUString& ustrDestFileURL)
1314  {
1315  return static_cast<RC>(osl_replaceFile(ustrSourceFileURL.pData, ustrDestFileURL.pData));
1316  }
1317 
1344  static RC remove( const ::rtl::OUString& ustrFileURL )
1345  {
1346  return static_cast< RC >( osl_removeFile( ustrFileURL.pData ) );
1347  }
1348 
1364  static RC setAttributes( const ::rtl::OUString& ustrFileURL, sal_uInt64 uAttributes )
1365  {
1366  return static_cast< RC >( osl_setFileAttributes( ustrFileURL.pData, uAttributes ) );
1367  }
1368 
1390  static RC setTime(
1391  const ::rtl::OUString& ustrFileURL,
1392  const TimeValue& rCreationTime,
1393  const TimeValue& rLastAccessTime,
1394  const TimeValue& rLastWriteTime )
1395  {
1396  return static_cast< RC >( osl_setFileTime(
1397  ustrFileURL.pData,
1398  &rCreationTime,
1399  &rLastAccessTime,
1400  &rLastWriteTime ) );
1401  }
1402 
1403  friend class DirectoryItem;
1404 };
1405 
1406 
1413 {
1414  oslDirectoryItem _pData;
1415 
1416 public:
1417 
1421  DirectoryItem(): _pData( NULL )
1422  {
1423  }
1424 
1428  DirectoryItem( const DirectoryItem& rItem ): _pData( rItem._pData)
1429  {
1430  if( _pData )
1431  osl_acquireDirectoryItem( _pData );
1432  }
1433 
1438  {
1439  if( _pData )
1440  osl_releaseDirectoryItem( _pData );
1441  }
1442 
1447  {
1448  if (&rItem != this)
1449  {
1450  if( _pData )
1451  osl_releaseDirectoryItem( _pData );
1452 
1453  _pData = rItem._pData;
1454 
1455  if( _pData )
1456  osl_acquireDirectoryItem( _pData );
1457  }
1458  return *this;
1459  }
1460 
1467  bool is()
1468  {
1469  return _pData != NULL;
1470  }
1471 
1505  static RC get( const ::rtl::OUString& ustrFileURL, DirectoryItem& rItem )
1506  {
1507  if( rItem._pData)
1508  {
1509  osl_releaseDirectoryItem( rItem._pData );
1510  rItem._pData = NULL;
1511  }
1512 
1513  return static_cast< RC >( osl_getDirectoryItem( ustrFileURL.pData, &rItem._pData ) );
1514  }
1515 
1548  {
1549  return static_cast< RC >( osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask ) );
1550  }
1551 
1567  bool isIdenticalTo( const DirectoryItem &pOther )
1568  {
1569  return osl_identicalDirectoryItem( _pData, pOther._pData );
1570  }
1571 
1572  friend class Directory;
1573 };
1574 
1575 
1587 {
1588 public:
1590 
1600  virtual void DirectoryCreated(const rtl::OUString& aDirectoryUrl) = 0;
1601 };
1602 
1603 
1604 // This just an internal helper function for
1605 // private use.
1606 extern "C" inline void SAL_CALL onDirectoryCreated(void* pData, rtl_uString* aDirectoryUrl)
1607 {
1608  static_cast<DirectoryCreationObserver*>(pData)->DirectoryCreated(aDirectoryUrl);
1609 }
1610 
1617 class Directory: public FileBase
1618 {
1619  oslDirectory _pData;
1620  ::rtl::OUString _aPath;
1621 
1626 
1630  Directory& operator = ( Directory& ) SAL_DELETED_FUNCTION;
1631 
1632 public:
1633 
1641  Directory( const ::rtl::OUString& strPath ): _pData( NULL ), _aPath( strPath )
1642  {
1643  }
1644 
1649  {
1650  close();
1651  }
1652 
1660  rtl::OUString getURL() const { return _aPath; }
1661 
1680  {
1681  return static_cast< RC >( osl_openDirectory( _aPath.pData, &_pData ) );
1682  }
1683 
1694  bool isOpen() { return _pData != NULL; }
1695 
1708  {
1709  oslFileError Error = osl_File_E_BADF;
1710 
1711  if( _pData )
1712  {
1713  Error=osl_closeDirectory( _pData );
1714  _pData = NULL;
1715  }
1716 
1717  return static_cast< RC >( Error );
1718  }
1719 
1720 
1738  {
1739  close();
1740  return open();
1741  }
1742 
1765  RC getNextItem( DirectoryItem& rItem, sal_uInt32 nHint = 0 )
1766  {
1767  if( rItem._pData )
1768  {
1769  osl_releaseDirectoryItem( rItem._pData );
1770  rItem._pData = NULL;
1771  }
1772  return static_cast<RC>(osl_getNextDirectoryItem( _pData, &rItem._pData, nHint ));
1773  }
1774 
1775 
1806  static RC getVolumeInfo( const ::rtl::OUString& ustrDirectoryURL, VolumeInfo& rInfo )
1807  {
1808  return static_cast< RC >( osl_getVolumeInformation( ustrDirectoryURL.pData, &rInfo._aInfo, rInfo._nMask ) );
1809  }
1810 
1841  static RC create(
1842  const ::rtl::OUString& ustrDirectoryURL,
1843  sal_uInt32 flags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write )
1844  {
1845  return static_cast< RC >(
1846  osl_createDirectoryWithFlags( ustrDirectoryURL.pData, flags ) );
1847  }
1848 
1875  static RC remove( const ::rtl::OUString& ustrDirectoryURL )
1876  {
1877  return static_cast< RC >( osl_removeDirectory( ustrDirectoryURL.pData ) );
1878  }
1879 
1916  static RC createPath(
1917  const ::rtl::OUString& aDirectoryUrl,
1918  DirectoryCreationObserver* aDirectoryCreationObserver = NULL)
1919  {
1920  return static_cast< RC >(osl_createDirectoryPath(
1921  aDirectoryUrl.pData,
1922  aDirectoryCreationObserver ? onDirectoryCreated : NULL,
1923  aDirectoryCreationObserver));
1924  }
1925 };
1926 
1927 } /* namespace osl */
1928 
1929 #endif // INCLUDED_OSL_FILE_HXX
1930 
1931 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt64 uFreeSpace
Free space on the volume for the current process/user.
Definition: file.h:557
RC getNextItem(DirectoryItem &rItem, sal_uInt32 nHint=0)
Retrieve the next item of a previously opened directory.
Definition: file.hxx:1765
SAL_DLLPUBLIC oslFileError osl_openDirectory(rtl_uString *pustrDirectoryURL, oslDirectory *pDirectory)
Open a directory for enumerating its contents.
sal_uInt32 uValidFields
Determines which members of the structure contain valid data.
Definition: file.h:549
Definition: file.h:315
Definition: file.h:105
::rtl::OUString getLinkTargetURL() const
Get the link target URL.
Definition: file.hxx:852
wrong device type specified
Definition: file.hxx:56
::rtl::OUString getFileName() const
Get the file name.
Definition: file.hxx:819
Definition: file.h:82
inappropriate I/O control operation
Definition: file.hxx:62
resource temp unavailable, try again later
Definition: file.hxx:49
SAL_DLLPUBLIC oslFileError osl_acquireVolumeDeviceHandle(oslVolumeDeviceHandle Handle)
Acquire a volume device handle.
sal_uInt32 getMaxPathLength() const
Determine the maximal length of a path name.
Definition: file.hxx:554
Definition: file.h:98
SAL_DLLPUBLIC oslFileError osl_readLine(oslFileHandle Handle, sal_Sequence **ppSequence)
Read a line from a file.
Definition: file.h:90
Definition: file.h:84
Definition: file.h:107
~FileStatus()
Destructor.
Definition: file.hxx:660
Definition: file.h:111
filename too long
Definition: file.hxx:72
Definition: file.h:70
sal_uInt32 uMaxPathLength
Maximum length of a full qualified path in system notation.
Definition: file.h:561
there are no child processes
Definition: file.hxx:48
sal_uInt32 uMaxNameLength
Maximum length of file name of a single item.
Definition: file.h:559
static RC move(const ::rtl::OUString &ustrSourceFileURL, const ::rtl::OUString &ustrDestFileURL)
Move a file or directory to a new destination or renames it.
Definition: file.hxx:1280
Time since Jan-01-1970.
Definition: time.h:56
value too large for defined data type
Definition: file.hxx:81
device not ready
Definition: file.hxx:82
sal_uInt32 uStructSize
Must be initialized with the size in bytes of the structure before passing it to any function...
Definition: file.h:547
bad address; an invalid pointer detected
Definition: file.hxx:52
sal_uInt64 getTotalSpace() const
Determine the total space of a volume device.
Definition: file.hxx:506
bool getFixedDiskFlag() const
Check the fixed disk flag.
Definition: file.hxx:483
SAL_DLLPUBLIC oslFileError osl_openFile(rtl_uString *pustrFileURL, oslFileHandle *pHandle, sal_uInt32 uFlags)
Open a regular file.
SAL_DLLPUBLIC oslFileError osl_getTempDirURL(rtl_uString **pustrTempDirURL)
Retrieves the file URL of the system&#39;s temporary directory path.
Definition: file.h:102
Definition: file.h:71
unsigned char sal_Bool
Definition: types.h:18
bool isLink() const
Is it a link?
Definition: file.hxx:735
SAL_DLLPUBLIC oslFileError osl_getFilePos(oslFileHandle Handle, sal_uInt64 *pPos)
Retrieve the current position of the internal pointer of an open file.
SAL_DLLPUBLIC oslFileError osl_getVolumeInformation(rtl_uString *pustrDirectoryURL, oslVolumeInfo *pInfo, sal_uInt32 uFieldMask)
Retrieve information about a volume.
SAL_DLLPUBLIC oslFileError osl_getCanonicalName(rtl_uString *pustrRequestedURL, rtl_uString **ppustrValidURL)
Determine a valid unused canonical name for a requested name.
SAL_DLLPUBLIC oslFileError osl_getNextDirectoryItem(oslDirectory Directory, oslDirectoryItem *pItem, sal_uInt32 uHint)
Retrieve the next item of a previously opened directory.
Definition: file.h:312
TimeValue getModifyTime() const
Get the file modification time.
Definition: file.hxx:791
Definition: file.h:311
The VolumeDevice class.
Definition: file.hxx:304
struct _oslVolumeInfo oslVolumeInfo
Structure containing information about volumes.
sal_uInt32 uStructSize
Must be initialized with the size in bytes of the structure before passing it to any function...
Definition: file.h:364
sal_uInt64 uFileSize
Size in bytes of the file.
Definition: file.h:380
#define osl_FileStatus_Mask_FileSize
Definition: file.h:349
SAL_DLLPUBLIC oslFileError osl_setFileTime(rtl_uString *pustrFileURL, const TimeValue *aCreationTime, const TimeValue *aLastAccessTime, const TimeValue *aLastWriteTime)
Set the file time.
~Directory()
Destructor.
Definition: file.hxx:1648
RC open()
Open a directory for enumerating its contents.
Definition: file.hxx:1679
The directory item class object provides access to file status information.
Definition: file.hxx:1412
I/O error occurred.
Definition: file.hxx:43
no process matches the PID
Definition: file.hxx:41
Definition: file.hxx:639
function not implemented
Definition: file.hxx:74
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:182
Definition: file.h:94
Definition: file.h:92
static RC setTime(const ::rtl::OUString &ustrFileURL, const TimeValue &rCreationTime, const TimeValue &rLastAccessTime, const TimeValue &rLastWriteTime)
Set the file time.
Definition: file.hxx:1390
Definition: file.h:85
improper link across file systems detected
Definition: file.hxx:55
SAL_DLLPUBLIC oslFileError osl_closeFile(oslFileHandle Handle)
Close an open file.
Definition: file.h:113
void * oslFileHandle
Definition: file.h:610
rtl::OUString getMountPath()
Get the full qualified URL where a device is mounted to.
Definition: file.hxx:365
#define osl_FileStatus_Mask_Attributes
Definition: file.h:345
rtl_uString * ustrFileSystemName
Points to a string that receives the name of the file system type.
Definition: file.h:565
Definition: file.h:99
#define OSL_PRECOND(c, m)
Check the precondition of functions.
Definition: diagnose.h:92
bool getRAMDiskFlag() const
Check the RAM disk flag.
Definition: file.hxx:494
#define osl_Volume_Attribute_CompactDisc
Definition: file.h:510
bool isCaseSensitiveFileSystem() const
Return whether the file system is case sensitive or case insensitive.
Definition: file.hxx:590
Definition: file.h:108
no such file or directory
Definition: file.hxx:40
bool isValid(sal_uInt32 nMask) const
Check if specified fields are valid.
Definition: file.hxx:679
SAL_DLLPUBLIC oslFileError osl_getVolumeDeviceMountPath(oslVolumeDeviceHandle Handle, rtl_uString **ppustrDirectoryURL)
Get the full qualified URL where a device is mounted to.
RC getFileStatus(FileStatus &rStatus)
Retrieve information about a single file or directory.
Definition: file.hxx:1547
unmapped error: always last entry in enum!
Definition: file.hxx:83
~VolumeDevice()
Destructor.
Definition: file.hxx:333
argument list too long
Definition: file.hxx:45
bool is()
Check for validity of this instance.
Definition: file.hxx:1467
Definition: file.h:116
SAL_DLLPUBLIC oslFileError osl_syncFile(oslFileHandle Handle)
Synchronize the memory representation of a file with that on the physical medium. ...
RC sync() const
Synchronize the memory representation of a file with that on the physical medium. ...
Definition: file.hxx:1221
Definition: file.h:110
SAL_DLLPUBLIC oslFileError osl_readFile(oslFileHandle Handle, void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 *pBytesRead)
Read a number of bytes from a file.
Definition: file.h:112
Definition: file.hxx:638
SAL_DLLPUBLIC oslFileError osl_getAbsoluteFileURL(rtl_uString *pustrBaseDirectoryURL, rtl_uString *pustrRelativeFileURL, rtl_uString **ppustrAbsoluteFileURL)
Convert a path relative to a given directory into an full qualified file URL.
sal_uInt32 uAttributes
Attributes of the volume (remote and/or removable)
Definition: file.h:551
Definition: file.h:101
on success
Definition: file.hxx:38
oslVolumeDeviceHandle * pDeviceHandle
Pointer to handle the receives underlying device.
Definition: file.h:568
Definition: file.h:80
Definition: file.hxx:643
rtl::OUString getURL() const
Obtain the URL.
Definition: file.hxx:1660
SAL_DLLPUBLIC oslFileError osl_createTempFile(rtl_uString *pustrDirectoryURL, oslFileHandle *pHandle, rtl_uString **ppustrTempFileURL)
Creates a temporary file in the directory provided by the caller or the directory returned by osl_get...
SAL_DLLPUBLIC void rtl_uString_release(rtl_uString *str) SAL_THROW_EXTERN_C() SAL_HOT
Decrement the reference count of a string.
Definition: file.h:75
The FileStatus class.
Definition: file.hxx:618
static RC create(const ::rtl::OUString &ustrDirectoryURL, sal_uInt32 flags=osl_File_OpenFlag_Read|osl_File_OpenFlag_Write)
Create a directory.
Definition: file.hxx:1841
invalid argument to library function
Definition: file.hxx:59
#define SAL_INFO_IF(condition, area, stream)
Produce log entry from stream in the given log area if condition is true.
Definition: log.hxx:353
#define osl_Volume_Attribute_FixedDisk
Definition: file.h:511
Definition: file.hxx:85
illegal modification to read-only filesystem
Definition: file.hxx:66
Base class for observers of directory creation notifications.
Definition: file.hxx:1586
#define osl_FileStatus_Mask_AccessTime
Definition: file.h:347
SAL_DLLPUBLIC oslFileError osl_getFileSize(oslFileHandle Handle, sal_uInt64 *pSize)
Get the file size of an open file.
Directory(const ::rtl::OUString &strPath)
Constructor.
Definition: file.hxx:1641
bool getRemoveableFlag() const
Check the removable flag.
Definition: file.hxx:450
process has too many distinct files open
Definition: file.hxx:61
SAL_DLLPUBLIC sal_Bool osl_identicalDirectoryItem(oslDirectoryItem pItemA, oslDirectoryItem pItemB)
Determine if two directory items point the same underlying file.
DirectoryItem & operator=(const DirectoryItem &rItem)
Assignment operator.
Definition: file.hxx:1446
no locks available
Definition: file.hxx:73
resource busy
Definition: file.hxx:53
Definition: file.h:91
SAL_DLLPUBLIC oslFileError osl_releaseDirectoryItem(oslDirectoryItem Item)
Decrease the refcount of a directory item handle.
rtl_uString * ustrFileURL
Full URL of the file.
Definition: file.h:386
bool isIdenticalTo(const DirectoryItem &pOther)
Determine if a directory item point the same underlying file.
Definition: file.hxx:1567
virtual void DirectoryCreated(const rtl::OUString &aDirectoryUrl)=0
This method will be called when a new directory has been created and needs to be overwritten by deriv...
TimeValue aAccessTime
Last access time in nanoseconds since 1/1/1970.
Definition: file.h:376
Definition: file.h:72
broken pipe; no process reading from other end of pipe
Definition: file.hxx:68
SAL_DLLPUBLIC oslFileError osl_setFileAttributes(rtl_uString *pustrFileURL, sal_uInt64 uAttributes)
Set file attributes.
Definition: file.h:81
Definition: file.h:86
rtl::OUString getURL() const
Obtain the URL.
Definition: file.hxx:911
Definition: file.h:104
pData
Definition: ustring.hxx:334
socket operation timed out
Definition: file.hxx:84
file too large
Definition: file.hxx:63
Type
Definition: file.hxx:635
void * oslDirectory
Definition: file.h:123
invalid executable file format
Definition: file.hxx:46
too many links to file
Definition: file.hxx:67
bool isRegular() const
Is it a regular file?
Definition: file.hxx:722
#define osl_Volume_Attribute_FloppyDisk
Definition: file.h:513
#define osl_File_OpenFlag_Read
Definition: file.h:614
Definition: file.h:79
~File()
Destructor.
Definition: file.hxx:899
VolumeDevice(const VolumeDevice &rDevice)
Copy constructor.
Definition: file.hxx:323
invalid seek operation (such as on pipe)
Definition: file.hxx:65
DirectoryItem()
Constructor.
Definition: file.hxx:1421
File(const ::rtl::OUString &ustrFileURL)
Constructor.
Definition: file.hxx:894
static RC getCanonicalName(const ::rtl::OUString &ustrRequestedURL,::rtl::OUString &ustrValidURL)
Determine a valid unused canonical name for a requested name.
Definition: file.hxx:111
Definition: file.h:93
RC read(void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 &rBytesRead)
Read a number of bytes from a file.
Definition: file.hxx:1130
Definition: file.h:76
RC
Definition: file.hxx:37
sal_uInt32 uValidFields
Determines which members of the structure contain valid data.
Definition: file.h:366
file is a directory, invalid operation
Definition: file.hxx:58
rtl_uString * ustrLinkTargetURL
Full URL of the target file if the file itself is a link.
Definition: file.h:390
#define osl_Volume_Attribute_Remote
Definition: file.h:509
SAL_DLLPUBLIC oslFileError osl_removeDirectory(rtl_uString *pustrDirectoryURL)
Remove an empty directory.
#define osl_Volume_Attribute_Removeable
Definition: file.h:508
bool isOpen()
Query if directory is open.
Definition: file.hxx:1694
SAL_DLLPUBLIC oslFileError osl_writeFile(oslFileHandle Handle, const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 *pBytesWritten)
Write a number of bytes to a file.
RC reset()
Resets the directory item enumeration to the beginning.
Definition: file.hxx:1737
#define osl_Volume_Attribute_Case_Is_Preserved
Definition: file.h:515
range error (mathematical error)
Definition: file.hxx:70
SAL_DLLPUBLIC oslFileError osl_getSystemPathFromFileURL(rtl_uString *pustrFileURL, rtl_uString **ppustrSystemPath)
Convert a file URL into a system dependent path.
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:264
bool getRemoteFlag() const
Check the remote flag.
Definition: file.hxx:440
remote resource is not directly available
Definition: file.hxx:79
sal_uInt64 uAttributes
File attributes.
Definition: file.h:370
void * oslDirectoryItem
Definition: file.h:124
sal_uInt64 getFileSize() const
Get the size of the file.
Definition: file.hxx:805
bool isCasePreservingFileSystem() const
Return whether the file system preserves the case of file and directory names or not.
Definition: file.hxx:602
#define osl_FileStatus_Mask_ModifyTime
Definition: file.h:348
SAL_DLLPUBLIC oslFileError osl_getDirectoryItem(rtl_uString *pustrFileURL, oslDirectoryItem *pItem)
Retrieve a single directory item.
static RC setAttributes(const ::rtl::OUString &ustrFileURL, sal_uInt64 uAttributes)
Set file attributes.
Definition: file.hxx:1364
bool isValid(sal_uInt32 nMask) const
Check if specified fields are valid.
Definition: file.hxx:430
Definition: file.h:78
SAL_DLLPUBLIC oslFileError osl_copyFile(rtl_uString *pustrSourceFileURL, rtl_uString *pustrDestFileURL)
Copy a file to a new destination.
no such device or address
Definition: file.hxx:44
bool getFloppyDiskFlag() const
Check the floppy disc flag.
Definition: file.hxx:472
sal_uInt64 uUsedSpace
Used space on the volume for the current process/user.
Definition: file.h:555
oslFileType eType
The type of the file (file, directory, volume).
Definition: file.h:368
bad file descriptor
Definition: file.hxx:47
#define osl_Volume_Attribute_Case_Sensitive
Definition: file.h:516
Definition: file.h:74
static RC createPath(const ::rtl::OUString &aDirectoryUrl, DirectoryCreationObserver *aDirectoryCreationObserver=NULL)
Create a directory path.
Definition: file.hxx:1916
TimeValue getCreationTime() const
Get the creation time of this file.
Definition: file.hxx:761
too many distinct file openings
Definition: file.hxx:60
static RC replace(const ::rtl::OUString &ustrSourceFileURL, const ::rtl::OUString &ustrDestFileURL)
Move a file to a new destination or rename it, taking old file&#39;s identity (if exists).
Definition: file.hxx:1312
SAL_DLLPUBLIC oslFileError osl_searchFileURL(rtl_uString *pustrFileName, rtl_uString *pustrSearchPath, rtl_uString **ppustrFileURL)
Search a full qualified system path or a file URL.
#define osl_FileStatus_Mask_FileName
Definition: file.h:350
SAL_DLLPUBLIC oslFileError osl_createDirectoryWithFlags(rtl_uString *url, sal_uInt32 flags)
Create a directory, passing flags.
no memory available
Definition: file.hxx:50
deadlock avoided
Definition: file.hxx:71
file quote system is confused as there are too many users
Definition: file.hxx:80
#define osl_FileStatus_Mask_LinkTargetURL
Definition: file.h:352
#define osl_FileStatus_Mask_FileURL
Definition: file.h:351
void onDirectoryCreated(void *pData, rtl_uString *aDirectoryUrl)
Definition: file.hxx:1606
RC close()
Close a directory.
Definition: file.hxx:1707
SAL_WARN_UNUSED_RESULT RC setPos(sal_uInt32 uHow, sal_Int64 uPos)
Set the internal position pointer of an open file.
Definition: file.hxx:1002
TimeValue aModifyTime
Last modify time in nanoseconds since 1/1/1970.
Definition: file.h:378
SAL_DLLPUBLIC oslFileError osl_setFileSize(oslFileHandle Handle, sal_uInt64 uSize)
Set the file size of an open file.
operation not permitted
Definition: file.hxx:39
RC isEndOfFile(sal_Bool *pIsEOF)
Test if the end of a file is reached.
Definition: file.hxx:1048
Definition: file.h:114
RC open(sal_uInt32 uFlags)
Open a regular file.
Definition: file.hxx:955
sal_uInt64 getFreeSpace() const
Determine the free space of a volume device.
Definition: file.hxx:518
oslFileError
Definition: file.h:69
function call was interrupted
Definition: file.hxx:42
SAL_DLLPUBLIC oslFileError osl_moveFile(rtl_uString *pustrSourceFileURL, rtl_uString *pustrDestFileURL)
Move a file or directory to a new destination or renames it.
#define osl_FileStatus_Mask_Type
Definition: file.h:344
Definition: file.h:109
static RC getFileURLFromSystemPath(const ::rtl::OUString &ustrSystemPath,::rtl::OUString &ustrFileURL)
Convert a system dependent path into a file URL.
Definition: file.hxx:188
sal_uInt32 getMaxNameLength() const
Determine the maximal length of a file name.
Definition: file.hxx:542
no space left on device, write failed
Definition: file.hxx:64
Base class for all File System specific objects.
Definition: file.hxx:33
Definition: file.hxx:641
C++ class representing a SAL byte sequence.
Definition: byteseq.h:149
VolumeDevice & operator=(const VolumeDevice &rDevice)
Assignment operator.
Definition: file.hxx:345
RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 &rBytesWritten)
Write a number of bytes to a file.
Definition: file.hxx:1168
file permissions do not allow operation
Definition: file.hxx:51
SAL_DLLPUBLIC oslFileError osl_getFileStatus(oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask)
Retrieve information about a single file or directory.
virtual ~DirectoryCreationObserver()
Definition: file.hxx:1589
sal_uInt64 getAttributes() const
Get the file attributes.
Definition: file.hxx:746
::rtl::OUString getFileURL() const
Get the URL of the file.
Definition: file.hxx:836
Definition: file.h:97
SAL_DLLPUBLIC oslFileError osl_closeDirectory(oslDirectory Directory)
Release a directory handle.
The directory class object provides an enumeration of DirectoryItems.
Definition: file.hxx:1617
Definition: file.h:316
Type getFileType() const
Get the file type.
Definition: file.hxx:689
invalid or incomplete byte sequence of multibyte char found
Definition: file.hxx:77
Definition: file.h:73
SAL_DLLPUBLIC oslFileError osl_replaceFile(rtl_uString *pustrSourceFileURL, rtl_uString *pustrDestFileURL)
Move a file to a new destination or rename it, taking old file&#39;s identity (if exists).
Definition: file.h:100
Definition: file.h:87
Definition: file.h:95
Definition: file.h:103
Structure containing information about volumes.
Definition: file.h:544
Provides simple diagnostic support.
Definition: file.h:117
Definition: file.h:313
Definition: file.h:83
::rtl::OUString getFileSystemName() const
Determine the name of the volume device&#39;s File System.
Definition: file.hxx:566
Definition: file.h:88
#define osl_FileStatus_Mask_CreationTime
Definition: file.h:346
static RC getVolumeInfo(const ::rtl::OUString &ustrDirectoryURL, VolumeInfo &rInfo)
Retrieve information about a volume.
Definition: file.hxx:1806
directory not empty
Definition: file.hxx:75
VolumeDevice()
Constructor.
Definition: file.hxx:313
Definition: file.h:106
Definition: file.h:77
Definition: file.h:310
~VolumeInfo()
Definition: file.hxx:417
VolumeDevice getDeviceHandle() const
Get the volume device handle.
Definition: file.hxx:579
too many levels of symbolic links found during name lookup
Definition: file.hxx:76
VolumeInfo(sal_uInt32 nMask)
Constructor.
Definition: file.hxx:409
SAL_WARN_UNUSED_RESULT SAL_DLLPUBLIC oslFileError osl_setFilePos(oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uPos)
Set the internal position pointer of an open file.
RC close()
Close an open file.
Definition: file.hxx:973
TimeValue aCreationTime
First creation time in nanoseconds since 1/1/1970.
Definition: file.h:373
RC setSize(sal_uInt64 uSize)
Set the file size of an open file.
Definition: file.hxx:1070
SAL_DLLPUBLIC oslFileError osl_getFileURLFromSystemPath(rtl_uString *pustrSystemPath, rtl_uString **ppustrFileURL)
Convert a system dependent path into a file URL.
SAL_DLLPUBLIC oslFileError osl_createDirectoryPath(rtl_uString *aDirectoryUrl, oslDirectoryCreationCallbackFunc aDirectoryCreationCallbackFunc, void *pData)
Create a directory path.
#define osl_File_OpenFlag_Write
Definition: file.h:615
RC getSize(sal_uInt64 &rSize)
Get the file size of an open file.
Definition: file.hxx:1094
SAL_DLLPUBLIC oslFileError osl_acquireDirectoryItem(oslDirectoryItem Item)
Increase the refcount of a directory item handle.
Definition: file.h:96
link has been severed
Definition: file.hxx:78
file exists where should only be created
Definition: file.hxx:54
RC readLine(::rtl::ByteSequence &aSeq)
Read a line from a file.
Definition: file.hxx:1197
rtl_uString * ustrFileName
Case correct name of the file.
Definition: file.h:383
SAL_DLLPUBLIC oslFileError osl_releaseVolumeDeviceHandle(oslVolumeDeviceHandle Handle)
Release a volume device handle.
Definition: file.hxx:642
RC getPos(sal_uInt64 &uPos)
Retrieve the current position of the internal pointer of an open file.
Definition: file.hxx:1022
static RC copy(const ::rtl::OUString &ustrSourceFileURL, const ::rtl::OUString &ustrDestFileURL)
Copy a file to a new destination.
Definition: file.hxx:1252
static RC createTempFile(::rtl::OUString *pustrDirectoryURL, oslFileHandle *pHandle,::rtl::OUString *pustrTempFileURL)
Creates a temporary file in the directory provided by the caller or the directory returned by getTemp...
Definition: file.hxx:286
#define osl_Volume_Attribute_RAMDisk
Definition: file.h:512
Definition: file.hxx:637
Definition: socket_decl.hxx:177
~DirectoryItem()
Destructor.
Definition: file.hxx:1437
SAL_DLLPUBLIC oslFileError osl_removeFile(rtl_uString *pustrFileURL)
Remove a regular file.
sal_uInt64 uTotalSpace
Total available space on the volume for the current process/user.
Definition: file.h:553
file isn&#39;t a directory where one is needed
Definition: file.hxx:57
The VolumeInfo class.
Definition: file.hxx:386
bool isDirectory() const
Is it a directory? This method returns True for both directories, and volumes.
Definition: file.hxx:707
domain error (mathematical error)
Definition: file.hxx:69
Definition: file.h:115
The file class object provides access to file contents and attributes.
Definition: file.hxx:871
bool getCompactDiscFlag() const
Check the compact disc flag.
Definition: file.hxx:461
FileStatus(sal_uInt32 nMask)
Constructor.
Definition: file.hxx:651
static RC getSystemPathFromFileURL(const ::rtl::OUString &ustrFileURL,::rtl::OUString &ustrSystemPath)
Convert a file URL into a system dependent path.
Definition: file.hxx:169
Definition: file.h:89
Definition: file.h:309
DirectoryItem(const DirectoryItem &rItem)
Copy constructor.
Definition: file.hxx:1428
static RC getAbsoluteFileURL(const ::rtl::OUString &ustrBaseDirectoryURL, const ::rtl::OUString &ustrRelativeFileURL,::rtl::OUString &ustrAbsoluteFileURL)
Convert a path relative to a given directory into an full qualified file URL.
Definition: file.hxx:150
void * oslVolumeDeviceHandle
Definition: file.h:434
Definition: file.h:314
sal_uInt64 getUsedSpace() const
Determine the used space of a volume device.
Definition: file.hxx:530
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:358
SAL_DLLPUBLIC oslFileError osl_isEndOfFile(oslFileHandle Handle, sal_Bool *pIsEOF)
Test if the end of a file is reached.
Structure containing information about files and directories.
Definition: file.h:362
static RC getTempDirURL(::rtl::OUString &ustrTempDirURL)
Retrieves the file URL of the system&#39;s temporary directory path.
Definition: file.hxx:234
TimeValue getAccessTime() const
Get the file access time.
Definition: file.hxx:776
Main goals and usage hints.
static RC searchFileURL(const ::rtl::OUString &ustrFileName, const ::rtl::OUString &ustrSearchPath,::rtl::OUString &ustrFileURL)
Search a full qualified system path or a file URL.
Definition: file.hxx:220