OLD | NEW |
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_CPP_FILE_REF_H_ | 5 #ifndef PPAPI_CPP_FILE_REF_H_ |
6 #define PPAPI_CPP_FILE_REF_H_ | 6 #define PPAPI_CPP_FILE_REF_H_ |
7 | 7 |
8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
9 #include "ppapi/c/ppb_file_ref.h" | 9 #include "ppapi/c/ppb_file_ref.h" |
10 #include "ppapi/cpp/resource.h" | 10 #include "ppapi/cpp/resource.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 /// a file system. | 23 /// a file system. |
24 class FileRef : public Resource { | 24 class FileRef : public Resource { |
25 public: | 25 public: |
26 /// Default constructor for creating an is_null() <code>FileRef</code> | 26 /// Default constructor for creating an is_null() <code>FileRef</code> |
27 /// object. | 27 /// object. |
28 FileRef() {} | 28 FileRef() {} |
29 | 29 |
30 /// A constructor used to create a <code>FileRef</code> and associate it with | 30 /// A constructor used to create a <code>FileRef</code> and associate it with |
31 /// the provided <code>Instance</code>. | 31 /// the provided <code>Instance</code>. |
32 /// | 32 /// |
33 /// @param[in] instance An <code>Instance</code>. | 33 /// @param[in] resource An <code>Instance</code>. |
34 explicit FileRef(PP_Resource resource); | 34 explicit FileRef(PP_Resource resource); |
35 | 35 |
36 /// A special structure used by the constructor that does not increment the | 36 /// A special structure used by the constructor that does not increment the |
37 /// reference count of the underlying file reference. | 37 /// reference count of the underlying file reference. |
38 struct PassRef {}; | 38 struct PassRef {}; |
39 | 39 |
40 /// A constructor used when you have received a PP_Resource as a return | 40 /// A constructor used when you have received a PP_Resource as a return |
41 /// value that has already been reference counted. | 41 /// value that has already been reference counted. |
42 /// | 42 /// |
43 /// @param[in] resource A PP_Resource corresponding to file reference. | 43 /// @param[in] resource A PP_Resource corresponding to file reference. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 /// @return A <code>FileRef</code> containing the parent directory of the | 85 /// @return A <code>FileRef</code> containing the parent directory of the |
86 /// file. This function fails if the file system type is | 86 /// file. This function fails if the file system type is |
87 /// <code>PP_FileSystemType_External</code>. | 87 /// <code>PP_FileSystemType_External</code>. |
88 FileRef GetParent() const; | 88 FileRef GetParent() const; |
89 | 89 |
90 /// MakeDirectory() makes a new directory in the file system. It is not | 90 /// MakeDirectory() makes a new directory in the file system. It is not |
91 /// valid to make a directory in the external file system. | 91 /// valid to make a directory in the external file system. |
92 /// <strong>Note:</strong> Use MakeDirectoryIncludingAncestors() to create | 92 /// <strong>Note:</strong> Use MakeDirectoryIncludingAncestors() to create |
93 /// parent directories. | 93 /// parent directories. |
94 /// | 94 /// |
95 /// @param[in] callback A <code>CompletionCallback</code> to be called upon | 95 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
96 /// completion of MakeDirectory(). | 96 /// completion of MakeDirectory(). |
97 /// | 97 /// |
98 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 98 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
99 /// Fails if the directory already exists. | 99 /// Fails if the directory already exists. |
100 int32_t MakeDirectory(const CompletionCallback& cc); | 100 int32_t MakeDirectory(const CompletionCallback& cc); |
101 | 101 |
102 /// MakeDirectoryIncludingAncestors() makes a new directory in the file | 102 /// MakeDirectoryIncludingAncestors() makes a new directory in the file |
103 /// system as well as any parent directories. It is not valid to make a | 103 /// system as well as any parent directories. It is not valid to make a |
104 /// directory in the external file system. | 104 /// directory in the external file system. |
105 /// | 105 /// |
106 /// @param[in] callback A <code>CompletionCallback</code> to be called upon | 106 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
107 /// completion of MakeDirectoryIncludingAncestors(). | 107 /// completion of MakeDirectoryIncludingAncestors(). |
108 /// | 108 /// |
109 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 109 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
110 /// Fails if the directory already exists. | 110 /// Fails if the directory already exists. |
111 int32_t MakeDirectoryIncludingAncestors(const CompletionCallback& cc); | 111 int32_t MakeDirectoryIncludingAncestors(const CompletionCallback& cc); |
112 | 112 |
113 /// Touch() Updates time stamps for a file. You must have write access to the | 113 /// Touch() Updates time stamps for a file. You must have write access to the |
114 /// file if it exists in the external filesystem. | 114 /// file if it exists in the external filesystem. |
115 /// | 115 /// |
116 /// @param[in] last_access_time The last time the file was accessed. | 116 /// @param[in] last_access_time The last time the file was accessed. |
117 /// @param[in] last_modified_time The last time the file was modified. | 117 /// @param[in] last_modified_time The last time the file was modified. |
118 /// @param[in] callback A <code>CompletionCallback</code> to be called upon | 118 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
119 /// completion of Touch(). | 119 /// completion of Touch(). |
120 /// | 120 /// |
121 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 121 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
122 int32_t Touch(PP_Time last_access_time, | 122 int32_t Touch(PP_Time last_access_time, |
123 PP_Time last_modified_time, | 123 PP_Time last_modified_time, |
124 const CompletionCallback& cc); | 124 const CompletionCallback& cc); |
125 | 125 |
126 /// Delete() deletes a file or directory. If <code>file_ref</code> refers to | 126 /// Delete() deletes a file or directory. If <code>file_ref</code> refers to |
127 /// a directory, then the directory must be empty. It is an error to delete a | 127 /// a directory, then the directory must be empty. It is an error to delete a |
128 /// file or directory that is in use. It is not valid to delete a file in | 128 /// file or directory that is in use. It is not valid to delete a file in |
129 /// the external file system. | 129 /// the external file system. |
130 /// | 130 /// |
131 /// @param[in] callback A <code>CompletionCallback</code> to be called upon | 131 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
132 /// completion of Delete(). | 132 /// completion of Delete(). |
133 /// | 133 /// |
134 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 134 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
135 int32_t Delete(const CompletionCallback& cc); | 135 int32_t Delete(const CompletionCallback& cc); |
136 | 136 |
137 /// Rename() renames a file or directory. Argument <code>new_file_ref</code> | 137 /// Rename() renames a file or directory. Argument <code>new_file_ref</code> |
138 /// must refer to files in the same file system as in this object. It is an | 138 /// must refer to files in the same file system as in this object. It is an |
139 /// error to rename a file or directory that is in use. It is not valid to | 139 /// error to rename a file or directory that is in use. It is not valid to |
140 /// rename a file in the external file system. | 140 /// rename a file in the external file system. |
141 /// | 141 /// |
142 /// @param[in] new_file_ref A <code>FileRef</code> corresponding to a new | 142 /// @param[in] new_file_ref A <code>FileRef</code> corresponding to a new |
143 /// file reference. | 143 /// file reference. |
144 /// @param[in] callback A <code>CompletionCallback</code> to be called upon | 144 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
145 /// completion of Rename(). | 145 /// completion of Rename(). |
146 /// | 146 /// |
147 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 147 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
148 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); | 148 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace pp | 151 } // namespace pp |
152 | 152 |
153 #endif // PPAPI_CPP_FILE_REF_H_ | 153 #endif // PPAPI_CPP_FILE_REF_H_ |
OLD | NEW |