Role Playing Database (API Documentation) 3.1.3

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:

- -ftype This readonly option flags type of directory entry, file or directory.
    Instance variables:
- _name The file name. Accessors: Name and SetName.
- _mtime The mod time. Accessors: MTime and SetMTime.
- _files The list of files (directories only). No direct accessors.
- _mode The file mode (permissions). Accessors Mode and SetMode.
- _offset The offset in the backing file (files only). Accessors Offset and SetOffset.
- _size The size of the file (files only). Accessors Size and SetSize

## Constructor & Destructor Documentation

## ◆ RPGDirent()

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

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

Parameters

  objname | Should be passed as AUTO%
  name | New 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

  name | The 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

  ENOENT | If the containing dirent is not a directory.

## ◆ GetDirents()

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

Get a list of child dirents.

Returns
  A list of dirents.

Exceptions

  ENOENT | If the containing dirent is not a directory.

## ◆ LookupMatch()

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

LookupMatch using a glob pattern

Parameters

  pattern | The (glob) pattern to look for.
  types | The file types to check for. Must be a list containing "file" and/or "directory"

Returns
  A list of dirents.

Exceptions

  ENOENT | If the containing dirent is not a directory.

## ◆ LookupName()

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

Lookup a filename (exact match).

Parameters

  name | The filename to look for.

Returns
  A dirent or {}.

Exceptions

  ENOENT | If 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

  ENOENT | If 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

  dirent | The dirent to remove.

Returns
  The dirent.

Exceptions

  ENOENT | If 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:

- RPGFS.tcl