blob: 78e3c17d3802c806511c7710a8836979a99c167d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_
#define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
struct PP_CompletionCallback;
struct PP_DirectoryEntry_Dev {
PP_Resource file_ref;
PP_FileType file_type;
};
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry_Dev, 8);
#define PPB_DIRECTORYREADER_DEV_INTERFACE_0_5 "PPB_DirectoryReader(Dev);0.5"
#define PPB_DIRECTORYREADER_DEV_INTERFACE PPB_DIRECTORYREADER_DEV_INTERFACE_0_5
struct PPB_DirectoryReader_Dev_0_5 {
// Creates a DirectoryReader for the given directory. Upon success, the
// corresponding directory is classified as "in use" by the resulting
// DirectoryReader object until such time as the DirectoryReader object is
// destroyed.
PP_Resource (*Create)(PP_Resource directory_ref);
// Returns PP_TRUE if the given resource is a DirectoryReader. Returns
// PP_FALSE if the resource is invalid or some type other than a
// DirectoryReader.
PP_Bool (*IsDirectoryReader)(PP_Resource resource);
// Reads the next entry in the directory. Returns PP_OK and sets
// entry->file_ref to 0 to indicate reaching the end of the directory. If
// entry->file_ref is non-zero when passed to GetNextEntry, it will be
// released before the next file_ref is stored.
//
// EXAMPLE USAGE:
//
// PP_Resource reader = reader_funcs->Create(dir_ref);
// PP_DirectoryEntry entry = {0};
// while ((reader_funcs->GetNextEntry(reader, &entry,
// PP_BlockUntilComplete()) == PP_OK) &&
// entry->file_ref) {
// ProcessDirectoryEntry(entry);
// }
// core_funcs->ReleaseResource(reader);
//
int32_t (*GetNextEntry)(PP_Resource directory_reader,
struct PP_DirectoryEntry_Dev* entry,
struct PP_CompletionCallback callback);
};
typedef struct PPB_DirectoryReader_Dev_0_5 PPB_DirectoryReader_Dev;
#endif /* PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ */
|