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 // This file specifies a recursive data storage class called Value intended for | 5 // This file specifies a recursive data storage class called Value intended for |
6 // storing settings and other persistable data. | 6 // storing settings and other persistable data. |
7 // | 7 // |
8 // A Value represents something that can be stored in JSON or passed to/from | 8 // A Value represents something that can be stored in JSON or passed to/from |
9 // JavaScript. As such, it is NOT a generalized variant type, since only the | 9 // JavaScript. As such, it is NOT a generalized variant type, since only the |
10 // types supported by JavaScript/JSON are supported. | 10 // types supported by JavaScript/JSON are supported. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 bool GetBinary(const std::string& path, const BinaryValue** out_value) const; | 281 bool GetBinary(const std::string& path, const BinaryValue** out_value) const; |
282 bool GetBinary(const std::string& path, BinaryValue** out_value); | 282 bool GetBinary(const std::string& path, BinaryValue** out_value); |
283 bool GetDictionary(const std::string& path, | 283 bool GetDictionary(const std::string& path, |
284 const DictionaryValue** out_value) const; | 284 const DictionaryValue** out_value) const; |
285 bool GetDictionary(const std::string& path, DictionaryValue** out_value); | 285 bool GetDictionary(const std::string& path, DictionaryValue** out_value); |
286 bool GetList(const std::string& path, const ListValue** out_value) const; | 286 bool GetList(const std::string& path, const ListValue** out_value) const; |
287 bool GetList(const std::string& path, ListValue** out_value); | 287 bool GetList(const std::string& path, ListValue** out_value); |
288 | 288 |
289 // Like Get(), but without special treatment of '.'. This allows e.g. URLs to | 289 // Like Get(), but without special treatment of '.'. This allows e.g. URLs to |
290 // be used as paths. | 290 // be used as paths. |
291 bool GetWithoutPathExpansion(const std::string& key, | 291 bool GetWithoutPathExpansion( |
292 const Value** out_value) const; | 292 const std::string& key, |
293 bool GetWithoutPathExpansion(const std::string& key, Value** out_value); | 293 const Value** out_value) const WARN_UNUSED_RESULT; |
294 bool GetBooleanWithoutPathExpansion(const std::string& key, | 294 bool GetWithoutPathExpansion( |
295 bool* out_value) const; | 295 const std::string& key, Value** out_value) WARN_UNUSED_RESULT; |
296 bool GetIntegerWithoutPathExpansion(const std::string& key, | 296 bool GetBooleanWithoutPathExpansion( |
297 int* out_value) const; | 297 const std::string& key, |
298 bool GetDoubleWithoutPathExpansion(const std::string& key, | 298 bool* out_value) const WARN_UNUSED_RESULT; |
299 double* out_value) const; | 299 bool GetIntegerWithoutPathExpansion( |
300 bool GetStringWithoutPathExpansion(const std::string& key, | 300 const std::string& key, |
301 std::string* out_value) const; | 301 int* out_value) const WARN_UNUSED_RESULT; |
302 bool GetStringWithoutPathExpansion(const std::string& key, | 302 bool GetDoubleWithoutPathExpansion( |
303 string16* out_value) const; | 303 const std::string& key, |
| 304 double* out_value) const WARN_UNUSED_RESULT; |
| 305 bool GetStringWithoutPathExpansion( |
| 306 const std::string& key, |
| 307 std::string* out_value) const WARN_UNUSED_RESULT; |
| 308 bool GetStringWithoutPathExpansion( |
| 309 const std::string& key, |
| 310 string16* out_value) const WARN_UNUSED_RESULT; |
304 bool GetDictionaryWithoutPathExpansion( | 311 bool GetDictionaryWithoutPathExpansion( |
305 const std::string& key, | 312 const std::string& key, |
306 const DictionaryValue** out_value) const; | 313 const DictionaryValue** out_value) const WARN_UNUSED_RESULT; |
307 bool GetDictionaryWithoutPathExpansion(const std::string& key, | 314 bool GetDictionaryWithoutPathExpansion( |
308 DictionaryValue** out_value); | 315 const std::string& key, |
309 bool GetListWithoutPathExpansion(const std::string& key, | 316 DictionaryValue** out_value) WARN_UNUSED_RESULT; |
310 const ListValue** out_value) const; | 317 bool GetListWithoutPathExpansion( |
311 bool GetListWithoutPathExpansion(const std::string& key, | 318 const std::string& key, |
312 ListValue** out_value); | 319 const ListValue** out_value) const WARN_UNUSED_RESULT; |
| 320 bool GetListWithoutPathExpansion( |
| 321 const std::string& key, |
| 322 ListValue** out_value) WARN_UNUSED_RESULT; |
313 | 323 |
314 // Removes the Value with the specified path from this dictionary (or one | 324 // Removes the Value with the specified path from this dictionary (or one |
315 // of its child dictionaries, if the path is more than just a local key). | 325 // of its child dictionaries, if the path is more than just a local key). |
316 // If |out_value| is non-NULL, the removed Value will be passed out via | 326 // If |out_value| is non-NULL, the removed Value will be passed out via |
317 // |out_value|. If |out_value| is NULL, the removed value will be deleted. | 327 // |out_value|. If |out_value| is NULL, the removed value will be deleted. |
318 // This method returns true if |path| is a valid path; otherwise it will | 328 // This method returns true if |path| is a valid path; otherwise it will |
319 // return false and the DictionaryValue object will be unchanged. | 329 // return false and the DictionaryValue object will be unchanged. |
320 virtual bool Remove(const std::string& path, scoped_ptr<Value>* out_value); | 330 virtual bool Remove(const std::string& path, scoped_ptr<Value>* out_value); |
321 | 331 |
322 // Like Remove(), but without special treatment of '.'. This allows e.g. URLs | 332 // Like Remove(), but without special treatment of '.'. This allows e.g. URLs |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 537 |
528 } // namespace base | 538 } // namespace base |
529 | 539 |
530 // http://crbug.com/88666 | 540 // http://crbug.com/88666 |
531 using base::DictionaryValue; | 541 using base::DictionaryValue; |
532 using base::ListValue; | 542 using base::ListValue; |
533 using base::StringValue; | 543 using base::StringValue; |
534 using base::Value; | 544 using base::Value; |
535 | 545 |
536 #endif // BASE_VALUES_H_ | 546 #endif // BASE_VALUES_H_ |
OLD | NEW |