Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: base/values.h

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 class BASE_EXPORT ValueDeserializer { 524 class BASE_EXPORT ValueDeserializer {
525 public: 525 public:
526 virtual ~ValueDeserializer(); 526 virtual ~ValueDeserializer();
527 527
528 // This method deserializes the subclass-specific format into a Value object. 528 // This method deserializes the subclass-specific format into a Value object.
529 // If the return value is non-NULL, the caller takes ownership of returned 529 // If the return value is non-NULL, the caller takes ownership of returned
530 // Value. If the return value is NULL, and if error_code is non-NULL, 530 // Value. If the return value is NULL, and if error_code is non-NULL,
531 // error_code will be set with the underlying error. 531 // error_code will be set with the underlying error.
532 // If |error_message| is non-null, it will be filled in with a formatted 532 // If |error_message| is non-null, it will be filled in with a formatted
533 // error message including the location of the error if appropriate. 533 // error message including the location of the error if appropriate.
534 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; 534 virtual scoped_ptr<Value> Deserialize(int* error_code,
535 std::string* error_str) = 0;
535 }; 536 };
536 537
537 // Stream operator so Values can be used in assertion statements. In order that 538 // Stream operator so Values can be used in assertion statements. In order that
538 // gtest uses this operator to print readable output on test failures, we must 539 // gtest uses this operator to print readable output on test failures, we must
539 // override each specific type. Otherwise, the default template implementation 540 // override each specific type. Otherwise, the default template implementation
540 // is preferred over an upcast. 541 // is preferred over an upcast.
541 BASE_EXPORT std::ostream& operator<<(std::ostream& out, const Value& value); 542 BASE_EXPORT std::ostream& operator<<(std::ostream& out, const Value& value);
542 543
543 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out, 544 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out,
544 const FundamentalValue& value) { 545 const FundamentalValue& value) {
(...skipping 11 matching lines...) Expand all
556 } 557 }
557 558
558 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out, 559 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out,
559 const ListValue& value) { 560 const ListValue& value) {
560 return out << static_cast<const Value&>(value); 561 return out << static_cast<const Value&>(value);
561 } 562 }
562 563
563 } // namespace base 564 } // namespace base
564 565
565 #endif // BASE_VALUES_H_ 566 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « base/test/gtest_util.cc ('k') | chrome/browser/android/contextualsearch/contextual_search_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698