| 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_CONFIG_H_ | 5 #ifndef TOOLS_GN_CONFIG_H_ |
| 6 #define TOOLS_GN_CONFIG_H_ | 6 #define TOOLS_GN_CONFIG_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "tools/gn/config_values.h" | 9 #include "tools/gn/config_values.h" |
| 10 #include "tools/gn/item.h" | 10 #include "tools/gn/item.h" |
| 11 | 11 |
| 12 class Err; | |
| 13 class ItemTree; | |
| 14 class LocationRange; | |
| 15 class Settings; | |
| 16 | |
| 17 // Represents a named config in the dependency graph. | 12 // Represents a named config in the dependency graph. |
| 18 class Config : public Item { | 13 class Config : public Item { |
| 19 public: | 14 public: |
| 20 Config(const Settings* settings, const Label& label); | 15 Config(const Settings* settings, const Label& label); |
| 21 virtual ~Config(); | 16 virtual ~Config(); |
| 22 | 17 |
| 23 virtual Config* AsConfig() OVERRIDE; | 18 virtual Config* AsConfig() OVERRIDE; |
| 24 virtual const Config* AsConfig() const OVERRIDE; | 19 virtual const Config* AsConfig() const OVERRIDE; |
| 25 | 20 |
| 26 ConfigValues& config_values() { return config_values_; } | 21 ConfigValues& config_values() { return config_values_; } |
| 27 const ConfigValues& config_values() const { return config_values_; } | 22 const ConfigValues& config_values() const { return config_values_; } |
| 28 | 23 |
| 29 // Gets or creates a config. | |
| 30 // | |
| 31 // This is like the TargetManager is for Targets, but Configs are so much | |
| 32 // simpler that this one function is all we need. | |
| 33 static Config* GetConfig(const Settings* settings, | |
| 34 const LocationRange& specified_from_here, | |
| 35 const Label& label, | |
| 36 Item* dep_from, | |
| 37 Err* err); | |
| 38 | |
| 39 private: | 24 private: |
| 40 ConfigValues config_values_; | 25 ConfigValues config_values_; |
| 41 | 26 |
| 42 DISALLOW_COPY_AND_ASSIGN(Config); | 27 DISALLOW_COPY_AND_ASSIGN(Config); |
| 43 }; | 28 }; |
| 44 | 29 |
| 45 #endif // TOOLS_GN_CONFIG_H_ | 30 #endif // TOOLS_GN_CONFIG_H_ |
| OLD | NEW |