summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h')
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h69
1 files changed, 63 insertions, 6 deletions
diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h b/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h
index d35a54393..12ecd4de3 100644
--- a/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h
+++ b/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IDBKeyRangeData_h
-#define IDBKeyRangeData_h
+#pragma once
#if ENABLE(INDEXED_DATABASE)
@@ -33,6 +32,8 @@
namespace WebCore {
+class IDBKey;
+
struct IDBKeyRangeData {
IDBKeyRangeData()
: isNull(true)
@@ -41,6 +42,18 @@ struct IDBKeyRangeData {
{
}
+ static IDBKeyRangeData allKeys()
+ {
+ IDBKeyRangeData result;
+ result.isNull = false;
+ result.lowerKey = IDBKeyData::minimum();
+ result.upperKey = IDBKeyData::maximum();
+ return result;
+ }
+
+ IDBKeyRangeData(IDBKey*);
+ IDBKeyRangeData(const IDBKeyData&);
+
IDBKeyRangeData(IDBKeyRange* keyRange)
: isNull(!keyRange)
, lowerOpen(false)
@@ -49,15 +62,22 @@ struct IDBKeyRangeData {
if (isNull)
return;
- lowerKey = keyRange->lower().get();
- upperKey = keyRange->upper().get();
+ lowerKey = keyRange->lower();
+ upperKey = keyRange->upper();
lowerOpen = keyRange->lowerOpen();
upperOpen = keyRange->upperOpen();
}
IDBKeyRangeData isolatedCopy() const;
- PassRefPtr<IDBKeyRange> maybeCreateIDBKeyRange() const;
+ WEBCORE_EXPORT RefPtr<IDBKeyRange> maybeCreateIDBKeyRange() const;
+
+ WEBCORE_EXPORT bool isExactlyOneKey() const;
+ bool containsKey(const IDBKeyData&) const;
+ bool isValid() const;
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static bool decode(Decoder&, IDBKeyRangeData&);
bool isNull;
@@ -66,9 +86,46 @@ struct IDBKeyRangeData {
bool lowerOpen;
bool upperOpen;
+
+#if !LOG_DISABLED
+ String loggingString() const;
+#endif
};
+template<class Encoder>
+void IDBKeyRangeData::encode(Encoder& encoder) const
+{
+ encoder << isNull;
+ if (isNull)
+ return;
+
+ encoder << upperKey << lowerKey << upperOpen << lowerOpen;
+}
+
+template<class Decoder>
+bool IDBKeyRangeData::decode(Decoder& decoder, IDBKeyRangeData& keyRange)
+{
+ if (!decoder.decode(keyRange.isNull))
+ return false;
+
+ if (keyRange.isNull)
+ return true;
+
+ if (!decoder.decode(keyRange.upperKey))
+ return false;
+
+ if (!decoder.decode(keyRange.lowerKey))
+ return false;
+
+ if (!decoder.decode(keyRange.upperOpen))
+ return false;
+
+ if (!decoder.decode(keyRange.lowerOpen))
+ return false;
+
+ return true;
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
-#endif // IDBKeyRangeData_h