OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ | 5 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ |
6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ | 6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class CONTENT_EXPORT IndexedDBKey { | 22 class CONTENT_EXPORT IndexedDBKey { |
23 public: | 23 public: |
24 typedef std::vector<IndexedDBKey> KeyArray; | 24 typedef std::vector<IndexedDBKey> KeyArray; |
25 | 25 |
26 IndexedDBKey(); // Defaults to WebKit::WebIDBKeyTypeInvalid. | 26 IndexedDBKey(); // Defaults to WebKit::WebIDBKeyTypeInvalid. |
27 IndexedDBKey(WebKit::WebIDBKeyType); // must be Null or Invalid | 27 IndexedDBKey(WebKit::WebIDBKeyType); // must be Null or Invalid |
28 explicit IndexedDBKey(const KeyArray& array); | 28 explicit IndexedDBKey(const KeyArray& array); |
29 explicit IndexedDBKey(const string16& str); | 29 explicit IndexedDBKey(const string16& str); |
30 IndexedDBKey(double number, | 30 IndexedDBKey(double number, |
31 WebKit::WebIDBKeyType type); // must be date or number | 31 WebKit::WebIDBKeyType type); // must be date or number |
32 explicit IndexedDBKey(const WebKit::WebIDBKey& key); | |
33 ~IndexedDBKey(); | 32 ~IndexedDBKey(); |
34 | 33 |
35 bool IsValid() const; | 34 bool IsValid() const; |
36 | 35 |
37 int Compare(const IndexedDBKey& other) const; | 36 int Compare(const IndexedDBKey& other) const; |
38 bool IsLessThan(const IndexedDBKey& other) const; | 37 bool IsLessThan(const IndexedDBKey& other) const; |
39 bool IsEqual(const IndexedDBKey& other) const; | 38 bool IsEqual(const IndexedDBKey& other) const; |
40 | 39 |
41 WebKit::WebIDBKeyType type() const { return type_; } | 40 WebKit::WebIDBKeyType type() const { return type_; } |
42 const std::vector<IndexedDBKey>& array() const { return array_; } | 41 const std::vector<IndexedDBKey>& array() const { return array_; } |
43 const string16& string() const { return string_; } | 42 const string16& string() const { return string_; } |
44 double date() const { return date_; } | 43 double date() const { return date_; } |
45 double number() const { return number_; } | 44 double number() const { return number_; } |
46 | 45 |
47 operator WebKit::WebIDBKey() const; | |
48 size_t size_estimate() const { return size_estimate_; } | 46 size_t size_estimate() const { return size_estimate_; } |
49 | 47 |
50 private: | 48 private: |
51 WebKit::WebIDBKeyType type_; | 49 WebKit::WebIDBKeyType type_; |
52 std::vector<IndexedDBKey> array_; | 50 std::vector<IndexedDBKey> array_; |
53 string16 string_; | 51 string16 string_; |
54 double date_; | 52 double date_; |
55 double number_; | 53 double number_; |
56 | 54 |
57 size_t size_estimate_; | 55 size_t size_estimate_; |
58 }; | 56 }; |
59 | 57 |
60 } // namespace content | 58 } // namespace content |
61 | 59 |
62 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ | 60 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ |
OLD | NEW |