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_DEV_DIRECTORY_READER_DEV_H_ | 5 #ifndef PPAPI_CPP_DIRECTORY_READER_H_ |
6 #define PPAPI_CPP_DEV_DIRECTORY_READER_DEV_H_ | 6 #define PPAPI_CPP_DIRECTORY_READER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ppapi/c/dev/ppb_directory_reader_dev.h" | 10 #include "ppapi/c/ppb_directory_reader.h" |
11 #include "ppapi/cpp/resource.h" | 11 #include "ppapi/cpp/resource.h" |
12 | 12 |
| 13 /// @file |
| 14 /// This file defines the API used to read entries in a directory. |
| 15 |
13 namespace pp { | 16 namespace pp { |
14 | 17 |
15 class DirectoryEntry_Dev; | 18 class DirectoryEntry; |
16 class FileRef; | 19 class FileRef; |
17 template<typename T> class CompletionCallbackWithOutput; | 20 template<typename T> class CompletionCallbackWithOutput; |
18 | 21 |
19 class DirectoryReader_Dev : public Resource { | 22 /// The <code>DirectoryReader</code> class provides a function to read entries |
| 23 /// in a directory. |
| 24 class DirectoryReader : public Resource { |
20 public: | 25 public: |
21 /// A constructor that creates a DirectoryReader resource for the given | 26 /// A constructor that creates a <code>DirectoryReader</code> resource for the |
22 /// directory. | 27 /// given directory. |
23 /// | 28 /// |
24 /// @param[in] directory_ref A <code>PP_Resource</code> corresponding to the | 29 /// @param[in] directory_ref A <code>PP_Resource</code> corresponding to the |
25 /// directory reference to be read. | 30 /// directory reference to be read. |
26 explicit DirectoryReader_Dev(const FileRef& directory_ref); | 31 explicit DirectoryReader(const FileRef& directory_ref); |
27 | 32 |
28 DirectoryReader_Dev(const DirectoryReader_Dev& other); | 33 /// A copy constructor for <code>DirectoryEntry</code>. |
| 34 /// |
| 35 /// @return other A pointer to a <code>DirectoryReader</code>. |
| 36 DirectoryReader(const DirectoryReader& other); |
29 | 37 |
30 /// ReadEntries() Reads all entries in the directory. | 38 /// ReadEntries() Reads all entries in the directory. |
31 /// | 39 /// |
32 /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to be called | 40 /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to be called |
33 /// upon completion of ReadEntries(). On success, the directory entries will | 41 /// upon completion of ReadEntries(). On success, the directory entries will |
34 /// be passed to the given function. | 42 /// be passed to the given function. |
35 /// | 43 /// |
36 /// Normally you would use a CompletionCallbackFactory to allow callbacks to | 44 /// Normally you would use a CompletionCallbackFactory to allow callbacks to |
37 /// be bound to your class. See completion_callback_factory.h for more | 45 /// be bound to your class. See completion_callback_factory.h for more |
38 /// discussion on how to use this. Your callback will generally look like: | 46 /// discussion on how to use this. Your callback will generally look like: |
39 /// | 47 /// |
40 /// @code | 48 /// @code |
41 /// void OnReadEntries(int32_t result, | 49 /// void OnReadEntries(int32_t result, |
42 /// const std::vector<DirectoryEntry_Dev>& entries) { | 50 /// const std::vector<DirectoryEntry>& entries) { |
43 /// if (result == PP_OK) | 51 /// if (result == PP_OK) |
44 /// // use entries... | 52 /// // use entries... |
45 /// } | 53 /// } |
46 /// @endcode | 54 /// @endcode |
47 /// | 55 /// |
48 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 56 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
49 int32_t ReadEntries( | 57 int32_t ReadEntries( |
50 const CompletionCallbackWithOutput< std::vector<DirectoryEntry_Dev> >& | 58 const CompletionCallbackWithOutput< std::vector<DirectoryEntry> >& |
51 callback); | 59 callback); |
52 }; | 60 }; |
53 | 61 |
54 } // namespace pp | 62 } // namespace pp |
55 | 63 |
56 #endif // PPAPI_CPP_DIRECTORY_READER_H_ | 64 #endif // PPAPI_CPP_DIRECTORY_READER_H_ |
OLD | NEW |