Home | History | Annotate | Download | only in gn
      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_VALUES_H_
      6 #define TOOLS_GN_CONFIG_VALUES_H_
      7 
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "base/basictypes.h"
     12 #include "tools/gn/source_dir.h"
     13 
     14 // Holds the values (include_dirs, defines, compiler flags, etc.) for a given
     15 // config or target.
     16 class ConfigValues {
     17  public:
     18   ConfigValues();
     19   ~ConfigValues();
     20 
     21 #define STRING_VALUES_ACCESSOR(name) \
     22     const std::vector<std::string>& name() const { return name##_; } \
     23     std::vector<std::string>& name() { return name##_; }
     24 #define DIR_VALUES_ACCESSOR(name) \
     25     const std::vector<SourceDir>& name() const { return name##_; } \
     26     std::vector<SourceDir>& name() { return name##_; }
     27 
     28   STRING_VALUES_ACCESSOR(cflags)
     29   STRING_VALUES_ACCESSOR(cflags_c)
     30   STRING_VALUES_ACCESSOR(cflags_cc)
     31   STRING_VALUES_ACCESSOR(cflags_objc)
     32   STRING_VALUES_ACCESSOR(cflags_objcc)
     33   STRING_VALUES_ACCESSOR(defines)
     34   DIR_VALUES_ACCESSOR   (include_dirs)
     35   STRING_VALUES_ACCESSOR(ldflags)
     36   DIR_VALUES_ACCESSOR   (lib_dirs)
     37   STRING_VALUES_ACCESSOR(libs)
     38 
     39 #undef STRING_VALUES_ACCESSOR
     40 #undef DIR_VALUES_ACCESSOR
     41 
     42  private:
     43   std::vector<std::string> cflags_;
     44   std::vector<std::string> cflags_c_;
     45   std::vector<std::string> cflags_cc_;
     46   std::vector<std::string> cflags_objc_;
     47   std::vector<std::string> cflags_objcc_;
     48   std::vector<std::string> defines_;
     49   std::vector<SourceDir>   include_dirs_;
     50   std::vector<std::string> ldflags_;
     51   std::vector<SourceDir>   lib_dirs_;
     52   std::vector<std::string> libs_;
     53 
     54 
     55   DISALLOW_COPY_AND_ASSIGN(ConfigValues);
     56 };
     57 
     58 #endif  // TOOLS_GN_CONFIG_VALUES_H_
     59