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_VALUES_H_ | 5 #ifndef TOOLS_GN_CONFIG_VALUES_H_ |
6 #define TOOLS_GN_CONFIG_VALUES_H_ | 6 #define TOOLS_GN_CONFIG_VALUES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "tools/gn/source_dir.h" | 12 #include "tools/gn/source_dir.h" |
13 | 13 |
14 // Holds the values (includes, defines, compiler flags, etc.) for a given | 14 // Holds the values (includes, defines, compiler flags, etc.) for a given |
15 // config or target. | 15 // config or target. |
16 class ConfigValues { | 16 class ConfigValues { |
17 public: | 17 public: |
18 ConfigValues(); | 18 ConfigValues(); |
19 ~ConfigValues(); | 19 ~ConfigValues(); |
20 | 20 |
21 const std::vector<SourceDir>& includes() const { return includes_; } | 21 const std::vector<SourceDir>& includes() const { return includes_; } |
22 void swap_in_includes(std::vector<SourceDir>* lo) { includes_.swap(*lo); } | 22 void swap_in_includes(std::vector<SourceDir>* lo) { includes_.swap(*lo); } |
23 | 23 |
24 const std::vector<std::string>& defines() const { return defines_; } | 24 #define VALUES_ACCESSOR(name) \ |
25 void swap_in_defines(std::vector<std::string>* d) { defines_.swap(*d); } | 25 const std::vector<std::string>& name() const { return name##_; } \ |
| 26 void swap_in_##name(std::vector<std::string>* v) { name##_.swap(*v); } |
26 | 27 |
27 const std::vector<std::string>& cflags() const { return cflags_; } | 28 VALUES_ACCESSOR(defines) |
28 void swap_in_cflags(std::vector<std::string>* lo) { cflags_.swap(*lo); } | 29 VALUES_ACCESSOR(cflags) |
| 30 VALUES_ACCESSOR(cflags_c) |
| 31 VALUES_ACCESSOR(cflags_cc) |
| 32 VALUES_ACCESSOR(cflags_objc) |
| 33 VALUES_ACCESSOR(cflags_objcc) |
| 34 VALUES_ACCESSOR(ldflags) |
29 | 35 |
30 const std::vector<std::string>& cflags_c() const { return cflags_c_; } | 36 #undef VALUES_ACCESSOR |
31 void swap_in_cflags_c(std::vector<std::string>* lo) { cflags_c_.swap(*lo); } | |
32 | |
33 const std::vector<std::string>& cflags_cc() const { return cflags_cc_; } | |
34 void swap_in_cflags_cc(std::vector<std::string>* lo) { cflags_cc_.swap(*lo); } | |
35 | |
36 const std::vector<std::string>& ldflags() const { return ldflags_; } | |
37 void swap_in_ldflags(std::vector<std::string>* lo) { ldflags_.swap(*lo); } | |
38 | 37 |
39 private: | 38 private: |
40 std::vector<SourceDir> includes_; | 39 std::vector<SourceDir> includes_; |
41 std::vector<std::string> defines_; | 40 std::vector<std::string> defines_; |
42 std::vector<std::string> cflags_; | 41 std::vector<std::string> cflags_; |
43 std::vector<std::string> cflags_c_; | 42 std::vector<std::string> cflags_c_; |
44 std::vector<std::string> cflags_cc_; | 43 std::vector<std::string> cflags_cc_; |
| 44 std::vector<std::string> cflags_objc_; |
| 45 std::vector<std::string> cflags_objcc_; |
45 std::vector<std::string> ldflags_; | 46 std::vector<std::string> ldflags_; |
46 | 47 |
47 DISALLOW_COPY_AND_ASSIGN(ConfigValues); | 48 DISALLOW_COPY_AND_ASSIGN(ConfigValues); |
48 }; | 49 }; |
49 | 50 |
50 #endif // TOOLS_GN_CONFIG_VALUES_H_ | 51 #endif // TOOLS_GN_CONFIG_VALUES_H_ |
OLD | NEW |