OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ECLIPSE_WRITER_H_ | 5 #ifndef TOOLS_GN_ECLIPSE_WRITER_H_ |
6 #define TOOLS_GN_ECLIPSE_WRITER_H_ | 6 #define TOOLS_GN_ECLIPSE_WRITER_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 | 15 |
16 class BuildSettings; | 16 class BuildSettings; |
17 class Builder; | 17 class Builder; |
18 class Err; | 18 class Err; |
19 class Target; | 19 class Target; |
20 | 20 |
21 class EclipseWriter { | 21 class EclipseWriter { |
22 public: | 22 public: |
23 static bool RunAndWriteFile(const BuildSettings* build_settings, | 23 static bool RunAndWriteFile(const BuildSettings* build_settings, |
24 const Builder* builder, | 24 const Builder& builder, |
25 Err* err); | 25 Err* err); |
26 | 26 |
27 private: | 27 private: |
28 EclipseWriter(const BuildSettings* build_settings, | 28 EclipseWriter(const BuildSettings* build_settings, |
29 const Builder* builder, | 29 const Builder& builder, |
30 std::ostream& out); | 30 std::ostream& out); |
31 ~EclipseWriter(); | 31 ~EclipseWriter(); |
32 | 32 |
33 void Run(); | 33 void Run(); |
34 | 34 |
35 // Populates |include_dirs_| with the include dirs of all the targets for the | 35 // Populates |include_dirs_| with the include dirs of all the targets for the |
36 // default toolchain. | 36 // default toolchain. |
37 void GetAllIncludeDirs(); | 37 void GetAllIncludeDirs(); |
38 | 38 |
39 // Populates |defines_| with the defines of all the targets for the default | 39 // Populates |defines_| with the defines of all the targets for the default |
40 // toolchain. | 40 // toolchain. |
41 void GetAllDefines(); | 41 void GetAllDefines(); |
42 | 42 |
43 // Returns true if |target| uses the default toolchain. | 43 // Returns true if |target| uses the default toolchain. |
44 bool UsesDefaultToolchain(const Target* target) const; | 44 bool UsesDefaultToolchain(const Target* target) const; |
45 | 45 |
46 // Writes the XML settings file. | 46 // Writes the XML settings file. |
47 void WriteCDTSettings(); | 47 void WriteCDTSettings(); |
48 | 48 |
49 const BuildSettings* build_settings_; | 49 const BuildSettings* build_settings_; |
50 const Builder* builder_; | 50 const Builder& builder_; |
51 | 51 |
52 // The output stream for the settings file. | 52 // The output stream for the settings file. |
53 std::ostream& out_; | 53 std::ostream& out_; |
54 | 54 |
55 // Eclipse languages for which the include dirs and defines apply. | 55 // Eclipse languages for which the include dirs and defines apply. |
56 std::vector<std::string> languages_; | 56 std::vector<std::string> languages_; |
57 | 57 |
58 // The include dirs of all the targets which use the default toolchain. | 58 // The include dirs of all the targets which use the default toolchain. |
59 std::set<std::string> include_dirs_; | 59 std::set<std::string> include_dirs_; |
60 | 60 |
61 // The defines of all the targets which use the default toolchain. | 61 // The defines of all the targets which use the default toolchain. |
62 std::map<std::string, std::string> defines_; | 62 std::map<std::string, std::string> defines_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(EclipseWriter); | 64 DISALLOW_COPY_AND_ASSIGN(EclipseWriter); |
65 }; | 65 }; |
66 | 66 |
67 #endif // TOOLS_GN_ECLIPSE_WRITER_H_ | 67 #endif // TOOLS_GN_ECLIPSE_WRITER_H_ |
OLD | NEW |