UDK 3.2.7 C/C++ API Reference

osl/file.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*
00003  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 
00020 #ifndef _OSL_FILE_H_
00021 #define _OSL_FILE_H_
00022 
00023 #include "sal/config.h"
00024 
00025 #include "osl/time.h"
00026 #include "rtl/ustring.h"
00027 #include "sal/saldllapi.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00084 /* Error codes according to errno */
00085 
00086 typedef enum {
00087     osl_File_E_None,
00088     osl_File_E_PERM,
00089     osl_File_E_NOENT,
00090     osl_File_E_SRCH,
00091     osl_File_E_INTR,
00092     osl_File_E_IO,
00093     osl_File_E_NXIO,
00094     osl_File_E_2BIG,
00095     osl_File_E_NOEXEC,
00096     osl_File_E_BADF,
00097     osl_File_E_CHILD,
00098     osl_File_E_AGAIN,
00099     osl_File_E_NOMEM,
00100     osl_File_E_ACCES,
00101     osl_File_E_FAULT,
00102     osl_File_E_BUSY,
00103     osl_File_E_EXIST,
00104     osl_File_E_XDEV,
00105     osl_File_E_NODEV,
00106     osl_File_E_NOTDIR,
00107     osl_File_E_ISDIR,
00108     osl_File_E_INVAL,
00109     osl_File_E_NFILE,
00110     osl_File_E_MFILE,
00111     osl_File_E_NOTTY,
00112     osl_File_E_FBIG,
00113     osl_File_E_NOSPC,
00114     osl_File_E_SPIPE,
00115     osl_File_E_ROFS,
00116     osl_File_E_MLINK,
00117     osl_File_E_PIPE,
00118     osl_File_E_DOM,
00119     osl_File_E_RANGE,
00120     osl_File_E_DEADLK,
00121     osl_File_E_NAMETOOLONG,
00122     osl_File_E_NOLCK,
00123     osl_File_E_NOSYS,
00124     osl_File_E_NOTEMPTY,
00125     osl_File_E_LOOP,
00126     osl_File_E_ILSEQ,
00127     osl_File_E_NOLINK,
00128     osl_File_E_MULTIHOP,
00129     osl_File_E_USERS,
00130     osl_File_E_OVERFLOW,
00131     osl_File_E_NOTREADY,
00132     osl_File_E_invalidError,        /* unmapped error: always last entry in enum! */
00133     osl_File_E_TIMEDOUT,
00134     osl_File_E_NETWORK,
00135     osl_File_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00136 } oslFileError;
00137 
00138 typedef void *oslDirectory;
00139 typedef void *oslDirectoryItem;
00140 
00141 
00167 SAL_DLLPUBLIC oslFileError SAL_CALL osl_openDirectory(
00168         rtl_uString *pustrDirectoryURL, oslDirectory *pDirectory);
00169 
00170 
00202 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getNextDirectoryItem(
00203     oslDirectory Directory,
00204     oslDirectoryItem *pItem,
00205     sal_uInt32   uHint
00206     );
00207 
00208 
00224 SAL_DLLPUBLIC oslFileError SAL_CALL osl_closeDirectory(
00225         oslDirectory Directory);
00226 
00227 
00264 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getDirectoryItem(
00265     rtl_uString *pustrFileURL,
00266     oslDirectoryItem *pItem
00267     );
00268 
00269 
00287 SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireDirectoryItem(
00288         oslDirectoryItem Item );
00289 
00290 
00310 SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseDirectoryItem(
00311         oslDirectoryItem Item );
00312 
00333 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_identicalDirectoryItem(
00334                                         oslDirectoryItem pItemA,
00335                                         oslDirectoryItem pItemB );
00336 
00337 /* File types */
00338 
00339 typedef enum {
00340     osl_File_Type_Directory,
00341     osl_File_Type_Volume,
00342     osl_File_Type_Regular,
00343     osl_File_Type_Fifo,
00344     osl_File_Type_Socket,
00345     osl_File_Type_Link,
00346     osl_File_Type_Special,
00347     osl_File_Type_Unknown
00348 } oslFileType;
00349 
00350 /* File attributes */
00351 #define osl_File_Attribute_ReadOnly             0x00000001
00352 #define osl_File_Attribute_Hidden               0x00000002
00353 #define osl_File_Attribute_Executable           0x00000010
00354 #define osl_File_Attribute_GrpWrite             0x00000020
00355 #define osl_File_Attribute_GrpRead              0x00000040
00356 #define osl_File_Attribute_GrpExe               0x00000080
00357 #define osl_File_Attribute_OwnWrite             0x00000100
00358 #define osl_File_Attribute_OwnRead              0x00000200
00359 #define osl_File_Attribute_OwnExe               0x00000400
00360 #define osl_File_Attribute_OthWrite             0x00000800
00361 #define osl_File_Attribute_OthRead              0x00001000
00362 #define osl_File_Attribute_OthExe               0x00002000
00363 
00364 /* Flags specifying which fields to retreive by osl_getFileStatus */
00365 
00366 #define osl_FileStatus_Mask_Type                0x00000001
00367 #define osl_FileStatus_Mask_Attributes          0x00000002
00368 #define osl_FileStatus_Mask_CreationTime        0x00000010
00369 #define osl_FileStatus_Mask_AccessTime          0x00000020
00370 #define osl_FileStatus_Mask_ModifyTime          0x00000040
00371 #define osl_FileStatus_Mask_FileSize            0x00000080
00372 #define osl_FileStatus_Mask_FileName            0x00000100
00373 #define osl_FileStatus_Mask_FileURL             0x00000200
00374 #define osl_FileStatus_Mask_LinkTargetURL       0x00000400
00375 #define osl_FileStatus_Mask_All                 0x7FFFFFFF
00376 #define osl_FileStatus_Mask_Validate            0x80000000
00377 
00378 
00379 typedef
00380 
00387 struct _oslFileStatus {
00389     sal_uInt32      uStructSize;
00391     sal_uInt32      uValidFields;
00393     oslFileType eType;
00395     sal_uInt64  uAttributes;
00398     TimeValue   aCreationTime;
00401     TimeValue   aAccessTime;
00403     TimeValue   aModifyTime;
00405     sal_uInt64  uFileSize;
00408     rtl_uString *ustrFileName;
00411     rtl_uString *ustrFileURL;
00415     rtl_uString *ustrLinkTargetURL;
00416 } oslFileStatus;
00417 
00418 
00458 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileStatus(
00459         oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask );
00460 
00461 
00462 typedef void *oslVolumeDeviceHandle;
00463 
00482 SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseVolumeDeviceHandle(
00483         oslVolumeDeviceHandle Handle );
00484 
00503 SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireVolumeDeviceHandle(
00504         oslVolumeDeviceHandle Handle );
00505 
00506 
00533 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getVolumeDeviceMountPath(
00534         oslVolumeDeviceHandle Handle, rtl_uString **ppustrDirectoryURL);
00535 
00536 /* Volume attributes */
00537 
00538 #define osl_Volume_Attribute_Removeable            0x00000001L
00539 #define osl_Volume_Attribute_Remote                0x00000002L
00540 #define osl_Volume_Attribute_CompactDisc           0x00000004L
00541 #define osl_Volume_Attribute_FixedDisk             0x00000008L
00542 #define osl_Volume_Attribute_RAMDisk               0x00000010L
00543 #define osl_Volume_Attribute_FloppyDisk            0x00000020L
00544 
00545 #define osl_Volume_Attribute_Case_Is_Preserved     0x00000040L
00546 #define osl_Volume_Attribute_Case_Sensitive        0x00000080L
00547 
00548 /* Flags specifying which fields to retreive by osl_getVolumeInfo */
00549 
00550 #define osl_VolumeInfo_Mask_Attributes             0x00000001L
00551 #define osl_VolumeInfo_Mask_TotalSpace             0x00000002L
00552 #define osl_VolumeInfo_Mask_UsedSpace              0x00000004L
00553 #define osl_VolumeInfo_Mask_FreeSpace              0x00000008L
00554 #define osl_VolumeInfo_Mask_MaxNameLength          0x00000010L
00555 #define osl_VolumeInfo_Mask_MaxPathLength          0x00000020L
00556 #define osl_VolumeInfo_Mask_FileSystemName         0x00000040L
00557 #define osl_VolumeInfo_Mask_DeviceHandle           0x00000080L
00558 #define osl_VolumeInfo_Mask_FileSystemCaseHandling 0x00000100L
00559 
00560 typedef
00561 
00568 struct _oslVolumeInfo {
00570     sal_uInt32      uStructSize;
00572     sal_uInt32      uValidFields;
00574     sal_uInt32      uAttributes;
00576     sal_uInt64      uTotalSpace;
00578     sal_uInt64      uUsedSpace;
00580     sal_uInt64      uFreeSpace;
00582     sal_uInt32      uMaxNameLength;
00584     sal_uInt32      uMaxPathLength;
00587     rtl_uString     *ustrFileSystemName;
00589     oslVolumeDeviceHandle   *pDeviceHandle;
00590 } oslVolumeInfo;
00591 
00592 
00629 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getVolumeInformation(
00630     rtl_uString *pustrDirectoryURL,
00631     oslVolumeInfo *pInfo,
00632     sal_uInt32 uFieldMask );
00633 
00634 typedef void *oslFileHandle;
00635 
00636 /* Open flags */
00637 
00638 #define osl_File_OpenFlag_Read      0x00000001L
00639 #define osl_File_OpenFlag_Write     0x00000002L
00640 #define osl_File_OpenFlag_Create    0x00000004L
00641 #define osl_File_OpenFlag_NoLock    0x00000008L
00642 /* larger bit-fields reserved for internal use cf. detail/file.h */
00643 
00699 SAL_DLLPUBLIC oslFileError SAL_CALL osl_openFile(
00700         rtl_uString *pustrFileURL, oslFileHandle *pHandle, sal_uInt32 uFlags );
00701 
00702 #define osl_Pos_Absolut 1
00703 #define osl_Pos_Current 2
00704 #define osl_Pos_End     3
00705 
00726 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFilePos(
00727         oslFileHandle Handle, sal_uInt32 uHow, sal_Int64 uPos ) SAL_WARN_UNUSED_RESULT;
00728 
00729 
00749 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFilePos(
00750         oslFileHandle Handle, sal_uInt64 *pPos );
00751 
00752 
00775 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileSize(
00776         oslFileHandle Handle, sal_uInt64 uSize );
00777 
00778 
00800 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileSize(
00801         oslFileHandle Handle, sal_uInt64 *pSize );
00802 
00803 
00808 #define osl_File_MapFlag_RandomAccess ((sal_uInt32)(0x1))
00809 
00816 #define osl_File_MapFlag_WillNeed ((sal_uInt32)(0x2))
00817 
00831 SAL_DLLPUBLIC oslFileError SAL_CALL osl_mapFile (
00832   oslFileHandle Handle,
00833   void**        ppAddr,
00834   sal_uInt64    uLength,
00835   sal_uInt64    uOffset,
00836   sal_uInt32    uFlags
00837 );
00838 
00839 
00840 #ifndef ANDROID
00841 
00855 SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapFile (
00856   void*      pAddr,
00857   sal_uInt64 uLength
00858 );
00859 
00860 #endif
00861 
00873 SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapMappedFile (
00874   oslFileHandle Handle,
00875   void*      pAddr,
00876   sal_uInt64 uLength
00877 );
00878 
00879 
00915 SAL_DLLPUBLIC oslFileError SAL_CALL osl_readFile(
00916         oslFileHandle Handle, void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 *pBytesRead );
00917 
00918 
00944 SAL_DLLPUBLIC oslFileError SAL_CALL osl_isEndOfFile(
00945         oslFileHandle Handle, sal_Bool *pIsEOF );
00946 
00947 
00985 SAL_DLLPUBLIC oslFileError SAL_CALL osl_writeFile(
00986         oslFileHandle Handle, const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 *pBytesWritten );
00987 
00994 SAL_DLLPUBLIC oslFileError SAL_CALL osl_readFileAt(
00995   oslFileHandle Handle,
00996   sal_uInt64    uOffset,
00997   void*         pBuffer,
00998   sal_uInt64    uBytesRequested,
00999   sal_uInt64*   pBytesRead
01000 );
01001 
01002 
01009 SAL_DLLPUBLIC oslFileError SAL_CALL osl_writeFileAt(
01010   oslFileHandle Handle,
01011   sal_uInt64    uOffset,
01012   const void*   pBuffer,
01013   sal_uInt64    uBytesToWrite,
01014   sal_uInt64*   pBytesWritten
01015 );
01016 
01017 
01045 SAL_DLLPUBLIC oslFileError SAL_CALL osl_readLine(
01046         oslFileHandle Handle, sal_Sequence** ppSequence );
01047 
01082 SAL_DLLPUBLIC oslFileError SAL_CALL osl_syncFile( oslFileHandle Handle );
01083 
01101 SAL_DLLPUBLIC oslFileError SAL_CALL osl_closeFile( oslFileHandle Handle );
01102 
01103 
01131 SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectory( rtl_uString* pustrDirectoryURL );
01132 
01133 
01162 SAL_DLLPUBLIC oslFileError SAL_CALL osl_removeDirectory( rtl_uString* pustrDirectoryURL );
01163 
01179 typedef void (SAL_CALL *oslDirectoryCreationCallbackFunc)(void* pData, rtl_uString* aDirectoryUrl);
01180 
01240 SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectoryPath(
01241     rtl_uString* aDirectoryUrl,
01242     oslDirectoryCreationCallbackFunc aDirectoryCreationCallbackFunc,
01243     void* pData);
01244 
01273 SAL_DLLPUBLIC oslFileError SAL_CALL osl_removeFile(
01274         rtl_uString* pustrFileURL );
01275 
01276 
01303 SAL_DLLPUBLIC oslFileError SAL_CALL osl_copyFile(
01304         rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL );
01305 
01306 
01331 SAL_DLLPUBLIC oslFileError SAL_CALL osl_moveFile(
01332         rtl_uString* pustrSourceFileURL, rtl_uString *pustrDestFileURL );
01333 
01334 
01356 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getCanonicalName(
01357         rtl_uString *pustrRequestedURL, rtl_uString **ppustrValidURL);
01358 
01359 
01395 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getAbsoluteFileURL(
01396     rtl_uString* pustrBaseDirectoryURL,
01397     rtl_uString *pustrRelativeFileURL,
01398     rtl_uString **ppustrAbsoluteFileURL );
01399 
01400 
01416 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileURLFromSystemPath(
01417         rtl_uString *pustrSystemPath, rtl_uString **ppustrFileURL);
01418 
01419 
01448 SAL_DLLPUBLIC oslFileError SAL_CALL osl_searchFileURL(
01449         rtl_uString *pustrFileName, rtl_uString *pustrSearchPath, rtl_uString **ppustrFileURL );
01450 
01451 
01467 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getSystemPathFromFileURL(
01468         rtl_uString *pustrFileURL, rtl_uString **ppustrSystemPath);
01469 
01470 
01483 typedef sal_uInt32 (SAL_CALL *oslCalcTextWidthFunc)( rtl_uString *ustrText );
01484 
01485 
01507 SAL_DLLPUBLIC oslFileError SAL_CALL osl_abbreviateSystemPath(
01508     rtl_uString *ustrSystemPath,
01509     rtl_uString **pustrCompacted,
01510     sal_uInt32 uMaxWidth,
01511     oslCalcTextWidthFunc pCalcWidth );
01512 
01513 
01529 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileAttributes(
01530         rtl_uString *pustrFileURL, sal_uInt64 uAttributes );
01531 
01532 
01555 SAL_DLLPUBLIC oslFileError SAL_CALL osl_setFileTime(
01556     rtl_uString *pustrFileURL,
01557     const TimeValue *aCreationTime,
01558     const TimeValue *aLastAccessTime,
01559     const TimeValue *aLastWriteTime);
01560 
01561 
01572 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getTempDirURL(
01573         rtl_uString **pustrTempDirURL );
01574 
01575 
01627 SAL_DLLPUBLIC oslFileError SAL_CALL osl_createTempFile(
01628     rtl_uString*   pustrDirectoryURL,
01629     oslFileHandle* pHandle,
01630     rtl_uString**  ppustrTempFileURL);
01631 
01632 #ifdef __cplusplus
01633 }
01634 #endif
01635 
01636 #endif  /* _OSL_FILE_H_ */
01637 
01638 
01639 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines