ScummVM API documentation
DrivePOSIXFilesystemNode Class Reference

#include <posix-drives-fs.h>

Inheritance diagram for DrivePOSIXFilesystemNode:
POSIXFilesystemNode AbstractFSNode AndroidPOSIXFilesystemNode

Classes

struct  Config
 

Public Types

enum  BufferingMode { kBufferingModeDisabled, kBufferingModeStdio, kBufferingModeScummVM }
 

Public Member Functions

 DrivePOSIXFilesystemNode (const Common::String &path, const Config &config)
 
 DrivePOSIXFilesystemNode (const Config &config)
 
Common::SeekableReadStreamcreateReadStream () override
 
Common::SeekableWriteStreamcreateWriteStream (bool atomic) override
 
AbstractFSNodegetChild (const Common::String &n) const override
 
bool getChildren (AbstractFSList &list, ListMode mode, bool hidden) const override
 
AbstractFSNodegetParent () const override
 
- Public Member Functions inherited from POSIXFilesystemNode
 POSIXFilesystemNode (const Common::String &path)
 
bool exists () const override
 
Common::U32String getDisplayName () const override
 
Common::String getName () const override
 
Common::String getPath () const override
 
bool isDirectory () const override
 
bool isReadable () const override
 
bool isWritable () const override
 
Common::SeekableReadStreamcreateReadStreamForAltStream (Common::AltStreamType altStreamType) override
 
bool createDirectory () override
 
- Public Member Functions inherited from AbstractFSNode
virtual ~AbstractFSNode ()
 

Protected Member Functions

virtual AbstractFSNodemakeNode () const
 
AbstractFSNodemakeNode (const Common::String &path) const override
 
- Protected Member Functions inherited from POSIXFilesystemNode
 POSIXFilesystemNode ()
 
virtual void setFlags ()
 

Protected Attributes

const Config_config
 
- Protected Attributes inherited from POSIXFilesystemNode
Common::String _displayName
 
Common::String _path
 
bool _isDirectory
 
bool _isValid
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractFSNode
static Common::FSNode makeFSNode (AbstractFSNode *realNode)
 
- Protected Types inherited from AbstractFSNode
typedef Common::FSNode::ListMode ListMode
 
- Static Protected Member Functions inherited from AbstractFSNode
static const char * lastPathComponent (const Common::String &str, const char sep)
 

Detailed Description

POSIX file system node where the top-level directory is a hardcoded list of drives.

Member Enumeration Documentation

◆ BufferingMode

Enumerator
kBufferingModeDisabled 

IO buffering is fully disabled

kBufferingModeStdio 

IO buffering is enabled and uses the libc implemenation

kBufferingModeScummVM 

IO buffering is enabled and uses ScummVM's buffering stream wraappers

Member Function Documentation

◆ createReadStream()

Common::SeekableReadStream* DrivePOSIXFilesystemNode::createReadStream ( )
overridevirtual

Creates a SeekableReadStream instance corresponding to the file referred by this node. This assumes that the node actually refers to a readable file. If this is not the case, 0 is returned.

Returns
pointer to the stream object, 0 in case of a failure

Reimplemented from POSIXFilesystemNode.

◆ createWriteStream()

Common::SeekableWriteStream* DrivePOSIXFilesystemNode::createWriteStream ( bool  atomic)
overridevirtual

Creates a WriteStream instance corresponding to the file referred by this node. This assumes that the node actually refers to a readable file. If this is not the case, 0 is returned.

When an atomic write stream is requested, the backend will write the data in a temporary file before moving it to its final destination.

Parameters
atomicRequest for an atomic file write when closing.
Returns
pointer to the stream object, 0 in case of a failure

Reimplemented from POSIXFilesystemNode.

◆ getChild()

AbstractFSNode* DrivePOSIXFilesystemNode::getChild ( const Common::String name) const
overridevirtual

Returns the child node with the given name. When called on a non-directory node, it should handle this gracefully by returning 0. When called with a name not matching any of the files/dirs contained in this directory, a valid node should be returned, which returns 'false' upon calling the exists() method. The idea is that this node can then still can be used to create a new file via the createWriteStream() method.

Example: Calling getChild() for a node with path "/foo/bar" using name="file.txt", would produce a new node with "/foo/bar/file.txt" as path.

Note
Handling calls on non-dir nodes gracefully makes it possible to switch to a lazy type detection scheme in the future.
Parameters
nameString containing the name of the child to create a new node.

Reimplemented from POSIXFilesystemNode.

◆ getChildren()

bool DrivePOSIXFilesystemNode::getChildren ( AbstractFSList list,
ListMode  mode,
bool  hidden 
) const
overridevirtual

Return a list of child nodes of this directory node. If called on a node that does not represent a directory, false is returned.

Parameters
listList to put the contents of the directory in.
modeMode to use while listing the directory.
hiddenWhether to include hidden files or not in the results.
Returns
true if successful, false otherwise (e.g. when the directory does not exist).

Reimplemented from POSIXFilesystemNode.

◆ getParent()

AbstractFSNode* DrivePOSIXFilesystemNode::getParent ( ) const
overridevirtual

The parent node of this directory. The parent of the root is the root itself.

Reimplemented from POSIXFilesystemNode.


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