OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" |
15 | 15 |
16 class CONTENT_EXPORT IndexedDBKey { | 16 class CONTENT_EXPORT IndexedDBKey { |
17 public: | 17 public: |
18 IndexedDBKey(); // Defaults to WebKit::WebIDBKey::InvalidType. | 18 IndexedDBKey(); // Defaults to WebKit::WebIDBKey::InvalidType. |
19 explicit IndexedDBKey(const WebKit::WebIDBKey& key); | 19 explicit IndexedDBKey(const WebKit::WebIDBKey& key); |
20 ~IndexedDBKey(); | 20 ~IndexedDBKey(); |
21 | 21 |
| 22 void SetNull(); |
22 void SetInvalid(); | 23 void SetInvalid(); |
23 void SetArray(const std::vector<IndexedDBKey>& array); | 24 void SetArray(const std::vector<IndexedDBKey>& array); |
24 void SetString(const string16& string); | 25 void SetString(const string16& string); |
25 void SetDate(double date); | 26 void SetDate(double date); |
26 void SetNumber(double number); | 27 void SetNumber(double number); |
27 void Set(const WebKit::WebIDBKey& key); | 28 void Set(const WebKit::WebIDBKey& key); |
28 | 29 |
29 WebKit::WebIDBKey::Type type() const { return type_; } | 30 WebKit::WebIDBKey::Type type() const { return type_; } |
30 const std::vector<IndexedDBKey>& array() const { return array_; } | 31 const std::vector<IndexedDBKey>& array() const { return array_; } |
31 const string16& string() const { return string_; } | 32 const string16& string() const { return string_; } |
32 double date() const { return date_; } | 33 double date() const { return date_; } |
33 double number() const { return number_; } | 34 double number() const { return number_; } |
34 | 35 |
35 operator WebKit::WebIDBKey() const; | 36 operator WebKit::WebIDBKey() const; |
36 | 37 |
37 private: | 38 private: |
38 WebKit::WebIDBKey::Type type_; | 39 WebKit::WebIDBKey::Type type_; |
39 std::vector<IndexedDBKey> array_; | 40 std::vector<IndexedDBKey> array_; |
40 string16 string_; | 41 string16 string_; |
41 double date_; | 42 double date_; |
42 double number_; | 43 double number_; |
43 }; | 44 }; |
44 | 45 |
45 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ | 46 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ |
OLD | NEW |