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

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

Issue 1350043004: Cleanup: Initialize Value from tools/gn by moving std::string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Value(..., std::string&&) 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
« tools/gn/value.h ('K') | « tools/gn/value.h ('k') | no next file » | 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 "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "tools/gn/scope.h" 9 #include "tools/gn/scope.h"
10 10
(...skipping 18 matching lines...) Expand all
29 origin_(origin) { 29 origin_(origin) {
30 } 30 }
31 31
32 Value::Value(const ParseNode* origin, int64_t int_val) 32 Value::Value(const ParseNode* origin, int64_t int_val)
33 : type_(INTEGER), 33 : type_(INTEGER),
34 boolean_value_(false), 34 boolean_value_(false),
35 int_value_(int_val), 35 int_value_(int_val),
36 origin_(origin) { 36 origin_(origin) {
37 } 37 }
38 38
39 Value::Value(const ParseNode* origin, std::string str_val) 39 Value::Value(const ParseNode* origin, const std::string& str_val)
40 : type_(STRING), 40 : type_(STRING),
41 string_value_(), 41 string_value_(str_val),
42 boolean_value_(false), 42 boolean_value_(false),
43 int_value_(0), 43 int_value_(0),
44 origin_(origin) { 44 origin_(origin) {
45 string_value_.swap(str_val);
46 } 45 }
47 46
48 Value::Value(const ParseNode* origin, const char* str_val) 47 Value::Value(const ParseNode* origin, const char* str_val)
49 : type_(STRING), 48 : type_(STRING),
50 string_value_(str_val), 49 string_value_(str_val),
51 boolean_value_(false), 50 boolean_value_(false),
52 int_value_(0), 51 int_value_(0),
53 origin_(origin) { 52 origin_(origin) {
54 } 53 }
55 54
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // iteration code. 211 // iteration code.
213 return false; 212 return false;
214 default: 213 default:
215 return false; 214 return false;
216 } 215 }
217 } 216 }
218 217
219 bool Value::operator!=(const Value& other) const { 218 bool Value::operator!=(const Value& other) const {
220 return !operator==(other); 219 return !operator==(other);
221 } 220 }
OLDNEW
« tools/gn/value.h ('K') | « tools/gn/value.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698