Shaka Player Embedded
cursor.h
Go to the documentation of this file.
1 // Copyright 2016 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_JS_IDB_CURSOR_H_
16 #define SHAKA_EMBEDDED_JS_IDB_CURSOR_H_
17 
18 #include "shaka/optional.h"
19 #include "src/core/member.h"
20 #include "src/js/idb/idb_utils.h"
21 #include "src/mapping/any.h"
24 #include "src/mapping/enum.h"
26 
27 namespace shaka {
28 namespace js {
29 namespace idb {
30 
31 class IDBObjectStore;
32 class IDBRequest;
33 class IDBIterateCursorRequest;
34 
35 enum class IDBCursorDirection {
36  NEXT,
38  PREV,
40 };
41 
42 class IDBCursor : public BackingObject {
44 
45  public:
47 
48  void Trace(memory::HeapTracer* tracer) const override;
49 
53  // This is the key of the current record (aka position). We only iterate on
54  // object stores, so this is also the "effective key" and the primaryKey
55  // property.
58  bool got_value = false;
59 
60  ExceptionOr<void> Continue(optional<Any> key);
62 };
63 
64 class IDBCursorFactory : public BackingObjectFactory<IDBCursor> {
65  public:
67 };
68 
69 } // namespace idb
70 } // namespace js
71 } // namespace shaka
72 
74  AddMapping(Enum::NEXT, "next");
75  AddMapping(Enum::NEXT_UNIQUE, "nextunique");
76  AddMapping(Enum::PREV, "prev");
77  AddMapping(Enum::PREV_UNIQUE, "prevunique");
78 }
79 
80 #endif // SHAKA_EMBEDDED_JS_IDB_CURSOR_H_
Definition: any.h:31
const IDBCursorDirection direction
Definition: cursor.h:52
IDBCursorDirection
Definition: cursor.h:35
const char * source
Definition: media_utils.cc:30
const Member< IDBObjectStore > source
Definition: cursor.h:50
optional< IdbKeyType > key
Definition: cursor.h:56
Member< IDBIterateCursorRequest > request
Definition: cursor.h:51
DEFINE_ENUM_MAPPING(shaka::js::idb, IDBCursorDirection)
Definition: cursor.h:73
#define DECLARE_TYPE_INFO(type)