44 bool exists()
const {
return isJuceFlagSet (flagExists); }
66 return isJuceFlagSet (flagHasWritePermission)
68 && (isNativeFlagSet (flagSupportsWrite)
69 || isNativeFlagSet (flagSupportsDelete)
70 || isNativeFlagSet (flagDirSupportsCreate));
74 bool canDelete()
const {
return isNativeFlagSet (flagSupportsDelete); }
80 bool canRename()
const {
return isNativeFlagSet (flagSupportsRename); }
83 bool canCopy()
const {
return isNativeFlagSet (flagSupportsCopy); }
86 bool canMove()
const {
return isNativeFlagSet (flagSupportsMove); }
89 bool isVirtual()
const {
return isNativeFlagSet (flagVirtualDocument); }
127 bool isNativeFlagSet (
int flag)
const {
return (nativeFlags & flag) != 0; }
128 bool isJuceFlagSet (
int flag)
const {
return (juceFlags & flag) != 0; }
133 flagSupportsWrite = 0x0002,
134 flagSupportsDelete = 0x0004,
135 flagDirSupportsCreate = 0x0008,
136 flagSupportsRename = 0x0040,
137 flagSupportsCopy = 0x0080,
138 flagSupportsMove = 0x0100,
139 flagVirtualDocument = 0x0200,
146 flagValidModified = 1 << 1,
147 flagValidSize = 1 << 2,
148 flagHasReadPermission = 1 << 3,
149 flagHasWritePermission = 1 << 4,
154 int64 lastModified = 0;
155 int64 sizeInBytes = 0;
156 int nativeFlags = 0, juceFlags = 0;
204 bool read =
false, write =
false;
393 NativeInfo getNativeInfo()
const;
440 using pointer =
void;
Some information about a document.
bool canWrite() const
True if this is a document that can be written, or a directory that can be modified.
bool isLastModifiedValid() const
True if the filesystem provided a modification time.
String getType() const
The MIME type of this document.
bool canCreateChildren() const
True if this is a directory and adding child documents is supported.
int64 getLastModified() const
Timestamp when a document was last modified, in milliseconds since January 1, 1970 00:00:00....
bool exists() const
True if this file really exists.
bool canRename() const
True if this document can be renamed.
bool canDelete() const
True if this document can be removed completely from the filesystem.
String getName() const
The user-facing name.
bool isVirtual() const
True if this document isn't a physical file on storage.
bool canRead() const
True if this process has permission to read this file.
bool canMove() const
True if this document can be moved.
bool isFile() const
True if this is a file rather than a directory.
int64 getSizeInBytes() const
The size of the document in bytes, if known.
bool isSizeInBytesValid() const
True if the filesystem provided a size in bytes.
bool isDirectory() const
True if this is a directory rather than a file.
bool canCopy() const
True if this document can be copied.
An iterator that visits child documents in a directory.
AndroidDocument operator*() const
Returns the document to which this iterator points.
AndroidDocumentIterator begin() const
Allows this iterator to be used directly in a range-for.
static AndroidDocumentIterator makeRecursive(const AndroidDocument &)
Create an iterator that will visit each item in this directory, and all nested directories.
AndroidDocumentIterator & operator++()
Moves this iterator to the next position.
static AndroidDocumentIterator makeNonRecursive(const AndroidDocument &)
Create an iterator that will visit each item in this directory.
AndroidDocumentIterator end() const
Allows this iterator to be used directly in a range-for.
AndroidDocumentIterator()=default
Creates an end/sentinel iterator.
Represents a permission granted to an application to read and/or write to a particular document or tr...
bool isReadPermission() const
True if the permission allows read access.
URL getUrl() const
The url of the document with persisted permissions.
static void takePersistentReadWriteAccess(const URL &)
Gives your app access to a particular document or tree, even after the device is rebooted.
static void releasePersistentReadWriteAccess(const URL &)
Revokes persistent access to a document or tree.
bool isWritePermission() const
True if the permission allows write access.
int64 getPersistedTime() const
The time when the permissions were persisted, in milliseconds since January 1, 1970 00:00:00....
static std::vector< AndroidDocumentPermission > getPersistedPermissions()
Returns all of the permissions that have previously been granted to the app, via takePersistentReadWr...
Provides access to a document on Android devices.
static AndroidDocument fromFile(const File &filePath)
Create an AndroidDocument representing a file or directory at a particular path.
bool moveDocumentFromParentToParent(const AndroidDocument ¤tParent, const AndroidDocument &newParent)
Experimental: Attempts to move this document from one parent to another, and returns true on success.
AndroidDocument()
Create a null document.
AndroidDocumentInfo getInfo() const
Fetches information about this document.
std::unique_ptr< InputStream > createInputStream() const
Creates a stream for reading from this document.
static AndroidDocument fromTree(const URL &treeUrl)
Create an AndroidDocument representing the root of a tree of files.
AndroidDocument createChildDirectory(const String &name) const
Attempts to create a new nested directory with a particular name.
AndroidDocument copyDocumentToParentDocument(const AndroidDocument &target) const
Experimental: Attempts to copy this document to a new parent, and returns an AndroidDocument represen...
bool renameTo(const String &newDisplayName)
Renames the document, and returns true on success.
bool deleteDocument() const
Attempts to delete this document, and returns true on success.
bool hasValue() const
True if this object actually refers to a document.
AndroidDocument createChildDocumentWithTypeAndName(const String &type, const String &name) const
Attempts to create a new nested document with a particular type and name.
static AndroidDocument fromDocument(const URL &documentUrl)
Create an AndroidDocument representing a single document.
URL getUrl() const
Returns the content URL describing this document.
std::unique_ptr< OutputStream > createOutputStream() const
Creates a stream for writing to this document.
Represents a local file or directory.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
Represents a URL and has a bunch of useful functions to manipulate it.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
long long int64
A platform-independent 64-bit integer type.