ScummVM API documentation
AndroidSAFFilesystemNode Class Referencefinal

#include <android-saf-fs.h>

Inheritance diagram for AndroidSAFFilesystemNode:
AbstractFSNode AndroidFSNode

Public Member Functions

 AndroidSAFFilesystemNode (const AndroidSAFFilesystemNode &node)
 
 ~AndroidSAFFilesystemNode () override
 
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
 
AbstractFSNodegetChild (const Common::String &n) const override
 
bool getChildren (AbstractFSList &list, ListMode mode, bool hidden) const override
 
AbstractFSNodegetParent () const override
 
Common::SeekableReadStreamcreateReadStream () override
 
Common::SeekableWriteStreamcreateWriteStream (bool atomic) override
 
bool createDirectory () override
 
bool remove () override
 
void removeTree ()
 
- Public Member Functions inherited from AbstractFSNode
virtual ~AbstractFSNode ()
 
virtual Common::SeekableReadStreamcreateReadStreamForAltStream (Common::AltStreamType altStreamType)
 

Static Public Member Functions

static void initJNI ()
 
static AndroidSAFFilesystemNodemakeFromPath (const Common::String &path)
 
static AndroidSAFFilesystemNodemakeFromTree (jobject safTree)
 
- Static Public Member Functions inherited from AbstractFSNode
static Common::FSNode makeFSNode (AbstractFSNode *realNode)
 

Static Public Attributes

static const char SAF_MOUNT_POINT []
 

Protected Member Functions

 AndroidSAFFilesystemNode (jobject safTree, jobject safNode)
 
 AndroidSAFFilesystemNode (jobject safTree, jobject safParent, const Common::String &path, const Common::String &name)
 
void cacheData ()
 

Protected Attributes

jobject _safTree
 
jobject _safNode
 
Common::String _path
 
int _flags
 
jobject _safParent
 
Common::String _newName
 

Static Protected Attributes

static jmethodID _MID_getTreeId
 
static jmethodID _MID_pathToNode
 
static jmethodID _MID_getChildren
 
static jmethodID _MID_getChild
 
static jmethodID _MID_createDirectory
 
static jmethodID _MID_createFile
 
static jmethodID _MID_createReadStream
 
static jmethodID _MID_createWriteStream
 
static jmethodID _MID_removeNode
 
static jmethodID _MID_removeTree
 
static jfieldID _FID__treeName
 
static jfieldID _FID__root
 
static jfieldID _FID__parent
 
static jfieldID _FID__path
 
static jfieldID _FID__documentId
 
static jfieldID _FID__flags
 
static bool _JNIinit
 
static const int DIRECTORY = 1
 
static const int WRITABLE = 2
 
static const int READABLE = 4
 

Additional Inherited Members

- 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

Implementation of the ScummVM file system API.

Parts of this class are documented in the base interface class, AbstractFSNode.

Constructor & Destructor Documentation

◆ AndroidSAFFilesystemNode() [1/3]

AndroidSAFFilesystemNode::AndroidSAFFilesystemNode ( jobject  safTree,
jobject  safNode 
)
protected

Creates an AndroidSAFFilesystemNode given its tree and its node

Parameters
safTreeSAF root in Java side
safNodeSAF node in Java side

◆ AndroidSAFFilesystemNode() [2/3]

AndroidSAFFilesystemNode::AndroidSAFFilesystemNode ( const AndroidSAFFilesystemNode node)

Copy constructor.

Note
Needed because we keep references

◆ ~AndroidSAFFilesystemNode()

AndroidSAFFilesystemNode::~AndroidSAFFilesystemNode ( )
override

Destructor.

◆ AndroidSAFFilesystemNode() [3/3]

AndroidSAFFilesystemNode::AndroidSAFFilesystemNode ( jobject  safTree,
jobject  safParent,
const Common::String path,
const Common::String name 
)
protected

Creates an non-existent AndroidSAFFilesystemNode given its tree, parent node and name

Parameters
safTreeSAF root in Java side
safParentSAF parent node in Java side
pathParent path
nameItem name

Member Function Documentation

◆ initJNI()

static void AndroidSAFFilesystemNode::initJNI ( )
static

Init JNI parts related to SAF Called by AndroidFilesystemFactory::AndroidFilesystemFactory()

◆ makeFromPath()

static AndroidSAFFilesystemNode* AndroidSAFFilesystemNode::makeFromPath ( const Common::String path)
static

Creates an AndroidSAFFilesystemNode given its absolute path

Parameters
pathPath of the node

◆ makeFromTree()

static AndroidSAFFilesystemNode* AndroidSAFFilesystemNode::makeFromTree ( jobject  safTree)
static

Creates an AndroidSAFFilesystemNode given its tree object

Parameters
safTreeSAF root in Java side. Must be a local reference and must not be used after this call.

◆ getDisplayName()

Common::U32String AndroidSAFFilesystemNode::getDisplayName ( ) const
inlineoverridevirtual

Returns a human readable path string.

Note
By default, this method returns the value of getName().

Implements AbstractFSNode.

◆ getName()

Common::String AndroidSAFFilesystemNode::getName ( ) const
overridevirtual

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.

Implements AbstractFSNode.

◆ getPath()

Common::String AndroidSAFFilesystemNode::getPath ( ) const
overridevirtual

Returns the 'path' of the current node, usable in fopen().

Implements AbstractFSNode.

◆ isDirectory()

bool AndroidSAFFilesystemNode::isDirectory ( ) const
inlineoverridevirtual

Indicates whether this path refers to a directory or not.

Implements AbstractFSNode.

◆ isReadable()

bool AndroidSAFFilesystemNode::isReadable ( ) const
inlineoverridevirtual

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.

Implements AbstractFSNode.

◆ isWritable()

bool AndroidSAFFilesystemNode::isWritable ( ) const
inlineoverridevirtual

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.

Implements AbstractFSNode.

◆ getChild()

AbstractFSNode* AndroidSAFFilesystemNode::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.

Implements AbstractFSNode.

◆ getChildren()

bool AndroidSAFFilesystemNode::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).

Implements AbstractFSNode.

◆ getParent()

AbstractFSNode* AndroidSAFFilesystemNode::getParent ( ) const
overridevirtual

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

Implements AbstractFSNode.

◆ createReadStream()

Common::SeekableReadStream* AndroidSAFFilesystemNode::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

Implements AbstractFSNode.

◆ createWriteStream()

Common::SeekableWriteStream* AndroidSAFFilesystemNode::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

Implements AbstractFSNode.

◆ createDirectory()

bool AndroidSAFFilesystemNode::createDirectory ( )
overridevirtual

Creates a directory referred by this node.

Returns
true if the directory is created successfully

Implements AbstractFSNode.

◆ removeTree()

void AndroidSAFFilesystemNode::removeTree ( )

Removes the SAF tree. Only works on the root node


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