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 3// found in the LICENSE file. 4 5#ifndef TOOLS_GN_CONFIG_H_ 6#define TOOLS_GN_CONFIG_H_ 7 8#include "base/compiler_specific.h" 9#include "tools/gn/config_values.h" 10#include "tools/gn/item.h" 11 12class Err; 13class ItemTree; 14class LocationRange; 15class Settings; 16 17// Represents a named config in the dependency graph. 18class Config : public Item { 19 public: 20 Config(const Label& label); 21 virtual ~Config(); 22 23 virtual Config* AsConfig() OVERRIDE; 24 virtual const Config* AsConfig() const OVERRIDE; 25 26 ConfigValues& config_values() { return config_values_; } 27 const ConfigValues& config_values() const { return config_values_; } 28 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: 40 ConfigValues config_values_; 41 42 DISALLOW_COPY_AND_ASSIGN(Config); 43}; 44 45#endif // TOOLS_GN_CONFIG_H_ 46