-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilesTypesInfo.hpp
More file actions
138 lines (113 loc) · 5.02 KB
/
Copy pathFilesTypesInfo.hpp
File metadata and controls
138 lines (113 loc) · 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef RUNCPP2_DATA_FILES_TYPES_HPP
#define RUNCPP2_DATA_FILES_TYPES_HPP
#include "runcpp2/Data/FileProperties.hpp"
#include "runcpp2/LibYAML_Wrapper.hpp"
#include "runcpp2/ParseUtil.hpp"
#include "ssLogger/ssLog.hpp"
#include <string>
#include <unordered_map>
#include <vector>
namespace runcpp2
{
namespace Data
{
struct FilesTypesInfo
{
FileProperties ObjectLinkFile;
FileProperties SharedLinkFile;
FileProperties SharedLibraryFile;
FileProperties StaticLinkFile;
FileProperties ExecutableFile;
FileProperties DebugSymbolFile;
inline bool ParseYAML_Node(YAML::ConstNodePtr node)
{
ssLOG_FUNC_DEBUG();
std::vector<NodeRequirement> requirements =
{
NodeRequirement("ObjectLinkFile", YAML::NodeType::Map, true, false),
NodeRequirement("SharedLinkFile", YAML::NodeType::Map, true, false),
NodeRequirement("SharedLibraryFile", YAML::NodeType::Map, true, false),
NodeRequirement("StaticLinkFile", YAML::NodeType::Map, true, false),
NodeRequirement("ExecutableFile", YAML::NodeType::Map, true, false),
NodeRequirement("DebugSymbolFile", YAML::NodeType::Map, false, false),
};
if(!CheckNodeRequirements(node, requirements))
{
ssLOG_ERROR("FilesTypesInfo: Failed to meet requirements");
return false;
}
YAML::ConstNodePtr objectLinkFileNode = node->GetMapValueNode("ObjectLinkFile");
if(!ObjectLinkFile.ParseYAML_Node(objectLinkFileNode))
{
ssLOG_ERROR("Compiler profile: ObjectLinkFile is invalid");
return false;
}
YAML::ConstNodePtr sharedLinkFileNode = node->GetMapValueNode("SharedLinkFile");
if(!SharedLinkFile.ParseYAML_Node(sharedLinkFileNode))
{
ssLOG_ERROR("Compiler profile: SharedLinkFile is invalid");
return false;
}
YAML::ConstNodePtr sharedLibraryFileNode = node->GetMapValueNode("SharedLibraryFile");
if(!SharedLibraryFile.ParseYAML_Node(sharedLibraryFileNode))
{
ssLOG_ERROR("Compiler profile: SharedLibraryFile is invalid");
return false;
}
YAML::ConstNodePtr staticLinkFileNode = node->GetMapValueNode("StaticLinkFile");
if(!StaticLinkFile.ParseYAML_Node(staticLinkFileNode))
{
ssLOG_ERROR("Compiler profile: StaticLinkFile is invalid");
return false;
}
YAML::ConstNodePtr executionFileNode = node->GetMapValueNode("ExecutableFile");
if(!ExecutableFile.ParseYAML_Node(executionFileNode))
{
ssLOG_ERROR("Compiler profile: ExecutableFile is invalid");
return false;
}
if(ExistAndHasChild(node, "DebugSymbolFile"))
{
YAML::ConstNodePtr debugSymbolFileNode = node->GetMapValueNode("DebugSymbolFile");
if(!DebugSymbolFile.ParseYAML_Node(debugSymbolFileNode))
{
ssLOG_ERROR("Compiler profile: DebugSymbolFile is invalid");
return false;
}
}
return true;
}
inline std::string ToString(std::string indentation) const
{
ssLOG_FUNC_DEBUG();
std::string out;
out += indentation + "ObjectLinkFile:\n";
out += ObjectLinkFile.ToString(indentation + " ");
out += indentation + "SharedLinkFile:\n";
out += SharedLinkFile.ToString(indentation + " ");
out += indentation + "SharedLibraryFile:\n";
out += SharedLibraryFile.ToString(indentation + " ");
out += indentation + "StaticLinkFile:\n";
out += StaticLinkFile.ToString(indentation + " ");
out += indentation + "ExecutableFile:\n";
out += ExecutableFile.ToString(indentation + " ");
if(!DebugSymbolFile.Prefix.empty() || !DebugSymbolFile.Extension.empty())
{
out += indentation + "DebugSymbolFile:\n";
out += DebugSymbolFile.ToString(indentation + " ");
}
return out;
}
inline bool Equals(const FilesTypesInfo& other) const
{
return ObjectLinkFile.Equals(other.ObjectLinkFile) &&
SharedLinkFile.Equals(other.SharedLinkFile) &&
SharedLibraryFile.Equals(other.SharedLibraryFile) &&
StaticLinkFile.Equals(other.StaticLinkFile) &&
ExecutableFile.Equals(other.ExecutableFile) &&
DebugSymbolFile.Equals(other.DebugSymbolFile);
}
};
}
}
#endif