Role Playing Database (API Documentation)  3.1.0b
Public Member Functions | List of all members
vfs::rpg::RPGDirent Class Reference

A Directory Entry Holds information about a file or directory. Only the bare minimum information is kept: name, mod time, list of files (directories only), mode (permissions), offset (files only), and size (files only). More...

Public Member Functions

 RPGDirent (name,...)
 
 ~RPGDirent ()
 
 AddNewDirent (name,...)
 
 RemoveDirent (dirent)
 
 GetDirents ()
 
 NumDirents ()
 
 LookupName (name)
 
 LookupMatch (pattern, types="file directory")
 

Detailed Description

A Directory Entry Holds information about a file or directory. Only the bare minimum information is kept: name, mod time, list of files (directories only), mode (permissions), offset (files only), and size (files only).

Options:

Constructor & Destructor Documentation

◆ RPGDirent()

vfs::rpg::RPGDirent::RPGDirent ( name  ,
  ... 
)

Constructor: create a new direct. Not normally called directly (see AddNewDirent).

Parameters
objnameShould be passed as AUTO%
nameNew filename
...Options:
  • -ftype File type. Must be either "file" or "directory". Readonly and defaults to "file".

◆ ~RPGDirent()

vfs::rpg::RPGDirent::~RPGDirent ( )

Destructor – destroy the directory entry and all of its child directory entries.

Member Function Documentation

◆ AddNewDirent()

vfs::rpg::RPGDirent::AddNewDirent ( name  ,
  ... 
)

Add a new directory entry to this directory.

Parameters
nameThe new filename.
...Options:
  • -ftype The type of new directory entry to create. Must be one of "file" or "directory" and is "file" by default.
Returns
The new directory entry.
Exceptions
ENOENTIf the containing dirent is not a directory.

◆ GetDirents()

vfs::rpg::RPGDirent::GetDirents ( )

Get a list of child dirents.

Returns
A list of dirents.
Exceptions
ENOENTIf the containing dirent is not a directory.

◆ LookupMatch()

vfs::rpg::RPGDirent::LookupMatch ( pattern  ,
types  = "file directory" 
)

LookupMatch using a glob pattern

Parameters
patternThe (glob) pattern to look for.
typesThe file types to check for. Must be a list containing "file" and/or "directory"
Returns
A list of dirents.
Exceptions
ENOENTIf the containing dirent is not a directory.

◆ LookupName()

vfs::rpg::RPGDirent::LookupName ( name  )

Lookup a filename (exact match).

Parameters
nameThe filename to look for.
Returns
A dirent or {}.
Exceptions
ENOENTIf the containing dirent is not a directory.

◆ NumDirents()

vfs::rpg::RPGDirent::NumDirents ( )

Get a count of child dirents.

Returns
The number of child dirents.
Exceptions
ENOENTIf the containing dirent is not a directory.

◆ RemoveDirent()

vfs::rpg::RPGDirent::RemoveDirent ( dirent  )

Remove a directory entry from this directory entry. The dirent is not destroyed! The calling function needs to take care of that or suffer a memory leak.

Parameters
direntThe dirent to remove.
Returns
The dirent.
Exceptions
ENOENTIf the containing dirent is not a directory. (No error is reported if the dirent being removed is not in this dirent.)

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