
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) |
Detailed Description
The FileRef class represents a "weak pointer" to a file in a file system.
Constructor & Destructor Documentation
| pp::FileRef::FileRef | ( | ) | [inline] |
| pp::FileRef::FileRef | ( | PP_Resource | resource | ) | [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.
- Parameters:
[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.
- Parameters:
[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.
- Parameters:
[in] file_system A FileSystemcorresponding to a file system type.[in] path A path to the file. Must begin with a '/' character.
| pp::FileRef::FileRef | ( | const FileRef & | other | ) |
Member Function Documentation
| 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.
- Parameters:
[in] cc A CompletionCallbackto be called upon completion of Delete().
- Returns:
- An int32_t containing an error code from
pp_errors.h.
| PP_FileSystemType pp::FileRef::GetFileSystemType | ( | ) | const |
GetFileSystemType() returns the type of the file system.
- Returns:
- A
PP_FileSystemTypewith the file system type if valid orPP_FILESYSTEMTYPE_INVALIDif 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.
- Returns:
- A
FileRefcontaining the parent directory of the file. This function fails if the file system type isPP_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.
- Parameters:
[in] make_directory_flags A bit-mask of the PP_MakeDirectoryFlagsvalues. Seeppb_file_ref.hfor more details.[in] cc A CompletionCallbackto be called upon completion of MakeDirectory().
- Returns:
- An int32_t containing an error code from
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.
- Parameters:
[in] callback A CompletionCallbackWithOutputto be called upon completion of Query().
- Returns:
- An int32_t containing an error code from
pp_errors.h.
| int32_t pp::FileRef::ReadDirectoryEntries | ( | const CompletionCallbackWithOutput< std::vector< DirectoryEntry > > & | callback | ) |
ReadDirectoryEntries() Reads all entries in the directory.
- Parameters:
[in] cc A CompletionCallbackWithOutputto 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:
void OnReadDirectoryEntries( int32_t result, const std::vector<DirectoryEntry>& entries) { if (result == PP_OK) // use entries... }
- Returns:
- An int32_t containing an error code from
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.
- Parameters:
[in] new_file_ref A FileRefcorresponding to a new file reference.[in] cc A CompletionCallbackto be called upon completion of Rename().
- Returns:
- An int32_t containing an error code from
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.
- Parameters:
[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 CompletionCallbackto be called upon completion of Touch().
- Returns:
- An int32_t containing an error code from
pp_errors.h.
The documentation for this class was generated from the following file: