OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 16 matching lines...) Expand all Loading... |
27 #define IDBKeyRange_h | 27 #define IDBKeyRange_h |
28 | 28 |
29 #include "bindings/core/v8/Dictionary.h" | 29 #include "bindings/core/v8/Dictionary.h" |
30 #include "bindings/core/v8/ScriptWrappable.h" | 30 #include "bindings/core/v8/ScriptWrappable.h" |
31 #include "modules/indexeddb/IDBKey.h" | 31 #include "modules/indexeddb/IDBKey.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 class ExceptionState; | 35 class ExceptionState; |
36 | 36 |
37 class IDBKeyRange : public GarbageCollectedFinalized<IDBKeyRange>, public Script
Wrappable { | 37 class IDBKeyRange FINAL : public GarbageCollected<IDBKeyRange>, public ScriptWra
ppable { |
38 public: | 38 public: |
39 enum LowerBoundType { | 39 enum LowerBoundType { |
40 LowerBoundOpen, | 40 LowerBoundOpen, |
41 LowerBoundClosed | 41 LowerBoundClosed |
42 }; | 42 }; |
43 enum UpperBoundType { | 43 enum UpperBoundType { |
44 UpperBoundOpen, | 44 UpperBoundOpen, |
45 UpperBoundClosed | 45 UpperBoundClosed |
46 }; | 46 }; |
47 | 47 |
48 static IDBKeyRange* create(IDBKey* lower, IDBKey* upper, LowerBoundType lowe
rType, UpperBoundType upperType) | 48 static IDBKeyRange* create(IDBKey* lower, IDBKey* upper, LowerBoundType lowe
rType, UpperBoundType upperType) |
49 { | 49 { |
50 return new IDBKeyRange(lower, upper, lowerType, upperType); | 50 return new IDBKeyRange(lower, upper, lowerType, upperType); |
51 } | 51 } |
52 // Null if the script value is null or undefined, the range if it is one, ot
herwise tries to convert to a key and throws if it fails. | 52 // Null if the script value is null or undefined, the range if it is one, ot
herwise tries to convert to a key and throws if it fails. |
53 static IDBKeyRange* fromScriptValue(ExecutionContext*, const ScriptValue&, E
xceptionState&); | 53 static IDBKeyRange* fromScriptValue(ExecutionContext*, const ScriptValue&, E
xceptionState&); |
54 | 54 |
55 ~IDBKeyRange() { } | |
56 void trace(Visitor*); | 55 void trace(Visitor*); |
57 | 56 |
58 // Implement the IDBKeyRange IDL | 57 // Implement the IDBKeyRange IDL |
59 IDBKey* lower() const { return m_lower.get(); } | 58 IDBKey* lower() const { return m_lower.get(); } |
60 IDBKey* upper() const { return m_upper.get(); } | 59 IDBKey* upper() const { return m_upper.get(); } |
61 | 60 |
62 ScriptValue lowerValue(ScriptState*) const; | 61 ScriptValue lowerValue(ScriptState*) const; |
63 ScriptValue upperValue(ScriptState*) const; | 62 ScriptValue upperValue(ScriptState*) const; |
64 bool lowerOpen() const { return m_lowerType == LowerBoundOpen; } | 63 bool lowerOpen() const { return m_lowerType == LowerBoundOpen; } |
65 bool upperOpen() const { return m_upperType == UpperBoundOpen; } | 64 bool upperOpen() const { return m_upperType == UpperBoundOpen; } |
(...skipping 10 matching lines...) Expand all Loading... |
76 | 75 |
77 Member<IDBKey> m_lower; | 76 Member<IDBKey> m_lower; |
78 Member<IDBKey> m_upper; | 77 Member<IDBKey> m_upper; |
79 LowerBoundType m_lowerType; | 78 LowerBoundType m_lowerType; |
80 UpperBoundType m_upperType; | 79 UpperBoundType m_upperType; |
81 }; | 80 }; |
82 | 81 |
83 } // namespace blink | 82 } // namespace blink |
84 | 83 |
85 #endif // IDBKeyRange_h | 84 #endif // IDBKeyRange_h |
OLD | NEW |