OLD | NEW |
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 Loading... |
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); | 45 |
46 } | 46 Value::Value(const ParseNode* origin, std::string&& str_val) noexcept |
| 47 : type_(STRING), |
| 48 string_value_(std::move(str_val)), |
| 49 boolean_value_(false), |
| 50 int_value_(0), |
| 51 origin_(origin) {} |
47 | 52 |
48 Value::Value(const ParseNode* origin, const char* str_val) | 53 Value::Value(const ParseNode* origin, const char* str_val) |
49 : type_(STRING), | 54 : type_(STRING), |
50 string_value_(str_val), | 55 string_value_(str_val), |
51 boolean_value_(false), | 56 boolean_value_(false), |
52 int_value_(0), | 57 int_value_(0), |
53 origin_(origin) { | 58 origin_(origin) { |
54 } | 59 } |
55 | 60 |
56 Value::Value(const ParseNode* origin, scoped_ptr<Scope> scope) | 61 Value::Value(const ParseNode* origin, scoped_ptr<Scope> scope) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // iteration code. | 217 // iteration code. |
213 return false; | 218 return false; |
214 default: | 219 default: |
215 return false; | 220 return false; |
216 } | 221 } |
217 } | 222 } |
218 | 223 |
219 bool Value::operator!=(const Value& other) const { | 224 bool Value::operator!=(const Value& other) const { |
220 return !operator==(other); | 225 return !operator==(other); |
221 } | 226 } |
OLD | NEW |