| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 Vector<char> encodeBool(bool); | 54 Vector<char> encodeBool(bool); |
| 55 bool decodeBool(const char* begin, const char* end); | 55 bool decodeBool(const char* begin, const char* end); |
| 56 Vector<char> encodeInt(int64_t); | 56 Vector<char> encodeInt(int64_t); |
| 57 int64_t decodeInt(const char* begin, const char* end); | 57 int64_t decodeInt(const char* begin, const char* end); |
| 58 Vector<char> encodeVarInt(int64_t); | 58 Vector<char> encodeVarInt(int64_t); |
| 59 const char* decodeVarInt(const char* p, const char* limit, int64_t& foundInt); | 59 const char* decodeVarInt(const char* p, const char* limit, int64_t& foundInt); |
| 60 Vector<char> encodeString(const String&); | 60 Vector<char> encodeString(const String&); |
| 61 String decodeString(const char* p, const char* end); | 61 String decodeString(const char* p, const char* end); |
| 62 Vector<char> encodeStringWithLength(const String&); | 62 Vector<char> encodeStringWithLength(const String&); |
| 63 const char* decodeStringWithLength(const char* p, const char* limit, String& fou
ndString); | 63 const char* decodeStringWithLength(const char* p, const char* limit, String& fou
ndString); |
| 64 int compareEncodedStringsWithLength(const char*& p, const char* limitP, const ch
ar*& q, const char* limitQ); | 64 int compareEncodedStringsWithLength(const char*& p, const char* limitP, const ch
ar*& q, const char* limitQ, bool& ok); |
| 65 Vector<char> encodeDouble(double); | 65 Vector<char> encodeDouble(double); |
| 66 const char* decodeDouble(const char* p, const char* limit, double*); | 66 const char* decodeDouble(const char* p, const char* limit, double*); |
| 67 void encodeIDBKey(const IDBKey&, Vector<char, DefaultInlineBufferSize>& into); | 67 void encodeIDBKey(const IDBKey&, Vector<char, DefaultInlineBufferSize>& into); |
| 68 Vector<char> encodeIDBKey(const IDBKey&); | 68 Vector<char> encodeIDBKey(const IDBKey&); |
| 69 const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found
Key); | 69 const char* decodeIDBKey(const char* p, const char* limit, RefPtr<IDBKey>& found
Key); |
| 70 const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch
ar>* result); | 70 const char* extractEncodedIDBKey(const char* start, const char* limit, Vector<ch
ar>* result); |
| 71 int compareEncodedIDBKeys(const Vector<char>&, const Vector<char>&); | 71 int compareEncodedIDBKeys(const Vector<char>&, const Vector<char>&, bool& ok); |
| 72 Vector<char> encodeIDBKeyPath(const IDBKeyPath&); | 72 Vector<char> encodeIDBKeyPath(const IDBKeyPath&); |
| 73 IDBKeyPath decodeIDBKeyPath(const char*, const char*); | 73 IDBKeyPath decodeIDBKeyPath(const char*, const char*); |
| 74 | 74 |
| 75 int compare(const LevelDBSlice&, const LevelDBSlice&, bool indexKeys = false); | 75 int compare(const LevelDBSlice&, const LevelDBSlice&, bool indexKeys = false); |
| 76 | 76 |
| 77 class KeyPrefix { | 77 class KeyPrefix { |
| 78 public: | 78 public: |
| 79 KeyPrefix(); | 79 KeyPrefix(); |
| 80 KeyPrefix(int64_t databaseId, int64_t objectStoreId, int64_t indexId); | 80 KeyPrefix(int64_t databaseId, int64_t objectStoreId, int64_t indexId); |
| 81 | 81 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 private: | 264 private: |
| 265 int64_t m_objectStoreId; | 265 int64_t m_objectStoreId; |
| 266 String m_indexName; | 266 String m_indexName; |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 class ObjectStoreDataKey { | 269 class ObjectStoreDataKey { |
| 270 public: | 270 public: |
| 271 static const char* decode(const char* start, const char* end, ObjectStoreDat
aKey* result); | 271 static const char* decode(const char* start, const char* end, ObjectStoreDat
aKey* result); |
| 272 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
Vector<char> encodedUserKey); | 272 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
Vector<char> encodedUserKey); |
| 273 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
IDBKey& userKey); | 273 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
IDBKey& userKey); |
| 274 int compare(const ObjectStoreDataKey& other); | 274 int compare(const ObjectStoreDataKey& other, bool& ok); |
| 275 PassRefPtr<IDBKey> userKey() const; | 275 PassRefPtr<IDBKey> userKey() const; |
| 276 static const int64_t SpecialIndexNumber; | 276 static const int64_t SpecialIndexNumber; |
| 277 | 277 |
| 278 private: | 278 private: |
| 279 Vector<char> m_encodedUserKey; | 279 Vector<char> m_encodedUserKey; |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 class ExistsEntryKey { | 282 class ExistsEntryKey { |
| 283 public: | 283 public: |
| 284 static const char* decode(const char* start, const char* end, ExistsEntryKey
* result); | 284 static const char* decode(const char* start, const char* end, ExistsEntryKey
* result); |
| 285 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
Vector<char>& encodedKey); | 285 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
Vector<char>& encodedKey); |
| 286 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
IDBKey& userKey); | 286 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, const
IDBKey& userKey); |
| 287 int compare(const ExistsEntryKey& other); | 287 int compare(const ExistsEntryKey& other, bool& ok); |
| 288 PassRefPtr<IDBKey> userKey() const; | 288 PassRefPtr<IDBKey> userKey() const; |
| 289 | 289 |
| 290 static const int64_t SpecialIndexNumber; | 290 static const int64_t SpecialIndexNumber; |
| 291 | 291 |
| 292 private: | 292 private: |
| 293 Vector<char> m_encodedUserKey; | 293 Vector<char> m_encodedUserKey; |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 class IndexDataKey { | 296 class IndexDataKey { |
| 297 public: | 297 public: |
| 298 IndexDataKey(); | 298 IndexDataKey(); |
| 299 static const char* decode(const char* start, const char* limit, IndexDataKey
* result); | 299 static const char* decode(const char* start, const char* limit, IndexDataKey
* result); |
| 300 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, int64_
t indexId, const Vector<char>& encodedUserKey, const Vector<char>& encodedPrimar
yKey, int64_t sequenceNumber = 0); | 300 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, int64_
t indexId, const Vector<char>& encodedUserKey, const Vector<char>& encodedPrimar
yKey, int64_t sequenceNumber = 0); |
| 301 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, int64_
t indexId, const IDBKey& userKey); | 301 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, int64_
t indexId, const IDBKey& userKey); |
| 302 static Vector<char> encodeMinKey(int64_t databaseId, int64_t objectStoreId,
int64_t indexId); | 302 static Vector<char> encodeMinKey(int64_t databaseId, int64_t objectStoreId,
int64_t indexId); |
| 303 static Vector<char> encodeMaxKey(int64_t databaseId, int64_t objectStoreId,
int64_t indexId); | 303 static Vector<char> encodeMaxKey(int64_t databaseId, int64_t objectStoreId,
int64_t indexId); |
| 304 int compare(const IndexDataKey& other, bool ignoreDuplicates); | 304 int compare(const IndexDataKey& other, bool ignoreDuplicates, bool& ok); |
| 305 int64_t databaseId() const; | 305 int64_t databaseId() const; |
| 306 int64_t objectStoreId() const; | 306 int64_t objectStoreId() const; |
| 307 int64_t indexId() const; | 307 int64_t indexId() const; |
| 308 PassRefPtr<IDBKey> userKey() const; | 308 PassRefPtr<IDBKey> userKey() const; |
| 309 PassRefPtr<IDBKey> primaryKey() const; | 309 PassRefPtr<IDBKey> primaryKey() const; |
| 310 | 310 |
| 311 private: | 311 private: |
| 312 int64_t m_databaseId; | 312 int64_t m_databaseId; |
| 313 int64_t m_objectStoreId; | 313 int64_t m_objectStoreId; |
| 314 int64_t m_indexId; | 314 int64_t m_indexId; |
| 315 Vector<char> m_encodedUserKey; | 315 Vector<char> m_encodedUserKey; |
| 316 Vector<char> m_encodedPrimaryKey; | 316 Vector<char> m_encodedPrimaryKey; |
| 317 int64_t m_sequenceNumber; | 317 int64_t m_sequenceNumber; |
| 318 }; | 318 }; |
| 319 | 319 |
| 320 } // namespace IDBLevelDBCoding | 320 } // namespace IDBLevelDBCoding |
| 321 | 321 |
| 322 } // namespace WebCore | 322 } // namespace WebCore |
| 323 | 323 |
| 324 #endif // USE(LEVELDB) | 324 #endif // USE(LEVELDB) |
| 325 #endif // ENABLE(INDEXED_DATABASE) | 325 #endif // ENABLE(INDEXED_DATABASE) |
| 326 | 326 |
| 327 #endif // IDBLevelDBCoding_h | 327 #endif // IDBLevelDBCoding_h |
| OLD | NEW |