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" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "third_party/WebKit/public/platform/WebIDBKey.h" | 14 #include "third_party/WebKit/public/platform/WebIDBTypes.h" |
| 15 |
| 16 namespace WebKit { |
| 17 class WebIDBKey; |
| 18 } |
15 | 19 |
16 namespace content { | 20 namespace content { |
17 | 21 |
18 class CONTENT_EXPORT IndexedDBKey { | 22 class CONTENT_EXPORT IndexedDBKey { |
19 public: | 23 public: |
20 typedef std::vector<IndexedDBKey> KeyArray; | 24 typedef std::vector<IndexedDBKey> KeyArray; |
21 | 25 |
22 IndexedDBKey(); // Defaults to WebKit::WebIDBKey::InvalidType. | 26 IndexedDBKey(); // Defaults to WebKit::WebIDBKeyTypeInvalid. |
23 IndexedDBKey(WebKit::WebIDBKey::Type); // must be Null or Invalid | 27 IndexedDBKey(WebKit::WebIDBKeyType); // must be Null or Invalid |
24 explicit IndexedDBKey(const KeyArray& array); | 28 explicit IndexedDBKey(const KeyArray& array); |
25 explicit IndexedDBKey(const string16& str); | 29 explicit IndexedDBKey(const string16& str); |
26 IndexedDBKey(double number, | 30 IndexedDBKey(double number, |
27 WebKit::WebIDBKey::Type type); // must be date or number | 31 WebKit::WebIDBKeyType type); // must be date or number |
28 explicit IndexedDBKey(const WebKit::WebIDBKey& key); | 32 explicit IndexedDBKey(const WebKit::WebIDBKey& key); |
29 ~IndexedDBKey(); | 33 ~IndexedDBKey(); |
30 | 34 |
31 bool IsValid() const; | 35 bool IsValid() const; |
32 | 36 |
33 int Compare(const IndexedDBKey& other) const; | 37 int Compare(const IndexedDBKey& other) const; |
34 bool IsLessThan(const IndexedDBKey& other) const; | 38 bool IsLessThan(const IndexedDBKey& other) const; |
35 bool IsEqual(const IndexedDBKey& other) const; | 39 bool IsEqual(const IndexedDBKey& other) const; |
36 | 40 |
37 WebKit::WebIDBKey::Type type() const { return type_; } | 41 WebKit::WebIDBKeyType type() const { return type_; } |
38 const std::vector<IndexedDBKey>& array() const { return array_; } | 42 const std::vector<IndexedDBKey>& array() const { return array_; } |
39 const string16& string() const { return string_; } | 43 const string16& string() const { return string_; } |
40 double date() const { return date_; } | 44 double date() const { return date_; } |
41 double number() const { return number_; } | 45 double number() const { return number_; } |
42 | 46 |
43 operator WebKit::WebIDBKey() const; | 47 operator WebKit::WebIDBKey() const; |
44 size_t size_estimate() const { return size_estimate_; } | 48 size_t size_estimate() const { return size_estimate_; } |
45 | 49 |
46 private: | 50 private: |
47 WebKit::WebIDBKey::Type type_; | 51 WebKit::WebIDBKeyType type_; |
48 std::vector<IndexedDBKey> array_; | 52 std::vector<IndexedDBKey> array_; |
49 string16 string_; | 53 string16 string_; |
50 double date_; | 54 double date_; |
51 double number_; | 55 double number_; |
52 | 56 |
53 size_t size_estimate_; | 57 size_t size_estimate_; |
54 }; | 58 }; |
55 | 59 |
56 } // namespace content | 60 } // namespace content |
57 | 61 |
58 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ | 62 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ |
OLD | NEW |