[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / tools / gn / config_values.h
blobd053e4a3c692d7900975e165f62ad42aa8a57ad5
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.
5 #ifndef TOOLS_GN_CONFIG_VALUES_H_
6 #define TOOLS_GN_CONFIG_VALUES_H_
8 #include <string>
9 #include <vector>
11 #include "base/macros.h"
12 #include "tools/gn/source_dir.h"
13 #include "tools/gn/source_file.h"
15 // Holds the values (include_dirs, defines, compiler flags, etc.) for a given
16 // config or target.
17 class ConfigValues {
18 public:
19 ConfigValues();
20 ~ConfigValues();
22 // Appends the values from the given config to this one.
23 void AppendValues(const ConfigValues& append);
25 #define STRING_VALUES_ACCESSOR(name) \
26 const std::vector<std::string>& name() const { return name##_; } \
27 std::vector<std::string>& name() { return name##_; }
28 #define DIR_VALUES_ACCESSOR(name) \
29 const std::vector<SourceDir>& name() const { return name##_; } \
30 std::vector<SourceDir>& name() { return name##_; }
32 STRING_VALUES_ACCESSOR(cflags)
33 STRING_VALUES_ACCESSOR(cflags_c)
34 STRING_VALUES_ACCESSOR(cflags_cc)
35 STRING_VALUES_ACCESSOR(cflags_objc)
36 STRING_VALUES_ACCESSOR(cflags_objcc)
37 STRING_VALUES_ACCESSOR(defines)
38 DIR_VALUES_ACCESSOR (include_dirs)
39 STRING_VALUES_ACCESSOR(ldflags)
40 DIR_VALUES_ACCESSOR (lib_dirs)
41 STRING_VALUES_ACCESSOR(libs)
42 // If you add a new one, be sure to update AppendValues().
44 #undef STRING_VALUES_ACCESSOR
45 #undef DIR_VALUES_ACCESSOR
47 bool has_precompiled_headers() const {
48 return !precompiled_header_.empty() || !precompiled_source_.is_null();
50 const std::string& precompiled_header() const {
51 return precompiled_header_;
53 void set_precompiled_header(const std::string& f) {
54 precompiled_header_ = f;
56 const SourceFile& precompiled_source() const {
57 return precompiled_source_;
59 void set_precompiled_source(const SourceFile& f) {
60 precompiled_source_ = f;
63 private:
64 std::vector<std::string> cflags_;
65 std::vector<std::string> cflags_c_;
66 std::vector<std::string> cflags_cc_;
67 std::vector<std::string> cflags_objc_;
68 std::vector<std::string> cflags_objcc_;
69 std::vector<std::string> defines_;
70 std::vector<SourceDir> include_dirs_;
71 std::vector<std::string> ldflags_;
72 std::vector<SourceDir> lib_dirs_;
73 std::vector<std::string> libs_;
74 // If you add a new one, be sure to update AppendValues().
76 std::string precompiled_header_;
77 SourceFile precompiled_source_;
80 #endif // TOOLS_GN_CONFIG_VALUES_H_