Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ppapi / cpp / dev / directory_reader_dev.h
blobcd2ce781372be011dd523e1e2973de8fc1b8f3e1
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.
5 #ifndef PPAPI_CPP_DEV_DIRECTORY_READER_DEV_H_
6 #define PPAPI_CPP_DEV_DIRECTORY_READER_DEV_H_
8 #include <vector>
10 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
11 #include "ppapi/cpp/resource.h"
13 namespace pp {
15 class DirectoryEntry_Dev;
16 class FileRef;
17 template<typename T> class CompletionCallbackWithOutput;
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);
28 DirectoryReader_Dev(const DirectoryReader_Dev& other);
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);
54 } // namespace pp
56 #endif // PPAPI_CPP_DIRECTORY_READER_H_