| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 Value(const ParseNode* origin, std::string str_val); | 36 Value(const ParseNode* origin, std::string str_val); |
| 37 Value(const ParseNode* origin, const char* str_val); | 37 Value(const ParseNode* origin, const char* str_val); |
| 38 // Values "shouldn't" have null scopes when type == Scope, so be sure to | 38 // Values "shouldn't" have null scopes when type == Scope, so be sure to |
| 39 // always set one. However, this is not asserted since there are some | 39 // always set one. However, this is not asserted since there are some |
| 40 // use-cases for creating values and immediately setting the scope on it. So | 40 // use-cases for creating values and immediately setting the scope on it. So |
| 41 // you can pass a null scope here if you promise to set it before any other | 41 // you can pass a null scope here if you promise to set it before any other |
| 42 // code gets it (code will generally assume the scope is not null). | 42 // code gets it (code will generally assume the scope is not null). |
| 43 Value(const ParseNode* origin, std::unique_ptr<Scope> scope); | 43 Value(const ParseNode* origin, std::unique_ptr<Scope> scope); |
| 44 | 44 |
| 45 Value(const Value& other); | 45 Value(const Value& other); |
| 46 Value(Value&& other); |
| 46 ~Value(); | 47 ~Value(); |
| 47 | 48 |
| 48 Value& operator=(const Value& other); | 49 Value& operator=(const Value& other); |
| 50 Value& operator=(Value&& other) = default; |
| 49 | 51 |
| 50 Type type() const { return type_; } | 52 Type type() const { return type_; } |
| 51 | 53 |
| 52 // Returns a string describing the given type. | 54 // Returns a string describing the given type. |
| 53 static const char* DescribeType(Type t); | 55 static const char* DescribeType(Type t); |
| 54 | 56 |
| 55 // Returns the node that made this. May be NULL. | 57 // Returns the node that made this. May be NULL. |
| 56 const ParseNode* origin() const { return origin_; } | 58 const ParseNode* origin() const { return origin_; } |
| 57 void set_origin(const ParseNode* o) { origin_ = o; } | 59 void set_origin(const ParseNode* o) { origin_ = o; } |
| 58 | 60 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 std::string string_value_; | 126 std::string string_value_; |
| 125 bool boolean_value_; | 127 bool boolean_value_; |
| 126 int64_t int_value_; | 128 int64_t int_value_; |
| 127 std::vector<Value> list_value_; | 129 std::vector<Value> list_value_; |
| 128 std::unique_ptr<Scope> scope_value_; | 130 std::unique_ptr<Scope> scope_value_; |
| 129 | 131 |
| 130 const ParseNode* origin_; | 132 const ParseNode* origin_; |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 #endif // TOOLS_GN_VALUE_H_ | 135 #endif // TOOLS_GN_VALUE_H_ |
| OLD | NEW |