UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 #ifndef _OSL_FILE_H_ 00030 #define _OSL_FILE_H_ 00031 00032 #include <osl/time.h> 00033 # include <rtl/ustring.h> 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00090 /* Error codes according to errno */ 00091 00092 typedef enum { 00093 osl_File_E_None, 00094 osl_File_E_PERM, 00095 osl_File_E_NOENT, 00096 osl_File_E_SRCH, 00097 osl_File_E_INTR, 00098 osl_File_E_IO, 00099 osl_File_E_NXIO, 00100 osl_File_E_2BIG, 00101 osl_File_E_NOEXEC, 00102 osl_File_E_BADF, 00103 osl_File_E_CHILD, 00104 osl_File_E_AGAIN, 00105 osl_File_E_NOMEM, 00106 osl_File_E_ACCES, 00107 osl_File_E_FAULT, 00108 osl_File_E_BUSY, 00109 osl_File_E_EXIST, 00110 osl_File_E_XDEV, 00111 osl_File_E_NODEV, 00112 osl_File_E_NOTDIR, 00113 osl_File_E_ISDIR, 00114 osl_File_E_INVAL, 00115 osl_File_E_NFILE, 00116 osl_File_E_MFILE, 00117 osl_File_E_NOTTY, 00118 osl_File_E_FBIG, 00119 osl_File_E_NOSPC, 00120 osl_File_E_SPIPE, 00121 osl_File_E_ROFS, 00122 osl_File_E_MLINK, 00123 osl_File_E_PIPE, 00124 osl_File_E_DOM, 00125 osl_File_E_RANGE, 00126 osl_File_E_DEADLK, 00127 osl_File_E_NAMETOOLONG, 00128 osl_File_E_NOLCK, 00129 osl_File_E_NOSYS, 00130 osl_File_E_NOTEMPTY, 00131 osl_File_E_LOOP, 00132 osl_File_E_ILSEQ, 00133 osl_File_E_NOLINK, 00134 osl_File_E_MULTIHOP, 00135 osl_File_E_USERS, 00136 osl_File_E_OVERFLOW, 00137 osl_File_E_NOTREADY, 00138 osl_File_E_invalidError, /* unmapped error: always last entry in enum! */ 00139 osl_File_E_TIMEDOUT, 00140 osl_File_E_NETWORK, 00141 osl_File_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 00142 } oslFileError; 00143 00144 typedef void *oslDirectory; 00145 typedef void *oslDirectoryItem; 00146 00147 00173 SAL_DLLPUBLIC oslFileError SAL_CALL osl_openDirectory( 00174 rtl_uString *pustrDirectoryURL, oslDirectory *pDirectory); 00175 00176 00208 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getNextDirectoryItem( 00209 oslDirectory Directory, 00210 oslDirectoryItem *pItem, 00211 sal_uInt32 uHint 00212 ); 00213 00214 00230 SAL_DLLPUBLIC oslFileError SAL_CALL osl_closeDirectory( 00231 oslDirectory Directory); 00232 00233 00270 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getDirectoryItem( 00271 rtl_uString *pustrFileURL, 00272 oslDirectoryItem *pItem 00273 ); 00274 00275 00293 SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireDirectoryItem( 00294 oslDirectoryItem Item ); 00295 00296 00316 SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseDirectoryItem( 00317 oslDirectoryItem Item ); 00318 00339 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_identicalDirectoryItem( 00340 oslDirectoryItem pItemA, 00341 oslDirectoryItem pItemB ); 00342 00343 /* File types */ 00344 00345 typedef enum { 00346 osl_File_Type_Directory, 00347 osl_File_Type_Volume, 00348 osl_File_Type_Regular, 00349 osl_File_Type_Fifo, 00350 osl_File_Type_Socket, 00351 osl_File_Type_Link, 00352 osl_File_Type_Special, 00353 osl_File_Type_Unknown 00354 } oslFileType; 00355 00356 /* File attributes */ 00357 #define osl_File_Attribute_ReadOnly 0x00000001 00358 #define osl_File_Attribute_Hidden 0x00000002 00359 #define osl_File_Attribute_Executable 0x00000010 00360 #define osl_File_Attribute_GrpWrite 0x00000020 00361 #define osl_File_Attribute_GrpRead 0x00000040 00362 #define osl_File_Attribute_GrpExe 0x00000080 00363 #define osl_File_Attribute_OwnWrite 0x00000100 00364 #define osl_File_Attribute_OwnRead 0x00000200 00365 #define osl_File_Attribute_OwnExe 0x00000400 00366 #define osl_File_Attribute_OthWrite 0x00000800 00367 #define osl_File_Attribute_OthRead 0x00001000 00368 #define osl_File_Attribute_OthExe 0x00002000 00369 00370 /* Flags specifying which fields to retreive by osl_getFileStatus */ 00371 00372 #define osl_FileStatus_Mask_Type 0x00000001 00373 #define osl_FileStatus_Mask_Attributes 0x00000002 00374 #define osl_FileStatus_Mask_CreationTime 0x00000010 00375 #define osl_FileStatus_Mask_AccessTime 0x00000020 00376 #define osl_FileStatus_Mask_ModifyTime 0x00000040 00377 #define osl_FileStatus_Mask_FileSize 0x00000080 00378 #define osl_FileStatus_Mask_FileName 0x00000100 00379 #define osl_FileStatus_Mask_FileURL 0x00000200 00380 #define osl_FileStatus_Mask_LinkTargetURL 0x00000400 00381 #define osl_FileStatus_Mask_All 0x7FFFFFFF 00382 #define osl_FileStatus_Mask_Validate 0x80000000 00383 00384 00385 typedef 00386 00393 struct _oslFileStatus { 00395 sal_uInt32 uStructSize; 00397 sal_uInt32 uValidFields; 00399 oslFileType eType; 00401 sal_uInt64 uAttributes; 00404 TimeValue aCreationTime; 00407 TimeValue aAccessTime; 00409 TimeValue aModifyTime; 00411 sal_uInt64 uFileSize; 00414 rtl_uString *ustrFileName; 00417 rtl_uString *ustrFileURL; 00421 rtl_uString *ustrLinkTargetURL; 00422 } oslFileStatus; 00423 00424 00464 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileStatus( 00465 oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask ); 00466 00467 00468 typedef void *oslVolumeDeviceHandle; 00469 00488 SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseVolumeDeviceHandle( 00489 oslVolumeDeviceHandle Handle ); 00490 00509 SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( 00510 oslVolumeDeviceHandle Handle ); 00511 00512 00539 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getVolumeDeviceMountPath( 00540 oslVolumeDeviceHandle Handle, rtl_uString **ppustrDirectoryURL); 00541 00542 /* Volume attributes */ 00543 00544 #define osl_Volume_Attribute_Removeable 0x00000001L 00545 #define osl_Volume_Attribute_Remote 0x00000002L 00546 #define osl_Volume_Attribute_CompactDisc 0x00000004L 00547 #define osl_Volume_Attribute_FixedDisk 0x00000008L 00548 #define osl_Volume_Attribute_RAMDisk 0x00000010L 00549 #define osl_Volume_Attribute_FloppyDisk 0x00000020L 00550 00551 #define osl_Volume_Attribute_Case_Is_Preserved 0x00000040L 00552 #define osl_Volume_Attribute_Case_Sensitive 0x00000080L 00553 00554 /* Flags specifying which fields to retreive by osl_getVolumeInfo */ 00555 00556 #define osl_VolumeInfo_Mask_Attributes 0x00000001L 00557 #define osl_VolumeInfo_Mask_TotalSpace 0x00000002L 00558 #define osl_VolumeInfo_Mask_UsedSpace 0x00000004L 00559 #define osl_VolumeInfo_Mask_FreeSpace 0x00000008L 00560 #define osl_VolumeInfo_Mask_MaxNameLength 0x00000010L 00561 #define osl_VolumeInfo_Mask_MaxPathLength 0x00000020L 00562 #define osl_VolumeInfo_Mask_FileSystemName 0x00000040L 00563 #define osl_VolumeInfo_Mask_DeviceHandle 0x00000080L 00564 #define osl_VolumeInfo_Mask_FileSystemCaseHandling 0x00000100L 00565 00566 typedef 00567 00574 struct _oslVolumeInfo { 00576 sal_uInt32 uStructSize; 00578 sal_uInt32 uValidFields; 00580 sal_uInt32 uAttributes; 00582 sal_uInt64 uTotalSpace; 00584 sal_uInt64 uUsedSpace; 00586 sal_uInt64 uFreeSpace; 00588 sal_uInt32 uMaxNameLength; 00590 sal_uInt32 uMaxPathLength; 00593 rtl_uString *ustrFileSystemName; 00595 oslVolumeDeviceHandle *pDeviceHandle; 00596 } oslVolumeInfo; 00597 00598 00635 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getVolumeInformation( 00636 rtl_uString *pustrDirectoryURL, 00637 oslVolumeInfo *pInfo, 00638 sal_uInt32 uFieldMask ); 00639 00640 typedef void *oslFileHandle; 00641 00642 /* Open flags */ 00643 00644 #define osl_File_OpenFlag_Read 0x00000001L 00645 #define osl_File_OpenFlag_Write 0x00000002L 00646 #define osl_File_OpenFlag_Create 0x00000004L 00647 #define osl_File_OpenFlag_NoLock 0x00000008L 00648 /* larger bit-fields reserved for internal use cf. detail/file.h */ 00649 00705 SAL_DLLPUBLIC oslFileError SAL_CALL osl_openFile( 00706 rtl_uString *pustrFileURL, oslFileHandle *pHandle, sal_uInt32 uFlags ); 00707 00708 #define osl_Pos_Absolut 1 00709 #define osl_Pos_Current 2 00710 #define osl_Pos_End 3 00711 00732 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFilePos( 00733 oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uPos ) SAL_WARN_UNUSED_RESULT; 00734 00735 00755 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFilePos( 00756 oslFileHandle Handle, sal_uInt64 *pPos ); 00757 00758 00781 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileSize( 00782 oslFileHandle Handle, sal_uInt64 uSize ); 00783 00784 00806 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileSize( 00807 oslFileHandle Handle, sal_uInt64 *pSize ); 00808 00809 00814 #define osl_File_MapFlag_RandomAccess ((sal_uInt32)(0x1)) 00815 00822 #define osl_File_MapFlag_WillNeed ((sal_uInt32)(0x2)) 00823 00837 SAL_DLLPUBLIC oslFileError SAL_CALL osl_mapFile ( 00838 oslFileHandle Handle, 00839 void** ppAddr, 00840 sal_uInt64 uLength, 00841 sal_uInt64 uOffset, 00842 sal_uInt32 uFlags 00843 ); 00844 00845 00846 #ifndef ANDROID 00847 00861 SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapFile ( 00862 void* pAddr, 00863 sal_uInt64 uLength 00864 ); 00865 00866 #endif 00867 00879 SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapMappedFile ( 00880 oslFileHandle Handle, 00881 void* pAddr, 00882 sal_uInt64 uLength 00883 ); 00884 00885 00921 SAL_DLLPUBLIC oslFileError SAL_CALL osl_readFile( 00922 oslFileHandle Handle, void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 *pBytesRead ); 00923 00924 00950 SAL_DLLPUBLIC oslFileError SAL_CALL osl_isEndOfFile( 00951 oslFileHandle Handle, sal_Bool *pIsEOF ); 00952 00953 00991 SAL_DLLPUBLIC oslFileError SAL_CALL osl_writeFile( 00992 oslFileHandle Handle, const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 *pBytesWritten ); 00993 01000 SAL_DLLPUBLIC oslFileError SAL_CALL osl_readFileAt( 01001 oslFileHandle Handle, 01002 sal_uInt64 uOffset, 01003 void* pBuffer, 01004 sal_uInt64 uBytesRequested, 01005 sal_uInt64* pBytesRead 01006 ); 01007 01008 01015 SAL_DLLPUBLIC oslFileError SAL_CALL osl_writeFileAt( 01016 oslFileHandle Handle, 01017 sal_uInt64 uOffset, 01018 const void* pBuffer, 01019 sal_uInt64 uBytesToWrite, 01020 sal_uInt64* pBytesWritten 01021 ); 01022 01023 01051 SAL_DLLPUBLIC oslFileError SAL_CALL osl_readLine( 01052 oslFileHandle Handle, sal_Sequence** ppSequence ); 01053 01088 SAL_DLLPUBLIC oslFileError SAL_CALL osl_syncFile( oslFileHandle Handle ); 01089 01107 SAL_DLLPUBLIC oslFileError SAL_CALL osl_closeFile( oslFileHandle Handle ); 01108 01109 01137 SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectory( rtl_uString* pustrDirectoryURL ); 01138 01139 01168 SAL_DLLPUBLIC oslFileError SAL_CALL osl_removeDirectory( rtl_uString* pustrDirectoryURL ); 01169 01185 typedef void (SAL_CALL *oslDirectoryCreationCallbackFunc)(void* pData, rtl_uString* aDirectoryUrl); 01186 01246 SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectoryPath( 01247 rtl_uString* aDirectoryUrl, 01248 oslDirectoryCreationCallbackFunc aDirectoryCreationCallbackFunc, 01249 void* pData); 01250 01279 SAL_DLLPUBLIC oslFileError SAL_CALL osl_removeFile( 01280 rtl_uString* pustrFileURL ); 01281 01282 01309 SAL_DLLPUBLIC oslFileError SAL_CALL osl_copyFile( 01310 rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL ); 01311 01312 01337 SAL_DLLPUBLIC oslFileError SAL_CALL osl_moveFile( 01338 rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL ); 01339 01340 01362 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getCanonicalName( 01363 rtl_uString *pustrRequestedURL, rtl_uString **ppustrValidURL); 01364 01365 01401 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getAbsoluteFileURL( 01402 rtl_uString* pustrBaseDirectoryURL, 01403 rtl_uString *pustrRelativeFileURL, 01404 rtl_uString **ppustrAbsoluteFileURL ); 01405 01406 01422 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileURLFromSystemPath( 01423 rtl_uString *pustrSystemPath, rtl_uString **ppustrFileURL); 01424 01425 01454 SAL_DLLPUBLIC oslFileError SAL_CALL osl_searchFileURL( 01455 rtl_uString *pustrFileName, rtl_uString *pustrSearchPath, rtl_uString **ppustrFileURL ); 01456 01457 01473 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getSystemPathFromFileURL( 01474 rtl_uString *pustrFileURL, rtl_uString **ppustrSystemPath); 01475 01476 01489 typedef sal_uInt32 (SAL_CALL *oslCalcTextWidthFunc)( rtl_uString *ustrText ); 01490 01491 01513 SAL_DLLPUBLIC oslFileError SAL_CALL osl_abbreviateSystemPath( 01514 rtl_uString *ustrSystemPath, 01515 rtl_uString **pustrCompacted, 01516 sal_uInt32 uMaxWidth, 01517 oslCalcTextWidthFunc pCalcWidth ); 01518 01519 01535 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileAttributes( 01536 rtl_uString *pustrFileURL, sal_uInt64 uAttributes ); 01537 01538 01561 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileTime( 01562 rtl_uString *pustrFileURL, 01563 const TimeValue *aCreationTime, 01564 const TimeValue *aLastAccessTime, 01565 const TimeValue *aLastWriteTime); 01566 01567 01578 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getTempDirURL( 01579 rtl_uString **pustrTempDirURL ); 01580 01581 01633 SAL_DLLPUBLIC oslFileError SAL_CALL osl_createTempFile( 01634 rtl_uString* pustrDirectoryURL, 01635 oslFileHandle* pHandle, 01636 rtl_uString** ppustrTempFileURL); 01637 01638 #ifdef __cplusplus 01639 } 01640 #endif 01641 01642 #endif /* _OSL_FILE_H_ */ 01643 01644 01645 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */