1/*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#if ENABLE(INDEXED_DATABASE)
29
30#include <wtf/EnumTraits.h>
31
32namespace WebCore {
33
34namespace IndexedDB {
35
36enum class TransactionState {
37 Active,
38 Inactive,
39 Committing,
40 Aborting,
41 Finished,
42};
43
44enum class CursorDirection {
45 Next,
46 Nextunique,
47 Prev,
48 Prevunique,
49};
50const unsigned CursorDirectionMaximum = 3;
51
52enum class CursorType {
53 KeyAndValue = 0,
54 KeyOnly = 1,
55};
56const unsigned CursorTypeMaximum = 1;
57
58enum class CursorSource {
59 Index,
60 ObjectStore,
61};
62
63enum class VersionNullness {
64 Null,
65 NonNull,
66};
67
68enum class ObjectStoreOverwriteMode {
69 Overwrite,
70 OverwriteForCursor,
71 NoOverwrite,
72};
73
74enum class IndexRecordType {
75 Key,
76 Value,
77};
78
79enum class ObjectStoreRecordType {
80 ValueOnly,
81 KeyOnly,
82};
83
84// In order of the least to the highest precedent in terms of sort order.
85enum KeyType {
86 Max = -1,
87 Invalid = 0,
88 Array,
89 Binary,
90 String,
91 Date,
92 Number,
93 Min,
94};
95
96enum class RequestType {
97 Open,
98 Delete,
99 Other,
100};
101
102enum class GetAllType {
103 Keys,
104 Values,
105};
106
107} // namespace IndexedDB
108
109} // namespace WebCore
110
111namespace WTF {
112
113template<> struct EnumTraits<WebCore::IndexedDB::ObjectStoreOverwriteMode> {
114 using values = EnumValues<
115 WebCore::IndexedDB::ObjectStoreOverwriteMode,
116 WebCore::IndexedDB::ObjectStoreOverwriteMode::Overwrite,
117 WebCore::IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor,
118 WebCore::IndexedDB::ObjectStoreOverwriteMode::NoOverwrite
119 >;
120};
121
122}
123
124#endif // ENABLED(INDEXED_DATABASE)
125