Pepper_42_C++_interfaces
|
#include <file_ref.h>
Public Member Functions | |
FileRef () | |
FileRef (PP_Resource resource) | |
FileRef (PassRef, PP_Resource resource) | |
FileRef (const FileSystem &file_system, const char *path) | |
FileRef (const FileRef &other) | |
PP_FileSystemType | GetFileSystemType () const |
Var | GetName () const |
Var | GetPath () const |
FileRef | GetParent () const |
int32_t | MakeDirectory (int32_t make_directory_flags, const CompletionCallback &cc) |
int32_t | Touch (PP_Time last_access_time, PP_Time last_modified_time, const CompletionCallback &cc) |
int32_t | Delete (const CompletionCallback &cc) |
int32_t | Rename (const FileRef &new_file_ref, const CompletionCallback &cc) |
int32_t | Query (const CompletionCallbackWithOutput< PP_FileInfo > &callback) |
int32_t | ReadDirectoryEntries (const CompletionCallbackWithOutput< std::vector< DirectoryEntry > > &callback) |
![]() | |
Resource () | |
The default constructor. More... | |
Resource (const Resource &other) | |
virtual | ~Resource () |
Destructor. More... | |
Resource & | operator= (const Resource &other) |
bool | is_null () const |
PP_Resource | pp_resource () const |
PP_Resource | detach () |
Additional Inherited Members | |
![]() | |
Resource (PP_Resource resource) | |
Resource (PassRef, PP_Resource resource) | |
void | PassRefFromConstructor (PP_Resource resource) |
void | Clear () |
Sets this resource to null. This releases ownership of the resource. More... | |
The FileRef
class represents a "weak pointer" to a file in a file system.
Definition at line 27 of file file_ref.h.
|
inline |
Default constructor for creating an is_null() FileRef
object.
Definition at line 31 of file file_ref.h.
|
explicit |
A constructor used when you have an existing PP_Resource for a FileRef and which to create a C++ object that takes an additional reference to the resource.
[in] | resource | A PP_Resource corresponding to file reference. |
pp::FileRef::FileRef | ( | PassRef | , |
PP_Resource | resource | ||
) |
A constructor used when you have received a PP_Resource as a return value that has already been reference counted.
[in] | resource | A PP_Resource corresponding to file reference. |
pp::FileRef::FileRef | ( | const FileSystem & | file_system, |
const char * | path | ||
) |
A constructor that creates a weak pointer to a file in the given file system. File paths are POSIX style.
If the path
is malformed, the resulting FileRef
will have a null PP_Resource
.
[in] | file_system | A FileSystem corresponding to a file system type. |
[in] | path | A path to the file. Must begin with a '/' character. |
pp::FileRef::FileRef | ( | const FileRef & | other | ) |
int32_t pp::FileRef::Delete | ( | const CompletionCallback & | cc | ) |
Delete() deletes a file or directory. If file_ref
refers to a directory, then the directory must be empty. It is an error to delete a file or directory that is in use. It is not valid to delete a file in the external file system.
[in] | cc | A CompletionCallback to be called upon completion of Delete(). |
pp_errors.h
. PP_FileSystemType pp::FileRef::GetFileSystemType | ( | ) | const |
GetFileSystemType() returns the type of the file system.
PP_FileSystemType
with the file system type if valid or PP_FILESYSTEMTYPE_INVALID
if the provided resource is not a valid file reference. Var pp::FileRef::GetName | ( | ) | const |
FileRef pp::FileRef::GetParent | ( | ) | const |
GetParent() returns the parent directory of this file. If file_ref
points to the root of the filesystem, then the root is returned.
FileRef
containing the parent directory of the file. This function fails if the file system type is PP_FileSystemType_External
. Var pp::FileRef::GetPath | ( | ) | const |
int32_t pp::FileRef::MakeDirectory | ( | int32_t | make_directory_flags, |
const CompletionCallback & | cc | ||
) |
MakeDirectory() makes a new directory in the file system according to the given make_directory_flags
, which is a bit-mask of the PP_MakeDirectoryFlags
values. It is not valid to make a directory in the external file system.
[in] | make_directory_flags | A bit-mask of the PP_MakeDirectoryFlags values. See ppb_file_ref.h for more details. |
[in] | cc | A CompletionCallback to be called upon completion of MakeDirectory(). |
pp_errors.h
. int32_t pp::FileRef::Query | ( | const CompletionCallbackWithOutput< PP_FileInfo > & | callback | ) |
Query() queries info about a file or directory. You must have access to read this file or directory if it exists in the external filesystem.
[in] | callback | A CompletionCallbackWithOutput to be called upon completion of Query(). |
pp_errors.h
. int32_t pp::FileRef::ReadDirectoryEntries | ( | const CompletionCallbackWithOutput< std::vector< DirectoryEntry > > & | callback | ) |
ReadDirectoryEntries() Reads all entries in the directory.
[in] | cc | A CompletionCallbackWithOutput to be called upon completion of ReadDirectoryEntries(). On success, the directory entries will be passed to the given function. |
Normally you would use a CompletionCallbackFactory to allow callbacks to be bound to your class. See completion_callback_factory.h for more discussion on how to use this. Your callback will generally look like:
pp_errors.h
. int32_t pp::FileRef::Rename | ( | const FileRef & | new_file_ref, |
const CompletionCallback & | cc | ||
) |
Rename() renames a file or directory. Argument new_file_ref
must refer to files in the same file system as in this object. It is an error to rename a file or directory that is in use. It is not valid to rename a file in the external file system.
[in] | new_file_ref | A FileRef corresponding to a new file reference. |
[in] | cc | A CompletionCallback to be called upon completion of Rename(). |
pp_errors.h
. int32_t pp::FileRef::Touch | ( | PP_Time | last_access_time, |
PP_Time | last_modified_time, | ||
const CompletionCallback & | cc | ||
) |
Touch() Updates time stamps for a file. You must have write access to the file if it exists in the external filesystem.
[in] | last_access_time | The last time the file was accessed. |
[in] | last_modified_time | The last time the file was modified. |
[in] | cc | A CompletionCallback to be called upon completion of Touch(). |
pp_errors.h
.