1
2
3
4
5
6 #ifndef SNGCPP_AST_SOLUTION_INCLUDED
7 #define SNGCPP_AST_SOLUTION_INCLUDED
8 #include <sngcpp/ast/AstApi.hpp>
9 #include <stdint.h>
10 #include <memory>
11 #include <vector>
12 #include <string>
13 #include <unordered_map>
14
15 namespace sngcpp { namespace ast {
16
17 struct Version
18 {
19 Version();
20 Version(uint32_t major_, uint32_t minor_, uint32_t revision_, uint32_t build_);
21 uint32_t major;
22 uint32_t minor;
23 uint32_t revision;
24 uint32_t build;
25 };
26
27 class Project
28 {
29 public:
30 Project(const std::u32string& languageGuid_, const std::u32string& name_, const std::string filePath_, std::u32string guid_);
31 Project(const Project&) = delete;
32 Project(Project&&) = delete;
33 Project& operator=(const Project&) = delete;
34 Project&& operator=(Project&&) = delete;
35 void AddDependency(const std::u32string& dependency);
36 const std::u32string& LanguageGuid() const { return languageGuid; }
37 const std::u32string& Name() const { return name; }
38 const std::string& FilePath() const { return filePath; }
39 const std::u32string& Guid() const { return guid; }
40 const std::std::vector<std::u32string>&Dependencies() const{returndependencies;}
41 private:
42 std::u32string languageGuid;
43 std::u32string name;
44 std::string filePath;
45 std::u32string guid;
46 std::vector<std::u32string> dependencies;
47 };
48
49 class Solution
50 {
51 public:
52 Solution(const std::string& filePath_, const Version& formatVersion_, const Version& visualStudioVersion_, const Version& minimumVisualStudioVersion_);
53 Solution(const Solution&) = delete;
54 Solution(Solution&&) = delete;
55 Solution& operator=(const Solution&) = delete;
56 Solution&& operator=(Solution&&) = delete;
57 void AddProject(Project* project);
58 Project* GetProject(const std::u32string& guid) const;
59 std::vector<Project*> BuildOrder();
60 const std::string& BasePath() const { return basePath; }
61 private:
62 std::string filePath;
63 std::string basePath;
64 Version formatVersion;
65 Version visualStudioVersion;
66 Version minimumVisualStudioVersion;
67 std::vector<std::std::unique_ptr<Project>>projects;
68 std::unordered_map<std::u32string, Project*> projectMap;
69 };
70
71 } }
72
73 #endif // SNGCPP_AST_SOLUTION_INCLUDED