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