ScummVM API documentation
AbstractFSNode Class Referenceabstract

#include <abstract-fs.h>

Inheritance diagram for AbstractFSNode:
AddSAFFakeNode AmigaOSFilesystemNode AndroidSAFFilesystemNode ChRootFilesystemNode KolibriOSFilesystemNode LibRetroFilesystemNode MorphOSFilesystemNode N64FilesystemNode POSIXFilesystemNode PSPFilesystemNode RISCOSFilesystemNode WiiFilesystemNode WindowsFilesystemNode

Public Member Functions

virtual ~AbstractFSNode ()
 
virtual bool exists () const =0
 
virtual bool getChildren (AbstractFSList &list, ListMode mode, bool hidden) const =0
 
virtual Common::U32String getDisplayName () const =0
 
virtual Common::String getName () const =0
 
virtual Common::String getPath () const =0
 
virtual bool isDirectory () const =0
 
virtual bool isReadable () const =0
 
virtual bool isWritable () const =0
 
virtual Common::SeekableReadStreamcreateReadStream ()=0
 
virtual Common::SeekableReadStreamcreateReadStreamForAltStream (Common::AltStreamType altStreamType)
 
virtual Common::SeekableWriteStreamcreateWriteStream ()=0
 
virtual bool createDirectory ()=0
 

Static Public Member Functions

static Common::FSNode makeFSNode (AbstractFSNode *realNode)
 

Protected Types

typedef Common::FSNode::ListMode ListMode
 

Protected Member Functions

virtual AbstractFSNodegetChild (const Common::String &name) const =0
 
virtual AbstractFSNodegetParent () const =0
 

Static Protected Member Functions

static const char * lastPathComponent (const Common::String &str, const char sep)
 

Detailed Description

Abstract file system node. Private subclasses implement the actual functionality.

Most of the methods correspond directly to methods in class FSNode, so if they are not documented here, look there for more information about the semantics.

Constructor & Destructor Documentation

◆ ~AbstractFSNode()

virtual AbstractFSNode::~AbstractFSNode ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ getChild()

virtual AbstractFSNode* AbstractFSNode::getChild ( const Common::String name) const
protectedpure virtual

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.

Implemented in AddSAFFakeNode, AndroidSAFFilesystemNode, MorphOSFilesystemNode, AmigaOSFilesystemNode, LibRetroFilesystemNode, WindowsFilesystemNode, DrivePOSIXFilesystemNode, N64FilesystemNode, WiiFilesystemNode, POSIXFilesystemNode, RISCOSFilesystemNode, PSPFilesystemNode, KolibriOSFilesystemNode, and ChRootFilesystemNode.

◆ getParent()

◆ lastPathComponent()

static const char* AbstractFSNode::lastPathComponent ( const Common::String str,
const char  sep 
)
staticprotected

Returns the last component of a given path.

Examples: /foo/bar.txt would return /bar.txt /foo/bar/ would return /bar/

Parameters
strString containing the path.
sepcharacter used to separate path components
Returns
Pointer to the first char of the last component inside str.

◆ makeFSNode()

static Common::FSNode AbstractFSNode::makeFSNode ( AbstractFSNode realNode)
inlinestatic

Construct a FSNode object from an AbstractFSNode object.

This is a helper to create Common::FSNode objects when the backend's FileSystemFactory cannot create the given AbstractFSNode object itself. All other code is supposed to use Common::FSNode's constructor itself.

Parameters
realNodePointer to a heap allocated instance. FSNode will take ownership of the pointer.

◆ getChildren()

virtual bool AbstractFSNode::getChildren ( AbstractFSList list,
ListMode  mode,
bool  hidden 
) const
pure virtual

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).

Implemented in AddSAFFakeNode, AndroidSAFFilesystemNode, MorphOSFilesystemNode, AmigaOSFilesystemNode, LibRetroFilesystemNode, WindowsFilesystemNode, DrivePOSIXFilesystemNode, N64FilesystemNode, WiiFilesystemNode, POSIXFilesystemNode, RISCOSFilesystemNode, PSPFilesystemNode, KolibriOSFilesystemNode, and ChRootFilesystemNode.

◆ getDisplayName()

virtual Common::U32String AbstractFSNode::getDisplayName ( ) const
pure virtual

◆ getName()

virtual Common::String AbstractFSNode::getName ( ) const
pure virtual

Returns the last component of the path pointed by this FSNode.

Examples (POSIX): /foo/bar.txt would return /bar.txt /foo/bar/ would return /bar/

Note
This method is very architecture dependent, please check the concrete implementation for more information.

Implemented in AddSAFFakeNode, AndroidSAFFilesystemNode, AmigaOSFilesystemNode, MorphOSFilesystemNode, WindowsFilesystemNode, LibRetroFilesystemNode, WiiFilesystemNode, POSIXFilesystemNode, RISCOSFilesystemNode, N64FilesystemNode, PSPFilesystemNode, KolibriOSFilesystemNode, and ChRootFilesystemNode.

◆ getPath()

◆ isDirectory()

◆ isReadable()

virtual bool AbstractFSNode::isReadable ( ) const
pure virtual

Indicates whether the object referred by this path can be read from or not.

If the path refers to a directory, readability implies being able to read and list the directory entries.

If the path refers to a file, readability implies being able to read the contents of the file.

Returns
bool true if the object can be read, false otherwise.

Implemented in AddSAFFakeNode, AndroidSAFFilesystemNode, AmigaOSFilesystemNode, MorphOSFilesystemNode, LibRetroFilesystemNode, WindowsFilesystemNode, N64FilesystemNode, WiiFilesystemNode, POSIXFilesystemNode, RISCOSFilesystemNode, PSPFilesystemNode, KolibriOSFilesystemNode, and ChRootFilesystemNode.

◆ isWritable()

virtual bool AbstractFSNode::isWritable ( ) const
pure virtual

Indicates whether the object referred by this path can be written to or not.

If the path refers to a directory, writability implies being able to modify the directory entry (i.e. rename the directory, remove it or write files inside of it).

If the path refers to a file, writability implies being able to write data to the file.

Returns
bool true if the object can be written to, false otherwise.

Implemented in AddSAFFakeNode, AndroidSAFFilesystemNode, AmigaOSFilesystemNode, MorphOSFilesystemNode, LibRetroFilesystemNode, WindowsFilesystemNode, N64FilesystemNode, WiiFilesystemNode, POSIXFilesystemNode, RISCOSFilesystemNode, PSPFilesystemNode, KolibriOSFilesystemNode, and ChRootFilesystemNode.

◆ createReadStream()

virtual Common::SeekableReadStream* AbstractFSNode::createReadStream ( )
pure virtual

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

Implemented in AddSAFFakeNode, AndroidSAFFilesystemNode, MorphOSFilesystemNode, AmigaOSFilesystemNode, LibRetroFilesystemNode, WindowsFilesystemNode, N64FilesystemNode, WiiFilesystemNode, POSIXFilesystemNode, DrivePOSIXFilesystemNode, RISCOSFilesystemNode, PSPFilesystemNode, KolibriOSFilesystemNode, and ChRootFilesystemNode.

◆ createReadStreamForAltStream()

virtual Common::SeekableReadStream* AbstractFSNode::createReadStreamForAltStream ( Common::AltStreamType  altStreamType)
virtual

Creates a SeekableReadStream instance corresponding to an alternate stream of the file referred by this node. This assumes that the node actually refers to a readable file and the alt stream exists. If either is not the case, 0 is returned.

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

Reimplemented in POSIXFilesystemNode.

◆ createWriteStream()

virtual Common::SeekableWriteStream* AbstractFSNode::createWriteStream ( )
pure virtual

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.

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

Implemented in AddSAFFakeNode, AndroidSAFFilesystemNode, MorphOSFilesystemNode, AmigaOSFilesystemNode, LibRetroFilesystemNode, WindowsFilesystemNode, N64FilesystemNode, POSIXFilesystemNode, WiiFilesystemNode, DrivePOSIXFilesystemNode, RISCOSFilesystemNode, PSPFilesystemNode, KolibriOSFilesystemNode, and ChRootFilesystemNode.

◆ createDirectory()

virtual bool AbstractFSNode::createDirectory ( )
pure virtual

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