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

Side by Side Diff: base/values.h

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 TYPE_DOUBLE, 57 TYPE_DOUBLE,
58 TYPE_STRING, 58 TYPE_STRING,
59 TYPE_BINARY, 59 TYPE_BINARY,
60 TYPE_DICTIONARY, 60 TYPE_DICTIONARY,
61 TYPE_LIST 61 TYPE_LIST
62 // Note: Do not add more types. See the file-level comment above for why. 62 // Note: Do not add more types. See the file-level comment above for why.
63 }; 63 };
64 64
65 virtual ~Value(); 65 virtual ~Value();
66 66
67 static Value* CreateNullValue(); 67 static scoped_ptr<Value> CreateNullValue();
68 68
69 // Returns the type of the value stored by the current Value object. 69 // Returns the type of the value stored by the current Value object.
70 // Each type will be implemented by only one subclass of Value, so it's 70 // Each type will be implemented by only one subclass of Value, so it's
71 // safe to use the Type to determine whether you can cast from 71 // safe to use the Type to determine whether you can cast from
72 // Value* to (Implementing Class)*. Also, a Value object never changes 72 // Value* to (Implementing Class)*. Also, a Value object never changes
73 // its type after construction. 73 // its type after construction.
74 Type GetType() const { return type_; } 74 Type GetType() const { return type_; }
75 75
76 // Returns true if the current object represents a given type. 76 // Returns true if the current object represents a given type.
77 bool IsType(Type type) const { return type == type_; } 77 bool IsType(Type type) const { return type == type_; }
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 546 }
547 547
548 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out, 548 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out,
549 const ListValue& value) { 549 const ListValue& value) {
550 return out << static_cast<const Value&>(value); 550 return out << static_cast<const Value&>(value);
551 } 551 }
552 552
553 } // namespace base 553 } // namespace base
554 554
555 #endif // BASE_VALUES_H_ 555 #endif // BASE_VALUES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698