22#ifndef ANDROID_SAF_FILESYSTEM_H
23#define ANDROID_SAF_FILESYSTEM_H
27#include "backends/fs/abstract-fs.h"
28#include "common/ptr.h"
30#include "backends/fs/android/android-fs.h"
46 void operator()(_jobject *obj);
53 assert((jobj ==
nullptr) == (
get() ==
nullptr));
63 operator jobject()
const {
82 NodeRef(JNIEnv *env, jobject node) { reset(env, node); }
86 void reset(JNIEnv *env, jobject node);
93 bool operator==(
const NodeRef &r)
const {
94 return _ref == r._ref;
97 bool operator!=(
const NodeRef &r)
const {
98 return _ref != r._ref;
101 explicit operator bool()
const {
105 jlong get()
const {
return _ref; }
106 jobject localRef(JNIEnv *env)
const;
110 static jclass _CLS_SAFFSTree;
112 static jmethodID _MID_addNodeRef;
113 static jmethodID _MID_decNodeRef;
114 static jmethodID _MID_refToNode;
115 static jmethodID _MID_getTreeId;
116 static jmethodID _MID_pathToNode;
117 static jmethodID _MID_getChildren;
118 static jmethodID _MID_getChild;
119 static jmethodID _MID_createDirectory;
120 static jmethodID _MID_createFile;
121 static jmethodID _MID_createReadStream;
122 static jmethodID _MID_createWriteStream;
123 static jmethodID _MID_removeNode;
124 static jmethodID _MID_removeTree;
126 static jfieldID _FID__treeName;
127 static jfieldID _FID__root;
130 static jmethodID _MID_addRef;
132 static jfieldID _FID__parent;
133 static jfieldID _FID__path;
134 static jfieldID _FID__documentId;
135 static jfieldID _FID__flags;
137 static bool _JNIinit;
140 static const int DIRECTORY = 1;
141 static const int WRITABLE = 2;
142 static const int READABLE = 4;
158 static const char SAF_MOUNT_POINT[];
180 bool exists()
const override {
return (
bool)_safNode; }
185 bool isReadable()
const override {
return _flags & READABLE; }
186 bool isWritable()
const override {
return _flags & WRITABLE; }
196 int remove()
override;
234 void cacheData(JNIEnv *env, jobject node);
243 static const char SAF_ADD_FAKE_PATH[];
245 AddSAFFakeNode(
bool fromPath) : _proxied(nullptr), _fromPath(fromPath) { }
248 bool exists()
const override;
265 int remove()
override;
268 void makeProxySAF()
const;
Definition: abstract-fs.h:41
Definition: android-saf-fs.h:237
Common::SeekableReadStream * createReadStream() override
Definition: android-saf-fs.h:261
bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override
bool isWritable() const override
Common::String getPath() const override
Common::SeekableWriteStream * createWriteStream(bool atomic) override
Definition: android-saf-fs.h:262
bool isDirectory() const override
Definition: android-saf-fs.h:257
bool isReadable() const override
AbstractFSNode * getChild(const Common::String &name) const override
Common::U32String getDisplayName() const override
AbstractFSNode * getParent() const override
bool createDirectory() override
Definition: android-saf-fs.h:264
Common::String getName() const override
Definition: android-fs.h:29
Definition: android-saf-fs.h:44
Definition: android-saf-fs.h:74
Definition: android-saf-fs.h:37
Common::String getPath() const override
static AndroidSAFFilesystemNode * makeFromTree(jobject safTree)
AbstractFSNode * getParent() const override
AndroidSAFFilesystemNode(const GlobalRef &safTree, const NodeRef &safParent, const Common::String &path, const Common::String &name)
AndroidSAFFilesystemNode(const GlobalRef &safTree, jobject safParent, const Common::String &path, const Common::String &name)
bool isWritable() const override
Definition: android-saf-fs.h:186
bool createDirectory() override
AbstractFSNode * getChild(const Common::String &n) const override
AndroidSAFFilesystemNode(const GlobalRef &safTree, jobject safNode)
Common::U32String getDisplayName() const override
Definition: android-saf-fs.h:181
Common::SeekableWriteStream * createWriteStream(bool atomic) override
Common::String getName() const override
bool isReadable() const override
Definition: android-saf-fs.h:185
Common::SeekableReadStream * createReadStream() override
static AndroidSAFFilesystemNode * makeFromPath(const Common::String &path)
bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override
bool isDirectory() const override
Definition: android-saf-fs.h:184
ListMode
Definition: fs.h:86
PointerType get() const
Definition: ptr.h:229
void reset()
Definition: ptr.h:278