| 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 #ifndef TOOLS_GN_VALUE_H_ | 5 #ifndef TOOLS_GN_VALUE_H_ |
| 6 #define TOOLS_GN_VALUE_H_ | 6 #define TOOLS_GN_VALUE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 Type type() const { return type_; } | 49 Type type() const { return type_; } |
| 50 | 50 |
| 51 // Returns a string describing the given type. | 51 // Returns a string describing the given type. |
| 52 static const char* DescribeType(Type t); | 52 static const char* DescribeType(Type t); |
| 53 | 53 |
| 54 // Returns the node that made this. May be NULL. | 54 // Returns the node that made this. May be NULL. |
| 55 const ParseNode* origin() const { return origin_; } | 55 const ParseNode* origin() const { return origin_; } |
| 56 void set_origin(const ParseNode* o) { origin_ = o; } | 56 void set_origin(const ParseNode* o) { origin_ = o; } |
| 57 | 57 |
| 58 // Sets the origin of this value, recursively going into list child | |
| 59 // values and also setting their origins. | |
| 60 void RecursivelySetOrigin(const ParseNode* o); | |
| 61 | |
| 62 bool& boolean_value() { | 58 bool& boolean_value() { |
| 63 DCHECK(type_ == BOOLEAN); | 59 DCHECK(type_ == BOOLEAN); |
| 64 return boolean_value_; | 60 return boolean_value_; |
| 65 } | 61 } |
| 66 const bool& boolean_value() const { | 62 const bool& boolean_value() const { |
| 67 DCHECK(type_ == BOOLEAN); | 63 DCHECK(type_ == BOOLEAN); |
| 68 return boolean_value_; | 64 return boolean_value_; |
| 69 } | 65 } |
| 70 | 66 |
| 71 int64& int_value() { | 67 int64& int_value() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 std::string string_value_; | 123 std::string string_value_; |
| 128 bool boolean_value_; | 124 bool boolean_value_; |
| 129 int64 int_value_; | 125 int64 int_value_; |
| 130 std::vector<Value> list_value_; | 126 std::vector<Value> list_value_; |
| 131 scoped_ptr<Scope> scope_value_; | 127 scoped_ptr<Scope> scope_value_; |
| 132 | 128 |
| 133 const ParseNode* origin_; | 129 const ParseNode* origin_; |
| 134 }; | 130 }; |
| 135 | 131 |
| 136 #endif // TOOLS_GN_VALUE_H_ | 132 #endif // TOOLS_GN_VALUE_H_ |
| OLD | NEW |