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

Side by Side Diff: tools/gn/value.cc

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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
« no previous file with comments | « tools/gn/value.h ('k') | tools/gn/value_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "tools/gn/value.h" 5 #include "tools/gn/value.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 Value::Value(const ParseNode* origin, const char* str_val) 51 Value::Value(const ParseNode* origin, const char* str_val)
52 : type_(STRING), 52 : type_(STRING),
53 string_value_(str_val), 53 string_value_(str_val),
54 boolean_value_(false), 54 boolean_value_(false),
55 int_value_(0), 55 int_value_(0),
56 origin_(origin) { 56 origin_(origin) {
57 } 57 }
58 58
59 Value::Value(const ParseNode* origin, scoped_ptr<Scope> scope) 59 Value::Value(const ParseNode* origin, std::unique_ptr<Scope> scope)
60 : type_(SCOPE), 60 : type_(SCOPE),
61 string_value_(), 61 string_value_(),
62 boolean_value_(false), 62 boolean_value_(false),
63 int_value_(0), 63 int_value_(0),
64 scope_value_(std::move(scope)), 64 scope_value_(std::move(scope)),
65 origin_(origin) {} 65 origin_(origin) {}
66 66
67 Value::Value(const Value& other) 67 Value::Value(const Value& other)
68 : type_(other.type_), 68 : type_(other.type_),
69 string_value_(other.string_value_), 69 string_value_(other.string_value_),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 case LIST: 104 case LIST:
105 return "list"; 105 return "list";
106 case SCOPE: 106 case SCOPE:
107 return "scope"; 107 return "scope";
108 default: 108 default:
109 NOTREACHED(); 109 NOTREACHED();
110 return "UNKNOWN"; 110 return "UNKNOWN";
111 } 111 }
112 } 112 }
113 113
114 void Value::SetScopeValue(scoped_ptr<Scope> scope) { 114 void Value::SetScopeValue(std::unique_ptr<Scope> scope) {
115 DCHECK(type_ == SCOPE); 115 DCHECK(type_ == SCOPE);
116 scope_value_ = std::move(scope); 116 scope_value_ = std::move(scope);
117 } 117 }
118 118
119 std::string Value::ToString(bool quote_string) const { 119 std::string Value::ToString(bool quote_string) const {
120 switch (type_) { 120 switch (type_) {
121 case NONE: 121 case NONE:
122 return "<void>"; 122 return "<void>";
123 case BOOLEAN: 123 case BOOLEAN:
124 return boolean_value_ ? "true" : "false"; 124 return boolean_value_ ? "true" : "false";
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // iteration code. 214 // iteration code.
215 return false; 215 return false;
216 default: 216 default:
217 return false; 217 return false;
218 } 218 }
219 } 219 }
220 220
221 bool Value::operator!=(const Value& other) const { 221 bool Value::operator!=(const Value& other) const {
222 return !operator==(other); 222 return !operator==(other);
223 } 223 }
OLDNEW
« no previous file with comments | « tools/gn/value.h ('k') | tools/gn/value_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698