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_file_info.h" | 8 #include "ppapi/c/pp_file_info.h" |
9 #include "ppapi/c/pp_stdint.h" | 9 #include "ppapi/c/pp_stdint.h" |
10 #include "ppapi/c/ppb_file_ref.h" | 10 #include "ppapi/c/ppb_file_ref.h" |
11 #include "ppapi/cpp/resource.h" | 11 #include "ppapi/cpp/resource.h" |
12 #include "ppapi/cpp/var.h" | 12 #include "ppapi/cpp/var.h" |
13 | 13 |
14 /// @file | 14 /// @file |
15 /// This file defines the API to create a file reference or "weak pointer" to a | 15 /// This file defines the API to create a file reference or "weak pointer" to a |
16 /// file in a file system. | 16 /// file in a file system. |
17 | 17 |
18 namespace pp { | 18 namespace pp { |
19 | 19 |
20 class DirectoryEntry; | |
20 class FileSystem; | 21 class FileSystem; |
21 class CompletionCallback; | 22 class CompletionCallback; |
22 template <typename T> class CompletionCallbackWithOutput; | 23 template <typename T> class CompletionCallbackWithOutput; |
23 | 24 |
24 /// The <code>FileRef</code> class represents a "weak pointer" to a file in | 25 /// The <code>FileRef</code> class represents a "weak pointer" to a file in |
25 /// a file system. | 26 /// a file system. |
26 class FileRef : public Resource { | 27 class FileRef : public Resource { |
27 public: | 28 public: |
28 /// Default constructor for creating an is_null() <code>FileRef</code> | 29 /// Default constructor for creating an is_null() <code>FileRef</code> |
29 /// object. | 30 /// object. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 /// rename a file in the external file system. | 140 /// rename a file in the external file system. |
140 /// | 141 /// |
141 /// @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 |
142 /// file reference. | 143 /// file reference. |
143 /// @param[in] cc A <code>CompletionCallback</code> to be called upon | 144 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
144 /// completion of Rename(). | 145 /// completion of Rename(). |
145 /// | 146 /// |
146 /// @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>. |
147 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); | 148 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); |
148 | 149 |
149 /// | |
150 /// Query() queries info about a file or directory. You must have access to | 150 /// Query() queries info about a file or directory. You must have access to |
151 /// read this file or directory if it exists in the external filesystem. | 151 /// read this file or directory if it exists in the external filesystem. |
152 /// | 152 /// |
153 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> | 153 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> |
154 /// to be called upon completion of Query(). | 154 /// to be called upon completion of Query(). |
155 /// | 155 /// |
156 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 156 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
157 int32_t Query(const CompletionCallbackWithOutput<PP_FileInfo>& callback); | 157 int32_t Query(const CompletionCallbackWithOutput<PP_FileInfo>& callback); |
158 | |
159 /// ReadEntries() Reads all entries in the directory. | |
160 /// | |
161 /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to be called | |
162 /// upon completion of ReadEntries(). On success, the directory entries will | |
163 /// be passed to the given function. | |
164 /// | |
165 /// Normally you would use a CompletionCallbackFactory to allow callbacks to | |
166 /// be bound to your class. See completion_callback_factory.h for more | |
167 /// discussion on how to use this. Your callback will generally look like: | |
168 /// | |
169 /// @code | |
170 /// void OnReadEntries(int32_t result, | |
171 /// const std::vector<DirectoryEntry>& entries) { | |
172 /// if (result == PP_OK) | |
173 /// // use entries... | |
174 /// } | |
175 /// @endcode | |
176 /// | |
177 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
178 int32_t ReadEntries( | |
179 const CompletionCallbackWithOutput< std::vector<DirectoryEntry> >& | |
palmer
2013/05/03 00:07:24
Style nit: No space between < std
hamaji
2013/05/03 01:10:34
Done.
| |
180 callback); | |
158 }; | 181 }; |
159 | 182 |
160 } // namespace pp | 183 } // namespace pp |
161 | 184 |
162 #endif // PPAPI_CPP_FILE_REF_H_ | 185 #endif // PPAPI_CPP_FILE_REF_H_ |
OLD | NEW |