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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 result.push_back(']'); | 145 result.push_back(']'); |
146 return result; | 146 return result; |
147 } | 147 } |
148 case SCOPE: { | 148 case SCOPE: { |
149 Scope::KeyValueMap scope_values; | 149 Scope::KeyValueMap scope_values; |
150 scope_value_->GetCurrentScopeValues(&scope_values); | 150 scope_value_->GetCurrentScopeValues(&scope_values); |
151 if (scope_values.empty()) | 151 if (scope_values.empty()) |
152 return std::string("{ }"); | 152 return std::string("{ }"); |
153 | 153 |
154 std::string result = "{\n"; | 154 std::string result = "{\n"; |
155 for (Scope::KeyValueMap::const_iterator i = scope_values.begin(); | 155 for (const auto& pair : scope_values) { |
156 i != scope_values.end(); ++i) { | 156 result += " " + pair.first.as_string() + " = " + |
157 result += " " + i->first.as_string() + " = " + | 157 pair.second.ToString(true) + "\n"; |
158 i->second.ToString(true) + "\n"; | |
159 } | 158 } |
160 result += "}"; | 159 result += "}"; |
161 | 160 |
162 return result; | 161 return result; |
163 } | 162 } |
164 } | 163 } |
165 return std::string(); | 164 return std::string(); |
166 } | 165 } |
167 | 166 |
168 bool Value::VerifyTypeIs(Type t, Err* err) const { | 167 bool Value::VerifyTypeIs(Type t, Err* err) const { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // iteration code. | 200 // iteration code. |
202 return false; | 201 return false; |
203 default: | 202 default: |
204 return false; | 203 return false; |
205 } | 204 } |
206 } | 205 } |
207 | 206 |
208 bool Value::operator!=(const Value& other) const { | 207 bool Value::operator!=(const Value& other) const { |
209 return !operator==(other); | 208 return !operator==(other); |
210 } | 209 } |
OLD | NEW |