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 {
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 bool 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 bool remove()
override {
return false; }
268 void makeProxySAF()
const;
Common::SeekableReadStream * createReadStream() override
bool isWritable() const override
Definition: android-saf-fs.h:186
bool isReadable() const override
Definition: android-saf-fs.h:185
static AndroidSAFFilesystemNode * makeFromPath(const Common::String &path)
Definition: android-saf-fs.h:44
void reset()
Definition: ptr.h:278
Definition: android-saf-fs.h:37
bool isDirectory() const override
Definition: android-saf-fs.h:257
PointerType get() const
Definition: ptr.h:229
Common::SeekableWriteStream * createWriteStream(bool atomic) override
Definition: android-fs.h:29
AndroidSAFFilesystemNode(const GlobalRef &safTree, jobject safNode)
bool createDirectory() override
Definition: android-saf-fs.h:74
AbstractFSNode * getChild(const Common::String &n) const override
Definition: android-saf-fs.h:237
ListMode
Definition: fs.h:86
Common::String getName() const override
Common::String getPath() const override
Common::SeekableWriteStream * createWriteStream(bool atomic) override
Definition: android-saf-fs.h:262
AbstractFSNode * getParent() const override
bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override
Common::SeekableReadStream * createReadStream() override
Definition: android-saf-fs.h:261
bool createDirectory() override
Definition: android-saf-fs.h:264
Definition: abstract-fs.h:41
static AndroidSAFFilesystemNode * makeFromTree(jobject safTree)
Common::U32String getDisplayName() const override
Definition: android-saf-fs.h:181
bool isDirectory() const override
Definition: android-saf-fs.h:184