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

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

Issue 7399016: More trivial cleanupi of ppapi/c headers (Closed) Base URL: svn://chrome-svn/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
6 /* From ppb_file_ref.idl modified Wed Jul 13 16:43:20 2011. */
7
5 #ifndef PPAPI_C_PPB_FILE_REF_H_ 8 #ifndef PPAPI_C_PPB_FILE_REF_H_
6 #define PPAPI_C_PPB_FILE_REF_H_ 9 #define PPAPI_C_PPB_FILE_REF_H_
7 10
8 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/pp_file_info.h" 13 #include "ppapi/c/pp_file_info.h"
14 #include "ppapi/c/pp_macros.h"
11 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_stdint.h"
17 #include "ppapi/c/pp_time.h"
12 #include "ppapi/c/pp_var.h" 18 #include "ppapi/c/pp_var.h"
13 19
14 /** 20 /**
15 * @file 21 * @file
16 * This file defines the API to create a file reference or "weak pointer" to a 22 * This file defines the API to create a file reference or "weak pointer" to a
17 * file in a file system. 23 * file in a file system.
18 */ 24 */
19 25
20 #define PPB_FILEREF_INTERFACE_0_9 "PPB_FileRef;0.9"
21 #define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0"
22 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_0
23 26
24 /** 27 /**
25 * @addtogroup Interfaces 28 * @addtogroup Interfaces
26 * @{ 29 * @{
27 */ 30 */
28 /** 31 /**
29 * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in 32 * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in
30 * a file system. This struct contains a <code>PP_FileSystemType</code> 33 * a file system. This struct contains a <code>PP_FileSystemType</code>
31 * identifier and a file path string. 34 * identifier and a file path string.
32 */ 35 */
36 #define PPB_FILEREF_INTERFACE_0_9 "PPB_FileRef;0.9"
37 #define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0"
38 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_0
39
33 struct PPB_FileRef { 40 struct PPB_FileRef {
34 /** 41 /**
35 * Create() creates a weak pointer to a file in the given file system. File 42 * Create() creates a weak pointer to a file in the given file system. File
36 * paths are POSIX style. 43 * paths are POSIX style.
37 * 44 *
38 * @param[in] resource A <code>PP_Resource</code> corresponding to a file 45 * @param[in] resource A <code>PP_Resource</code> corresponding to a file
39 * system. 46 * system.
40 * @param[in] path A path to the file. 47 * @param[in] path A path to the file.
41 * 48 *
42 * @return A <code>PP_Resource</code> corresponding to a file reference if 49 * @return A <code>PP_Resource</code> corresponding to a file reference if
43 * successful or 0 if the path is malformed. 50 * successful or 0 if the path is malformed.
44 */ 51 */
45 PP_Resource (*Create)(PP_Resource file_system, const char* path); 52 PP_Resource (*Create)(PP_Resource file_system, const char* path);
46 /** 53 /**
47 * IsFileRef() determines if the provided resource is a file reference. 54 * IsFileRef() determines if the provided resource is a file reference.
48 * 55 *
49 * @param[in] resource A <code>PP_Resource</code> corresponding to a file 56 * @param[in] resource A <code>PP_Resource</code> corresponding to a file
50 * reference. 57 * reference.
51 * 58 *
52 * @return <code>PP_TRUE</code> if the resource is a 59 * @return <code>PP_TRUE</code> if the resource is a
53 * <code>PPB_FileRef</code>, <code>PP_FALSE</code> if the resource is 60 * <code>PPB_FileRef</code>, <code>PP_FALSE</code> if the resource is
54 * invalid or some type other than <code>PPB_FileRef</code>. 61 * invalid or some type other than <code>PPB_FileRef</code>.
55 */ 62 */
56 PP_Bool (*IsFileRef)(PP_Resource resource); 63 PP_Bool (*IsFileRef)(PP_Resource resource);
57
58 /** 64 /**
59 * GetFileSystemType() returns the type of the file system. 65 * GetFileSystemType() returns the type of the file system.
60 * 66 *
61 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 67 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
62 * reference. 68 * reference.
63 * 69 *
64 * @return A <code>PP_FileSystemType</code> with the file system type if 70 * @return A <code>PP_FileSystemType</code> with the file system type if
65 * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource 71 * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource
66 * is not a valid file reference. 72 * is not a valid file reference.
67 */ 73 */
68 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); 74 PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref);
69
70 /** 75 /**
71 * GetName() returns the name of the file. 76 * GetName() returns the name of the file.
72 * 77 *
73 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 78 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
74 * reference. 79 * reference.
75 * 80 *
76 * @return A <code>PP_Var</code> containing the name of the file. The value 81 * @return A <code>PP_Var</code> containing the name of the file. The value
77 * returned by this function does not include any path components (such as 82 * returned by this function does not include any path components (such as
78 * the name of the parent directory, for example). It is just the name of the 83 * the name of the parent directory, for example). It is just the name of the
79 * file. Use GetPath() to get the full file path. 84 * file. Use GetPath() to get the full file path.
80 */ 85 */
81 struct PP_Var (*GetName)(PP_Resource file_ref); 86 struct PP_Var (*GetName)(PP_Resource file_ref);
82
83 /** 87 /**
84 * GetPath() returns the absolute path of the file. 88 * GetPath() returns the absolute path of the file.
85 * 89 *
86 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 90 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
87 * reference. 91 * reference.
88 * 92 *
89 * @return A <code>PP_Var</code> containing the absolute path of the file. 93 * @return A <code>PP_Var</code> containing the absolute path of the file.
90 * This function fails if the file system type is 94 * This function fails if the file system type is
91 * <code>PP_FileSystemType_External</code>. 95 * <code>PP_FileSystemType_External</code>.
92 */ 96 */
93 struct PP_Var (*GetPath)(PP_Resource file_ref); 97 struct PP_Var (*GetPath)(PP_Resource file_ref);
94
95 /** 98 /**
96 * GetParent() returns the parent directory of this file. If 99 * GetParent() returns the parent directory of this file. If
97 * <code>file_ref</code> points to the root of the filesystem, then the root 100 * <code>file_ref</code> points to the root of the filesystem, then the root
98 * is returned. 101 * is returned.
99 * 102 *
100 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 103 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
101 * reference. 104 * reference.
102 * 105 *
103 * @return A <code>PP_Resource</code> containing the parent directory of the 106 * @return A <code>PP_Resource</code> containing the parent directory of the
104 * file. This function fails if the file system type is 107 * file. This function fails if the file system type is
105 * <code>PP_FileSystemType_External</code>. 108 * <code>PP_FileSystemType_External</code>.
106 */ 109 */
107 PP_Resource (*GetParent)(PP_Resource file_ref); 110 PP_Resource (*GetParent)(PP_Resource file_ref);
108
109 /** 111 /**
110 * MakeDirectory() makes a new directory in the file system as well as any 112 * MakeDirectory() makes a new directory in the file system as well as any
111 * parent directories if the <code>make_ancestors</code> argument is 113 * parent directories if the <code>make_ancestors</code> argument is
112 * <code>PP_TRUE</code>. It is not valid to make a directory in the external 114 * <code>PP_TRUE</code>. It is not valid to make a directory in the external
113 * file system. 115 * file system.
114 * 116 *
115 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 117 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
116 * reference. 118 * reference.
117 * @param[in] make_ancestors A <code>PP_Bool</code> set to 119 * @param[in] make_ancestors A <code>PP_Bool</code> set to
118 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code> 120 * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code>
119 * if ancestor directories are not needed. 121 * if ancestor directories are not needed.
120 * 122 *
121 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 123 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
122 * Fails if the directory already exists or if ancestor directories do not 124 * Fails if the directory already exists or if ancestor directories do not
123 * exist and <code>make_ancestors</code> was not passed as 125 * exist and <code>make_ancestors</code> was not passed as
124 * <code>PP_TRUE</code>. 126 * <code>PP_TRUE</code>.
125 */ 127 */
126 int32_t (*MakeDirectory)(PP_Resource directory_ref, 128 int32_t (*MakeDirectory)(PP_Resource directory_ref,
127 PP_Bool make_ancestors, 129 PP_Bool make_ancestors,
128 struct PP_CompletionCallback callback); 130 struct PP_CompletionCallback callback);
129
130 /** 131 /**
131 * Touch() Updates time stamps for a file. You must have write access to the 132 * Touch() Updates time stamps for a file. You must have write access to the
132 * file if it exists in the external filesystem. 133 * file if it exists in the external filesystem.
133 * 134 *
134 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 135 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
135 * reference. 136 * reference.
136 * @param[in] last_access_time The last time the file was accessed. 137 * @param[in] last_access_time The last time the file was accessed.
137 * @param[in] last_modified_time The last time the file was modified. 138 * @param[in] last_modified_time The last time the file was modified.
138 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 139 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
139 * completion of Touch(). 140 * completion of Touch().
140 * 141 *
141 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 142 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
142 */ 143 */
143 int32_t (*Touch)(PP_Resource file_ref, 144 int32_t (*Touch)(PP_Resource file_ref,
144 PP_Time last_access_time, 145 PP_Time last_access_time,
145 PP_Time last_modified_time, 146 PP_Time last_modified_time,
146 struct PP_CompletionCallback callback); 147 struct PP_CompletionCallback callback);
147
148 /** 148 /**
149 * Delete() deletes a file or directory. If <code>file_ref</code> refers to 149 * Delete() deletes a file or directory. If <code>file_ref</code> refers to
150 * a directory, then the directory must be empty. It is an error to delete a 150 * a directory, then the directory must be empty. It is an error to delete a
151 * file or directory that is in use. It is not valid to delete a file in 151 * file or directory that is in use. It is not valid to delete a file in
152 * the external file system. 152 * the external file system.
153 * 153 *
154 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 154 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
155 * reference. 155 * reference.
156 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 156 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
157 * completion of Delete(). 157 * completion of Delete().
158 * 158 *
159 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 159 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
160 */ 160 */
161 int32_t (*Delete)(PP_Resource file_ref, 161 int32_t (*Delete)(PP_Resource file_ref,
162 struct PP_CompletionCallback callback); 162 struct PP_CompletionCallback callback);
163
164 /** 163 /**
165 * Rename() renames a file or directory. Arguments <code>file_ref</code> and 164 * Rename() renames a file or directory. Arguments <code>file_ref</code> and
166 * <code>new_file_ref</code> must both refer to files in the same file 165 * <code>new_file_ref</code> must both refer to files in the same file
167 * system. It is an error to rename a file or directory that is in use. It 166 * system. It is an error to rename a file or directory that is in use. It
168 * is not valid to rename a file in the external file system. 167 * is not valid to rename a file in the external file system.
169 * 168 *
170 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file 169 * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
171 * reference. 170 * reference.
172 * @param[in] new_file_ref A <code>PP_Resource</code> corresponding to a new 171 * @param[in] new_file_ref A <code>PP_Resource</code> corresponding to a new
173 * file reference. 172 * file reference.
174 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 173 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
175 * completion of Rename(). 174 * completion of Rename().
176 * 175 *
177 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 176 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
178 */ 177 */
179 int32_t (*Rename)(PP_Resource file_ref, 178 int32_t (*Rename)(PP_Resource file_ref,
180 PP_Resource new_file_ref, 179 PP_Resource new_file_ref,
181 struct PP_CompletionCallback callback); 180 struct PP_CompletionCallback callback);
182 }; 181 };
183 /** 182 /**
184 * @} 183 * @}
185 */ 184 */
186 185
187 #endif /* PPAPI_C_PPB_FILE_REF_H_ */ 186 #endif /* PPAPI_C_PPB_FILE_REF_H_ */
188 187
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