Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: ppapi/c/ppb_file_ref.h

Issue 7314007: All new file i/o documentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/ppb_file_io.h ('k') | ppapi/c/ppb_file_system.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 #ifndef PPAPI_C_PPB_FILE_REF_H_ 5 #ifndef PPAPI_C_PPB_FILE_REF_H_
6 #define PPAPI_C_PPB_FILE_REF_H_ 6 #define PPAPI_C_PPB_FILE_REF_H_
7 7
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_file_info.h" 9 #include "ppapi/c/pp_file_info.h"
10 #include "ppapi/c/pp_instance.h" 10 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_resource.h" 11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_var.h" 12 #include "ppapi/c/pp_var.h"
13 13
14 /**
15 * @file
16 * This file defines the API to create a file reference or "weak pointer" to a
17 * file in a file system.
18 */
19
14 struct PP_CompletionCallback; 20 struct PP_CompletionCallback;
15 21
16 #define PPB_FILEREF_INTERFACE_0_9 "PPB_FileRef;0.9" 22 #define PPB_FILEREF_INTERFACE_0_9 "PPB_FileRef;0.9"
17 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_0_9 23 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_0_9
18 24
19 // A FileRef is a "weak pointer" to a file in a file system. It contains a 25 /**
20 // PP_FileSystemType identifier and a file path string. 26 * @addtogroup Structs
27 * @{
28 */
29 /**
30 * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in
31 * a file system. This struct contains a <code>PP_FileSystemType</code>
32 * identifier and a file path string.
33 */
21 struct PPB_FileRef { 34 struct PPB_FileRef {
22 // Creates a weak pointer to a file in the given filesystem. File paths are 35 /**
23 // POSIX style. Returns 0 if the path is malformed. 36 * Create() creates a weak pointer to a file in the given file system. File
37 * paths are POSIX style.
38 *
39 * @param[in] resource A <code>PP_Resource</code> corresponding to a file
40 * system.
41 * @param[in] path A path to the file.
42 *
43 * @return A <code>PP_Resource</code> corresponding to a file reference if
44 * successful or 0 if the path is malformed.
45 */
24 PP_Resource (*Create)(PP_Resource file_system, const char* path); 46 PP_Resource (*Create)(PP_Resource file_system, const char* path);
25 47 /**
26 // Returns PP_TRUE if the given resource is a FileRef. Returns PP_FALSE if the 48 * IsFileRef() determines if the provided resource is a file reference.
27 // resource is invalid or some type other than a FileRef. 49 *
50 * @param[in] resource A <code>PP_Resource</code> corresponding to a file
51 * reference.
52 *
53 * @return <code>PP_TRUE</code> if the resource is a
54 * <code>PPB_FileRef</code>, <code>PP_FALSE</code> if the resource is
55 * invalid or some type other than <code>PPB_FileRef</code>.
56 */
28 PP_Bool (*IsFileRef)(PP_Resource resource); 57 PP_Bool (*IsFileRef)(PP_Resource resource);
29 58
30 // Returns the file system identifier of this file, or 59 /**
31 // PP_FILESYSTEMTYPE_INVALID if the file ref is invalid. 60 * GetFileSystemType() returns the type of the file system.
61 *
62 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
63 * reference.
64 *
65 * @return A <code>PP_FileSystemType</code> with the file system type if
66 * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource
67 * is not a valid file reference.
68 */
32 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); 69 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref);
33 70
34 // Returns the name of the file. The value returned by this function does not 71 /**
35 // include any path component (such as the name of the parent directory, for 72 * GetName() returns the name of the file.
36 // example). It is just the name of the file. To get the full file path, use 73 *
37 // the GetPath() function. 74 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
75 * reference.
76 *
77 * @return A <code>PP_Var</code> containing the name of the file. The value
78 * returned by this function does not include any path components (such as
79 * the name of the parent directory, for example). It is just the name of the
80 * file. Use GetPath() get the full file path.
sanga 2011/07/06 23:20:59 "to get"
jond 2011/07/07 15:11:15 Done.
81 */
38 struct PP_Var (*GetName)(PP_Resource file_ref); 82 struct PP_Var (*GetName)(PP_Resource file_ref);
39 83
40 // Returns the absolute path of the file. This method fails if the file 84 /**
41 // system type is PP_FileSystemType_External. 85 * GetPath() returns the absolute path of the file.
86 *
87 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
88 * reference.
89 *
90 * @return A <code>PP_Var</code> containing the absolute path of the file.
91 * This function fails if the file system type is
92 * <code>PP_FileSystemType_External</code>.
93 */
42 struct PP_Var (*GetPath)(PP_Resource file_ref); 94 struct PP_Var (*GetPath)(PP_Resource file_ref);
43 95
44 // Returns the parent directory of this file. If file_ref points to the root 96 /**
45 // of the filesystem, then the root is returned. This method fails if the 97 * GetParent() returns the parent directory of this file. If
46 // file system type is PP_FileSystemType_External. 98 * <code>file_ref</code> points to the root of the filesystem, then the root
99 * is returned.
100 *
101 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
102 * reference.
103 *
104 * @return A <code>PP_Resource</code> containing the parent directory of the
105 * file. This function fails if the file system type is
106 * <code>PP_FileSystemType_External</code>.
107 */
47 PP_Resource (*GetParent)(PP_Resource file_ref); 108 PP_Resource (*GetParent)(PP_Resource file_ref);
48 109
49 // Makes a new directory in the filesystem as well as any parent directories 110 /**
50 // if the make_ancestors parameter is PP_TRUE. It is not valid to make a 111 * MakeDirectory() makes a new directory in the file system as well as any
51 // directory in the external filesystem. Fails if the directory already 112 * parent directories if the <code>make_ancestors</code> argument is
52 // exists or if ancestor directories do not exist and make_ancestors was not 113 * <code>PP_TRUE</code>. It is not valid to make a directory in the external
53 // passed as PP_TRUE. 114 * file system.
115 *
116 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
117 * reference.
118 * @param[in] make_ancestors A <code>PP_Bool</code> set to
119 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code>
120 * if ancestor directories are not needed.
121 *
122 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
123 * Fails if the directory already exists or if ancestor directories do not
124 * exist and <code>make_ancestors</code> was not passed as
125 * <code>PP_TRUE</code>.
126 */
54 int32_t (*MakeDirectory)(PP_Resource directory_ref, 127 int32_t (*MakeDirectory)(PP_Resource directory_ref,
55 PP_Bool make_ancestors, 128 PP_Bool make_ancestors,
56 struct PP_CompletionCallback callback); 129 struct PP_CompletionCallback callback);
57 130
58 // Updates timestamps for a file. You must have write access to the file if 131 /**
59 // it exists in the external filesystem. 132 * Touch() Updates time stamps for a file. You must have write access to the
133 * file if it exists in the external filesystem.
134 *
135 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
136 * reference.
137 * @param[in] last_access_time The last time the file was accessed.
138 * @param[in] last_modified_time The last time the file was modified.
139 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
140 * completion of Touch().
141 *
142 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
143 */
60 int32_t (*Touch)(PP_Resource file_ref, 144 int32_t (*Touch)(PP_Resource file_ref,
61 PP_Time last_access_time, 145 PP_Time last_access_time,
62 PP_Time last_modified_time, 146 PP_Time last_modified_time,
63 struct PP_CompletionCallback callback); 147 struct PP_CompletionCallback callback);
64 148
65 // Delete a file or directory. If file_ref refers to a directory, then the 149 /**
66 // directory must be empty. It is an error to delete a file or directory 150 * Delete() deletes a file or directory. If <code>file_ref</code> refers to
67 // that is in use. It is not valid to delete a file in the external 151 * a directory, then the directory must be empty. It is an error to delete a
68 // filesystem. 152 * file or directory that is in use. It is not valid to delete a file in
153 * the external file system.
154 *
155 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
156 * reference.
157 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
158 * completion of Delete().
159 *
160 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
161 */
69 int32_t (*Delete)(PP_Resource file_ref, 162 int32_t (*Delete)(PP_Resource file_ref,
70 struct PP_CompletionCallback callback); 163 struct PP_CompletionCallback callback);
71 164
72 // Rename a file or directory. file_ref and new_file_ref must both refer to 165 /**
73 // files in the same filesystem. It is an error to rename a file or 166 * Rename() renames a file or directory. Arguments <code>file_ref</code> and
74 // directory that is in use. It is not valid to rename a file in the 167 * <code>new_file_ref</code> must both refer to files in the same file
75 // external filesystem. 168 * system. It is an error to rename a file or directory that is in use. It
169 * is not valid to rename a file in the external file system.
170 *
171 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
172 * reference.
173 * @param[in] new_file_ref A <code>PP_Resource</code> corresponding to a new
174 * file reference.
175 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
176 * completion of Rename().
177 *
178 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
179 */
76 int32_t (*Rename)(PP_Resource file_ref, 180 int32_t (*Rename)(PP_Resource file_ref,
77 PP_Resource new_file_ref, 181 PP_Resource new_file_ref,
78 struct PP_CompletionCallback callback); 182 struct PP_CompletionCallback callback);
79 }; 183 };
184 /**
185 * @}
186 */
80 187
81 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ 188 #endif /* PPAPI_C_PPB_FILE_REF_H_ */
82 189
OLDNEW
« no previous file with comments | « ppapi/c/ppb_file_io.h ('k') | ppapi/c/ppb_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698