LibreOffice: osl::Directory Class Reference

LibreOffice LibreOffice 7.6 SDK C/C++ API Reference

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
osl::Directory Class Reference

The directory class object provides an enumeration of DirectoryItems. More...

`#include <file.hxx>`

Inheritance diagram for osl::Directory:

## Public Member Functions
| Directory (const ::rtl::OUString &strPath)
| Constructor.
| ~Directory ()
| Destructor.
rtl::OUString | getURL () const
| Obtain the URL.
RC | open ()
| Open a directory for enumerating its contents.
bool | isOpen ()
| Query if directory is open.
RC | close ()
| Close a directory.
RC | reset ()
| Resets the directory item enumeration to the beginning.
RC | getNextItem (DirectoryItem &rItem, sal_uInt32 nHint=0)
| Retrieve the next item of a previously opened directory.

## Static Public Member Functions
static RC | getVolumeInfo (const ::rtl::OUString &ustrDirectoryURL, VolumeInfo &rInfo)
| Retrieve information about a volume.
static RC | create (const ::rtl::OUString &ustrDirectoryURL, sal_uInt32 flags=osl_File_OpenFlag_Read|osl_File_OpenFlag_Write)
| Create a directory.
static RC | remove (const ::rtl::OUString &ustrDirectoryURL)
| Remove an empty directory.
static RC | createPath (const ::rtl::OUString &aDirectoryUrl, DirectoryCreationObserver *aDirectoryCreationObserver=NULL)
| Create a directory path.
Static Public Member Functions inherited from osl::FileBase
static RC | getCanonicalName (const ::rtl::OUString &ustrRequestedURL, ::rtl::OUString &ustrValidURL)
| Determine a valid unused canonical name for a requested name.
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.
static RC | getSystemPathFromFileURL (const ::rtl::OUString &ustrFileURL, ::rtl::OUString &ustrSystemPath)
| Convert a file URL into a system dependent path.
static RC | getFileURLFromSystemPath (const ::rtl::OUString &ustrSystemPath, ::rtl::OUString &ustrFileURL)
| Convert a system dependent path into a file URL.
static RC | searchFileURL (const ::rtl::OUString &ustrFileName, const ::rtl::OUString &ustrSearchPath, ::rtl::OUString &ustrFileURL)
| Search a full qualified system path or a file URL.
static RC | getTempDirURL (::rtl::OUString &ustrTempDirURL)
| Retrieves the file URL of the system's temporary directory path.
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.

## Additional Inherited Members
Public Types inherited from osl::FileBase
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 }

## Detailed Description

The directory class object provides an enumeration of DirectoryItems.

See also
  DirectoryItem
  File

## Constructor & Destructor Documentation

## ◆ Directory()

osl::Directory::Directory | ( | const ::rtl::OUString & | strPath | ) |
| inline

Constructor.

Parameters

  [in] | strPath | The full qualified URL of the directory. Relative URLs are not allowed.

## ◆ ~Directory()

osl::Directory::~Directory | ( |  | ) |
| inline

Destructor.

## Member Function Documentation

## ◆ close()

RC osl::Directory::close | ( |  | ) |
| inline

Close a directory.

Return values

  E_None | on success
  E_INVAL | the format of the parameters was not valid
  E_NOMEM | not enough memory for allocating structures
  E_BADF | invalid oslDirectory parameter
  E_INTR | the function call was interrupted

See also
  open()

## ◆ create()

static RC osl::Directory::create | ( | const ::rtl::OUString & | ustrDirectoryURL,
|  | sal_uInt32 | flags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write )
| inlinestatic

Create a directory.

Parameters

  [in] | ustrDirectoryURL | Full qualified URL of the directory to create.
  [in] | flags | Optional flags, see osl_createDirectoryWithFlags for details. This defaulted parameter is new since LibreOffice 4.3.

Return values

  E_None | on success
  E_INVAL | the format of the parameters was not valid
  E_NOMEM | not enough memory for allocating structures
  E_EXIST | file exists
  E_ACCES | permission denied
  E_NAMETOOLONG | file name too long
  E_NOENT | no such file or directory
  E_NOTDIR | not a directory
  E_ROFS | read-only file system
  E_NOSPC | no space left on device
  E_DQUOT | quota exceeded
  E_LOOP | too many symbolic links encountered
  E_FAULT | bad address
  E_IO | on I/O errors
  E_MLINK | too many links
  E_MULTIHOP | multihop attempted
  E_NOLINK | link has been severed

See also
  remove()

## ◆ createPath()

static RC osl::Directory::createPath | ( | const ::rtl::OUString & | aDirectoryUrl,
|  | DirectoryCreationObserver * | aDirectoryCreationObserver = NULL )
| inlinestatic

Create a directory path.

The osl_createDirectoryPath function creates a specified directory path. All nonexisting sub directories will be created.

Attention
  You cannot rely on getting the error code E_EXIST for existing directories. Programming against this error code is in general a strong indication of a wrong usage of osl_createDirectoryPath.

Parameters

  aDirectoryUrl | [in] The absolute file URL of the directory path to create. A relative file URL will not be accepted.
  aDirectoryCreationObserver | [in] Pointer to an instance of type DirectoryCreationObserver that will be informed about the creation of a directory. The value of this parameter may be NULL, in this case notifications will not be sent.

Return values

  E_None | On success
  E_INVAL | The format of the parameters was not valid
  E_ACCES | Permission denied
  E_EXIST | The final node of the specified directory path already exist
  E_NAMETOOLONG | The name of the specified directory path exceeds the maximum allowed length
  E_NOTDIR | A component of the specified directory path already exist as file in any part of the directory path
  E_ROFS | Read-only file system
  E_NOSPC | No space left on device
  E_DQUOT | Quota exceeded
  E_FAULT | Bad address
  E_IO | I/O error
  E_LOOP | Too many symbolic links encountered
  E_NOLINK | Link has been severed
  E_invalidError | An unknown error occurred

See also
  DirectoryCreationObserver
  create

## ◆ getNextItem()

RC osl::Directory::getNextItem | ( | DirectoryItem & | rItem,
|  | sal_uInt32 | nHint = 0 )
| inline

Retrieve the next item of a previously opened directory.

Retrieves the next item of a previously opened directory.

Parameters

  [out] | rItem | On success a valid DirectoryItem.
  [in] | nHint | With this parameter the caller can tell the implementation that (s)he is going to call this function uHint times afterwards. This enables the implementation to get the information for more than one file and cache it until the next calls.

Return values

  E_None | on success
  E_INVAL | the format of the parameters was not valid
  E_NOMEM | not enough memory for allocating structures
  E_NOENT | no more entries in this directory
  E_BADF | invalid oslDirectory parameter
  E_OVERFLOW | the value too large for defined data type

See also
  DirectoryItem

## ◆ getURL()

rtl::OUString osl::Directory::getURL | ( |  | ) | const
| inline

Obtain the URL.

Returns
  the URL with which this Directory instance was created.

Since
  LibreOffice 4.1

## ◆ getVolumeInfo()

static RC osl::Directory::getVolumeInfo | ( | const ::rtl::OUString & | ustrDirectoryURL,
|  | VolumeInfo & | rInfo )
| inlinestatic

Retrieve information about a volume.

Retrieves information about a volume. A volume can either be a mount point, a network resource or a drive depending on Operating System and File System.

Parameters

  [in] | ustrDirectoryURL | Full qualified URL of the volume
  [out] | rInfo | On success it receives information about the volume.

Return values

  E_None | on success
  E_NOMEM | not enough memory for allocating structures
  E_INVAL | the format of the parameters was not valid
  E_NOTDIR | not a directory
  E_NAMETOOLONG | file name too long
  E_NOENT | no such file or directory
  E_ACCES | permission denied
  E_LOOP | too many symbolic links encountered
  E_FAULT | Bad address
  E_IO | on I/O errors
  E_NOSYS | function not implemented
  E_MULTIHOP | multihop attempted
  E_NOLINK | link has been severed
  E_INTR | function call was interrupted

See also
  FileStatus
  VolumeInfo

## ◆ isOpen()

bool osl::Directory::isOpen | ( |  | ) |
| inline

Query if directory is open.

Query if directory is open and so item enumeration is valid.

Return values

  true | if the directory is open else false.

See also
  open()
  close()

## ◆ open()

RC osl::Directory::open | ( |  | ) |
| inline

Open a directory for enumerating its contents.

Return values

  E_None | on success
  E_INVAL | the format of the parameters was not valid
  E_NOENT | the specified path doesn't exist
  E_NOTDIR | the specified path is not a directory
  E_NOMEM | not enough memory for allocating structures
  E_ACCES | permission denied
  E_MFILE | too many open files used by the process
  E_NFILE | too many open files in the system
  E_NAMETOOLONG | File name too long
  E_LOOP | Too many symbolic links encountered

See also
  getNextItem()
  close()

## ◆ remove()

static RC osl::Directory::remove | ( | const ::rtl::OUString & | ustrDirectoryURL | ) |
| inlinestatic

Remove an empty directory.

Parameters

  [in] | ustrDirectoryURL | Full qualified URL of the directory.

Return values

  E_None | on success
  E_INVAL | the format of the parameters was not valid
  E_NOMEM | not enough memory for allocating structures
  E_PERM | operation not permitted
  E_ACCES | permission denied
  E_NOENT | no such file or directory
  E_NOTDIR | not a directory
  E_NOTEMPTY | directory not empty
  E_FAULT | bad address
  E_NAMETOOLONG | file name too long
  E_BUSY | device or resource busy
  E_ROFS | read-only file system
  E_LOOP | too many symbolic links encountered
  E_EXIST | file exists
  E_IO | on I/O errors
  E_MULTIHOP | multihop attempted
  E_NOLINK | link has been severed

See also
  create()

## ◆ reset()

RC osl::Directory::reset | ( |  | ) |
| inline

Resets the directory item enumeration to the beginning.

Return values

  E_None | on success
  E_INVAL | the format of the parameters was not valid
  E_NOENT | the specified path doesn't exist
  E_NOTDIR | the specified path is not a directory
  E_NOMEM | not enough memory for allocating structures
  E_ACCES | permission denied
  E_MFILE | too many open files used by the process
  E_NFILE | too many open files in the system
  E_NAMETOOLONG | File name too long
  E_LOOP | Too many symbolic links encountered

See also
  open()

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

- osl/file.hxx