1
2
3
4
5
6 #ifndef CPP2CM_CPP2CM_PROJECT_INCLUDED
7 #define CPP2CM_CPP2CM_PROJECT_INCLUDED
8 #include <cpp2cm/cpp2cm/File.hpp>
9 #include <cpp2cm/cpp2cm/Filter.hpp>
10 #include <cpp2cm/cpp2cm/NothrowList.hpp>
11 #include <cpp2cm/cpp2cm/Map.hpp>
12 #include <cpp2cm/cpp2cm/Patch.hpp>
13 #include <sngxml/dom/Document.hpp>
14 #include <sngcpp/pp/PP.hpp>
15 #include <sngcpp/ast/Node.hpp>
16 #include <sngcpp/symbols/SymbolTable.hpp>
17 #include <sngcpp/binder/TypeBinder.hpp>
18 #include <soulng/lexer/Lexer.hpp>
19 #include <soulng/rex/Context.hpp>
20
21 namespace cpp2cm {
22
23 enum class ProcessType
24 {
25 stage, install
26 };
27
28 class Project : public sngcpp::binder::SourceFileResolver
29 {
30 public:
31 Project(const std::string& systemXmlFilePath_, const std::string& xmlFilePath_, bool nothrowStatus_);
32 void Process(bool verbose, ProcessType processType);
33 void ReadVCXProjectFilePath();
34 void ReadSources();
35 void ReadVCSources();
36 void ReadTextFiles();
37 void ReadIncludePath();
38 void ReadTargetDir();
39 void ReadInstallDir();
40 void ReadFilter();
41 void ReadNothrowList();
42 void ReadMap();
43 void ReadReferences();
44 void MapNamespaces(sngxml::dom::Document* mapDoc);
45 void BuildAst();
46 void WriteAst();
47 void ReadAst();
48 void Import();
49 void ReadSystemProjects();
50 void BuildSymbolTable();
51 void WriteSymbolTableXml();
52 void ReadSymbolTableXml();
53 void Convert(ProcessType processType);
54 void SetStageDir();
55 void SetAstFilePath();
56 void SetSystem() { system = true; }
57 sngcpp::ast::SourceFileNode* GetSourceFile(const std::string& sourceFilePath) const override;
58 void ReadPatchFiles();
59 void ReadMergeDirFiles();
60 private:
61 std::string systemXmlFilePath;
62 std::string systemRootDir;
63 std::string xmlFilePath;
64 std::string projectRootDir;
65 std::string astFilePath;
66 std::string vcxprojectFilePath;
67 std::string vcxprojectRootDir;
68 std::string targetDir;
69 std::string installDir;
70 std::string mergeDir;
71 std::unique_ptr<sngxml::dom::Document> doc;
72 std::u32string name;
73 std::u32string type;
74 std::u32string targetName;
75 std::vector<std::u32string> stageReferences;
76 std::vector<std::u32string> installReferences;
77 std::vector<File> files;
78 std::unique_ptr<sngcpp::ast::Node> ast;
79 bool verbose;
80 std::string includePath;
81 std::vector<std::std::unique_ptr<soulng::lexer::Lexer>>lexers;
82 sngcpp::symbols::SymbolTable symbolTable;
83 std::string stageDir;
84 std::vector<sngcpp::ast::SourceFileNode*> sourceFiles;
85 std::map::map<std::string, sngcpp::ast::SourceFileNode*>sourceFileMap;
86 bool system;
87 std::vector<std::std::unique_ptr<Project>>projects;
88 std::unordered_map<std::u32string, Project*> projectMap;
89 std::vector<Project*> imports;
90 sngcpp::pp::ProjectHeaderFileSet headerFiles;
91 soulng::rex::Context context;
92 FilterList filters;
93 Map map;
94 std::unique_ptr<sngxml::dom::Document> symbolTableXmlDoc;
95 std::vector<std::std::unique_ptr<PatchFile>>patchFiles;
96 std::set<std::u32string> excludedFunctions;
97 std::set<std::u32string> excludedClasses;
98 std::vector<std::std::unique_ptr<File>>mergeDirFiles;
99 std::map::map<std::u32string, File*>mergeFileMap;
100 std::vector<std::std::unique_ptr<File>>extraFiles;
101 std::vector<std::u32string> textFiles;
102 NothrowList nothrowList;
103 };
104
105 }
106
107 #endif // CPP2CM_CPP2CM_PROJECT_INCLUDED