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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void WebIDBKey::assign(const WebIDBKey& value) | 79 void WebIDBKey::assign(const WebIDBKey& value) |
80 { | 80 { |
81 m_private = value.m_private; | 81 m_private = value.m_private; |
82 } | 82 } |
83 | 83 |
84 static PassRefPtr<IDBKey> convertFromWebIDBKeyArray(const WebVector<WebIDBKey>&
array) | 84 static PassRefPtr<IDBKey> convertFromWebIDBKeyArray(const WebVector<WebIDBKey>&
array) |
85 { | 85 { |
86 IDBKey::KeyArray keys; | 86 IDBKey::KeyArray keys; |
87 keys.reserveCapacity(array.size()); | 87 keys.reserveCapacity(array.size()); |
88 for (size_t i = 0; i < array.size(); ++i) { | 88 for (size_t i = 0; i < array.size(); ++i) { |
89 switch (array[i].type()) { | 89 switch (array[i].keyType()) { |
90 case WebIDBKey::ArrayType: | 90 case WebIDBKeyTypeArray: |
91 keys.append(convertFromWebIDBKeyArray(array[i].array())); | 91 keys.append(convertFromWebIDBKeyArray(array[i].array())); |
92 break; | 92 break; |
93 case WebIDBKey::StringType: | 93 case WebIDBKeyTypeString: |
94 keys.append(IDBKey::createString(array[i].string())); | 94 keys.append(IDBKey::createString(array[i].string())); |
95 break; | 95 break; |
96 case WebIDBKey::DateType: | 96 case WebIDBKeyTypeDate: |
97 keys.append(IDBKey::createDate(array[i].date())); | 97 keys.append(IDBKey::createDate(array[i].date())); |
98 break; | 98 break; |
99 case WebIDBKey::NumberType: | 99 case WebIDBKeyTypeNumber: |
100 keys.append(IDBKey::createNumber(array[i].number())); | 100 keys.append(IDBKey::createNumber(array[i].number())); |
101 break; | 101 break; |
102 case WebIDBKey::InvalidType: | 102 case WebIDBKeyTypeInvalid: |
103 keys.append(IDBKey::createInvalid()); | 103 keys.append(IDBKey::createInvalid()); |
104 break; | 104 break; |
105 case WebIDBKey::NullType: | 105 case WebIDBKeyTypeNull: |
106 case WebIDBKey::MinType: | 106 case WebIDBKeyTypeMin: |
107 ASSERT_NOT_REACHED(); | 107 ASSERT_NOT_REACHED(); |
108 break; | 108 break; |
109 } | 109 } |
110 } | 110 } |
111 return IDBKey::createArray(keys); | 111 return IDBKey::createArray(keys); |
112 } | 112 } |
113 | 113 |
114 static void convertToWebIDBKeyArray(const IDBKey::KeyArray& array, WebVector<Web
IDBKey>& result) | 114 static void convertToWebIDBKeyArray(const IDBKey::KeyArray& array, WebVector<Web
IDBKey>& result) |
115 { | 115 { |
116 WebVector<WebIDBKey> keys(array.size()); | 116 WebVector<WebIDBKey> keys(array.size()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void WebIDBKey::assignNull() | 170 void WebIDBKey::assignNull() |
171 { | 171 { |
172 m_private = 0; | 172 m_private = 0; |
173 } | 173 } |
174 | 174 |
175 void WebIDBKey::reset() | 175 void WebIDBKey::reset() |
176 { | 176 { |
177 m_private.reset(); | 177 m_private.reset(); |
178 } | 178 } |
179 | 179 |
| 180 WebIDBKeyType WebIDBKey::keyType() const |
| 181 { |
| 182 if (!m_private.get()) |
| 183 return WebIDBKeyTypeNull; |
| 184 return static_cast<WebIDBKeyType>(m_private->type()); |
| 185 } |
| 186 |
180 WebIDBKey::Type WebIDBKey::type() const | 187 WebIDBKey::Type WebIDBKey::type() const |
181 { | 188 { |
182 if (!m_private.get()) | 189 if (!m_private.get()) |
183 return NullType; | 190 return WebIDBKey::NullType; |
184 return Type(m_private->type()); | 191 return static_cast<WebIDBKey::Type>(m_private->type()); |
185 } | 192 } |
186 | 193 |
187 bool WebIDBKey::isValid() const | 194 bool WebIDBKey::isValid() const |
188 { | 195 { |
189 if (!m_private.get()) | 196 if (!m_private.get()) |
190 return false; | 197 return false; |
191 return m_private->isValid(); | 198 return m_private->isValid(); |
192 } | 199 } |
193 | 200 |
194 WebVector<WebIDBKey> WebIDBKey::array() const | 201 WebVector<WebIDBKey> WebIDBKey::array() const |
(...skipping 28 matching lines...) Expand all Loading... |
223 m_private = value; | 230 m_private = value; |
224 return *this; | 231 return *this; |
225 } | 232 } |
226 | 233 |
227 WebIDBKey::operator PassRefPtr<IDBKey>() const | 234 WebIDBKey::operator PassRefPtr<IDBKey>() const |
228 { | 235 { |
229 return m_private.get(); | 236 return m_private.get(); |
230 } | 237 } |
231 | 238 |
232 } // namespace WebKit | 239 } // namespace WebKit |
OLD | NEW |