LibreOffice
LibreOffice 7.4 SDK C/C++ API Reference
Public Types | Static Public Member Functions | List of all members
osl::FileBase Class Reference

Base class for all File System specific objects. More...

#include <file.hxx>

Inheritance diagram for osl::FileBase:
osl::Directory osl::DirectoryItem osl::File osl::VolumeDevice

Public Types

enum  RC {
  E_None = osl_File_E_None , E_PERM = osl_File_E_PERM , E_NOENT = osl_File_E_NOENT , E_SRCH = osl_File_E_SRCH ,
  E_INTR = osl_File_E_INTR , E_IO = osl_File_E_IO , E_NXIO = osl_File_E_NXIO , E_2BIG = osl_File_E_2BIG ,
  E_NOEXEC = osl_File_E_NOEXEC , E_BADF = osl_File_E_BADF , E_CHILD = osl_File_E_CHILD , E_AGAIN = osl_File_E_AGAIN ,
  E_NOMEM = osl_File_E_NOMEM , E_ACCES = osl_File_E_ACCES , E_FAULT = osl_File_E_FAULT , E_BUSY = osl_File_E_BUSY ,
  E_EXIST = osl_File_E_EXIST , E_XDEV = osl_File_E_XDEV , E_NODEV = osl_File_E_NODEV , E_NOTDIR = osl_File_E_NOTDIR ,
  E_ISDIR = osl_File_E_ISDIR , E_INVAL = osl_File_E_INVAL , E_NFILE = osl_File_E_NFILE , E_MFILE = osl_File_E_MFILE ,
  E_NOTTY = osl_File_E_NOTTY , E_FBIG = osl_File_E_FBIG , E_NOSPC = osl_File_E_NOSPC , E_SPIPE = osl_File_E_SPIPE ,
  E_ROFS = osl_File_E_ROFS , E_MLINK = osl_File_E_MLINK , E_PIPE = osl_File_E_PIPE , E_DOM = osl_File_E_DOM ,
  E_RANGE = osl_File_E_RANGE , E_DEADLK = osl_File_E_DEADLK , E_NAMETOOLONG = osl_File_E_NAMETOOLONG , E_NOLCK = osl_File_E_NOLCK ,
  E_NOSYS = osl_File_E_NOSYS , E_NOTEMPTY = osl_File_E_NOTEMPTY , E_LOOP = osl_File_E_LOOP , E_ILSEQ = osl_File_E_ILSEQ ,
  E_NOLINK = osl_File_E_NOLINK , E_MULTIHOP = osl_File_E_MULTIHOP , E_USERS = osl_File_E_USERS , E_OVERFLOW = osl_File_E_OVERFLOW ,
  E_NOTREADY = osl_File_E_NOTREADY , E_invalidError = osl_File_E_invalidError , E_TIMEDOUT = osl_File_E_TIMEDOUT , E_NETWORK = osl_File_E_NETWORK
}
 

Static Public Member Functions

static RC getCanonicalName (const ::rtl::OUString &ustrRequestedURL, ::rtl::OUString &ustrValidURL)
 Determine a valid unused canonical name for a requested name. More...
 
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. More...
 
static RC getSystemPathFromFileURL (const ::rtl::OUString &ustrFileURL, ::rtl::OUString &ustrSystemPath)
 Convert a file URL into a system dependent path. More...
 
static RC getFileURLFromSystemPath (const ::rtl::OUString &ustrSystemPath, ::rtl::OUString &ustrFileURL)
 Convert a system dependent path into a file URL. More...
 
static RC searchFileURL (const ::rtl::OUString &ustrFileName, const ::rtl::OUString &ustrSearchPath, ::rtl::OUString &ustrFileURL)
 Search a full qualified system path or a file URL. More...
 
static RC getTempDirURL (::rtl::OUString &ustrTempDirURL)
 Retrieves the file URL of the system's temporary directory path. More...
 
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 getTempDirURL. More...
 

Detailed Description

Base class for all File System specific objects.

See also
Directory
DirectoryItem
File

Member Enumeration Documentation

◆ RC

Enumerator
E_None 

on success

E_PERM 

operation not permitted

E_NOENT 

no such file or directory

E_SRCH 

no process matches the PID

E_INTR 

function call was interrupted

E_IO 

I/O error occurred.

E_NXIO 

no such device or address

E_2BIG 

argument list too long

E_NOEXEC 

invalid executable file format

E_BADF 

bad file descriptor

E_CHILD 

there are no child processes

E_AGAIN 

resource temp unavailable, try again later

E_NOMEM 

no memory available

E_ACCES 

file permissions do not allow operation

E_FAULT 

bad address; an invalid pointer detected

E_BUSY 

resource busy

E_EXIST 

file exists where should only be created

E_XDEV 

improper link across file systems detected

E_NODEV 

wrong device type specified

E_NOTDIR 

file isn't a directory where one is needed

E_ISDIR 

file is a directory, invalid operation

E_INVAL 

invalid argument to library function

E_NFILE 

too many distinct file openings

E_MFILE 

process has too many distinct files open

E_NOTTY 

inappropriate I/O control operation

E_FBIG 

file too large

E_NOSPC 

no space left on device, write failed

E_SPIPE 

invalid seek operation (such as on pipe)

E_ROFS 

illegal modification to read-only filesystem

E_MLINK 

too many links to file

E_PIPE 

broken pipe; no process reading from other end of pipe

E_DOM 

domain error (mathematical error)

E_RANGE 

range error (mathematical error)

E_DEADLK 

deadlock avoided

E_NAMETOOLONG 

filename too long

E_NOLCK 

no locks available

E_NOSYS 

function not implemented

E_NOTEMPTY 

directory not empty

E_LOOP 

too many levels of symbolic links found during name lookup

E_ILSEQ 

invalid or incomplete byte sequence of multibyte char found

E_NOLINK 

link has been severed

E_MULTIHOP 

remote resource is not directly available

E_USERS 

file quote system is confused as there are too many users

E_OVERFLOW 

value too large for defined data type

E_NOTREADY 

device not ready

E_invalidError 

unmapped error: always last entry in enum!

E_TIMEDOUT 

socket operation timed out

E_NETWORK 

Member Function Documentation

◆ createTempFile()

static RC osl::FileBase::createTempFile ( ::rtl::OUString pustrDirectoryURL,
oslFileHandle pHandle,
::rtl::OUString pustrTempFileURL 
)
inlinestatic

Creates a temporary file in the directory provided by the caller or the directory returned by getTempDirURL.

Under UNIX Operating Systems the file will be created with read and write access for the user exclusively. If the caller requests only a handle to the open file but not the name of it, the file will be automatically removed on close else the caller is responsible for removing the file on success.

Parameters
[in]pustrDirectoryURLSpecifies the full qualified URL where the temporary file should be created. If pustrDirectoryURL is 0 the path returned by osl_getTempDirURL will be used.
[out]pHandleOn success receives a handle to the open file. If pHandle is 0 the file will be closed on return, in this case pustrTempFileURL must not be 0.
[out]pustrTempFileURLOn success receives the full qualified URL of the temporary file. If pustrTempFileURL is 0 the file will be automatically removed on close, in this case pHandle must not be 0. If pustrTempFileURL is not 0 the caller receives the name of the created file and is responsible for removing the file.

Description of the different pHandle, ppustrTempFileURL parameter combinations. pHandle is 0 and pustrTempDirURL is 0 - this combination is invalid
pHandle is not 0 and pustrTempDirURL is 0 - a handle to the open file will be returned on success and the file will be automatically removed on close
pHandle is 0 and pustrTempDirURL is not 0 - the name of the file will be returned, the caller is responsible for opening, closing and removing the file.
pHandle is not 0 and pustrTempDirURL is not 0 - a handle to the open file as well as the file name will be returned, the caller is responsible for closing and removing the file.

Return values
E_Noneon success
E_INVALthe format of the parameter is invalid
E_NOMEMnot enough memory for allocating structures
E_ACCESPermission denied
E_NOENTNo such file or directory
E_NOTDIRNot a directory
E_ROFSRead-only file system
E_NOSPCNo space left on device
E_DQUOTQuota exceeded
See also
getTempDirURL()

◆ getAbsoluteFileURL()

static RC osl::FileBase::getAbsoluteFileURL ( const ::rtl::OUString ustrBaseDirectoryURL,
const ::rtl::OUString ustrRelativeFileURL,
::rtl::OUString ustrAbsoluteFileURL 
)
inlinestatic

Convert a path relative to a given directory into an full qualified file URL.

Convert a path relative to a given directory into an full qualified file URL. The function resolves symbolic links if possible and path ellipses, so on success the resulting absolute path is fully resolved.

Parameters
[in]ustrBaseDirectoryURLBase directory URL to which the relative path is related to.
[in]ustrRelativeFileURLA URL of a file or directory relative to the directory path specified by ustrBaseDirectoryURL or an absolute path. If ustrRelativeFileURL denotes an absolute path ustrBaseDirectoryURL will be ignored.
[out]ustrAbsoluteFileURLOn success it receives the full qualified absolute file URL.
Return values
E_Noneon success
E_INVALthe format of the parameters was not valid
E_NOMEMnot enough memory for allocating structures
E_NOTDIRnot a directory
E_ACCESpermission denied
E_NOENTno such file or directory
E_NAMETOOLONGfile name too long
E_OVERFLOWvalue too large for defined data type
E_FAULTbad address
E_INTRfunction call was interrupted
E_LOOPtoo many symbolic links encountered
E_MULTIHOPmultihop attempted
E_NOLINKlink has been severed
See also
DirectoryItem::getFileStatus()

◆ getCanonicalName()

static RC osl::FileBase::getCanonicalName ( const ::rtl::OUString ustrRequestedURL,
::rtl::OUString ustrValidURL 
)
inlinestatic

Determine a valid unused canonical name for a requested name.

Determines a valid unused canonical name for a requested name. Depending on the Operating System and the File System the illegal characters are replaced by valid ones. If a file or directory with the requested name already exists a new name is generated following the common rules on the actual Operating System and File System.

Parameters
[in]ustrRequestedURLRequested name of a file or directory.
[out]ustrValidURLOn success receives a name which is unused and valid on the actual Operating System and File System.
Return values
E_Noneon success
E_INVALthe format of the parameters was not valid
See also
DirectoryItem::getFileStatus()

◆ getFileURLFromSystemPath()

static RC osl::FileBase::getFileURLFromSystemPath ( const ::rtl::OUString ustrSystemPath,
::rtl::OUString ustrFileURL 
)
inlinestatic

Convert a system dependent path into a file URL.

Parameters
[in]ustrSystemPathA System dependent path of a file or directory.
[out]ustrFileURLOn success it receives the file URL.
Return values
E_Noneon success
E_INVALthe format of the parameters was not valid
See also
getSystemPathFromFileURL()

◆ getSystemPathFromFileURL()

static RC osl::FileBase::getSystemPathFromFileURL ( const ::rtl::OUString ustrFileURL,
::rtl::OUString ustrSystemPath 
)
inlinestatic

Convert a file URL into a system dependent path.

Parameters
[in]ustrFileURLA File URL.
[out]ustrSystemPathOn success it receives the system path.
Return values
E_Noneon success
E_INVALthe format of the parameters was not valid
See also
getFileURLFromSystemPath()

◆ getTempDirURL()

static RC osl::FileBase::getTempDirURL ( ::rtl::OUString ustrTempDirURL)
inlinestatic

Retrieves the file URL of the system's temporary directory path.

Parameters
[out]ustrTempDirURLOn success receives the URL of system's temporary directory path.
Return values
E_Noneon success
E_NOENTno such file or directory not found

◆ searchFileURL()

static RC osl::FileBase::searchFileURL ( const ::rtl::OUString ustrFileName,
const ::rtl::OUString ustrSearchPath,
::rtl::OUString ustrFileURL 
)
inlinestatic

Search a full qualified system path or a file URL.

Parameters
[in]ustrFileNameA system dependent path, a file URL, a file or relative directory
[in]ustrSearchPathA list of system paths, in which a given file has to be searched. The Notation of a path list is system dependent, e.g. on UNIX system "/usr/bin:/bin" and on Windows "C:\BIN;C:\BATCH". These paths are only for the search of a file or a relative path, otherwise it will be ignored. If ustrSearchPath is NULL or while using the search path the search failed, the function searches for a matching file in all system directories and in the directories listed in the PATH environment variable. The value of an environment variable should be used (e.g. LD_LIBRARY_PATH) if the caller is not aware of the Operating System and so doesn't know which path list delimiter to use.
[out]ustrFileURLOn success it receives the full qualified file URL.
Return values
E_Noneon success
E_INVALthe format of the parameters was not valid
E_NOTDIRnot a directory
E_NOENTno such file or directory not found
See also
getFileURLFromSystemPath()
getSystemPathFromFileURL()

The documentation for this class was generated from the following file: