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 <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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 Value::Value(const ParseNode* origin, int64_t int_val) | 35 Value::Value(const ParseNode* origin, int64_t int_val) |
36 : type_(INTEGER), | 36 : type_(INTEGER), |
37 boolean_value_(false), | 37 boolean_value_(false), |
38 int_value_(int_val), | 38 int_value_(int_val), |
39 origin_(origin) { | 39 origin_(origin) { |
40 } | 40 } |
41 | 41 |
42 Value::Value(const ParseNode* origin, std::string str_val) | 42 Value::Value(const ParseNode* origin, std::string str_val) |
43 : type_(STRING), | 43 : type_(STRING), |
44 string_value_(), | 44 string_value_(std::move(str_val)), |
45 boolean_value_(false), | 45 boolean_value_(false), |
46 int_value_(0), | 46 int_value_(0), |
47 origin_(origin) { | 47 origin_(origin) {} |
48 string_value_.swap(str_val); | |
49 } | |
50 | 48 |
51 Value::Value(const ParseNode* origin, const char* str_val) | 49 Value::Value(const ParseNode* origin, const char* str_val) |
52 : type_(STRING), | 50 : type_(STRING), |
53 string_value_(str_val), | 51 string_value_(str_val), |
54 boolean_value_(false), | 52 boolean_value_(false), |
55 int_value_(0), | 53 int_value_(0), |
56 origin_(origin) { | 54 origin_(origin) { |
57 } | 55 } |
58 | 56 |
59 Value::Value(const ParseNode* origin, std::unique_ptr<Scope> scope) | 57 Value::Value(const ParseNode* origin, std::unique_ptr<Scope> scope) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // iteration code. | 212 // iteration code. |
215 return false; | 213 return false; |
216 default: | 214 default: |
217 return false; | 215 return false; |
218 } | 216 } |
219 } | 217 } |
220 | 218 |
221 bool Value::operator!=(const Value& other) const { | 219 bool Value::operator!=(const Value& other) const { |
222 return !operator==(other); | 220 return !operator==(other); |
223 } | 221 } |
OLD | NEW |