| 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 | 8 |
| 9 Value::Value() | 9 Value::Value() |
| 10 : type_(NONE), | 10 : type_(NONE), |
| 11 boolean_value_(false), |
| 11 int_value_(0), | 12 int_value_(0), |
| 12 origin_(NULL) { | 13 origin_(NULL) { |
| 13 } | 14 } |
| 14 | 15 |
| 15 Value::Value(const ParseNode* origin, Type t) | 16 Value::Value(const ParseNode* origin, Type t) |
| 16 : type_(t), | 17 : type_(t), |
| 18 boolean_value_(false), |
| 17 int_value_(0), | 19 int_value_(0), |
| 18 origin_(origin) { | 20 origin_(origin) { |
| 19 } | 21 } |
| 20 | 22 |
| 21 Value::Value(const ParseNode* origin, bool bool_val) | 23 Value::Value(const ParseNode* origin, bool bool_val) |
| 22 : type_(BOOLEAN), | 24 : type_(BOOLEAN), |
| 23 boolean_value_(bool_val), | 25 boolean_value_(bool_val), |
| 24 int_value_(0), | 26 int_value_(0), |
| 25 origin_(origin) { | 27 origin_(origin) { |
| 26 } | 28 } |
| 27 | 29 |
| 28 Value::Value(const ParseNode* origin, int64 int_val) | 30 Value::Value(const ParseNode* origin, int64 int_val) |
| 29 : type_(INTEGER), | 31 : type_(INTEGER), |
| 30 boolean_value_(false), | 32 boolean_value_(false), |
| 31 int_value_(int_val), | 33 int_value_(int_val), |
| 32 origin_(origin) { | 34 origin_(origin) { |
| 33 } | 35 } |
| 34 | 36 |
| 35 Value::Value(const ParseNode* origin, std::string str_val) | 37 Value::Value(const ParseNode* origin, std::string str_val) |
| 36 : type_(STRING), | 38 : type_(STRING), |
| 37 string_value_(), | 39 string_value_(), |
| 40 boolean_value_(false), |
| 38 int_value_(0), | 41 int_value_(0), |
| 39 origin_(origin) { | 42 origin_(origin) { |
| 40 string_value_.swap(str_val); | 43 string_value_.swap(str_val); |
| 41 } | 44 } |
| 42 | 45 |
| 43 Value::Value(const ParseNode* origin, const char* str_val) | 46 Value::Value(const ParseNode* origin, const char* str_val) |
| 44 : type_(STRING), | 47 : type_(STRING), |
| 45 string_value_(str_val), | 48 string_value_(str_val), |
| 49 boolean_value_(false), |
| 46 int_value_(0), | 50 int_value_(0), |
| 47 origin_(origin) { | 51 origin_(origin) { |
| 48 } | 52 } |
| 49 | 53 |
| 50 Value::~Value() { | 54 Value::~Value() { |
| 51 } | 55 } |
| 52 | 56 |
| 53 void Value::RecursivelySetOrigin(const ParseNode* origin) { | 57 void Value::RecursivelySetOrigin(const ParseNode* origin) { |
| 54 set_origin(origin); | 58 set_origin(origin); |
| 55 if (type_ == Value::LIST) { | 59 if (type_ == Value::LIST) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 135 } |
| 132 return true; | 136 return true; |
| 133 default: | 137 default: |
| 134 return false; | 138 return false; |
| 135 } | 139 } |
| 136 } | 140 } |
| 137 | 141 |
| 138 bool Value::operator!=(const Value& other) const { | 142 bool Value::operator!=(const Value& other) const { |
| 139 return !operator==(other); | 143 return !operator==(other); |
| 140 } | 144 } |
| OLD | NEW |