-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlagsOverrideInfo.cpp
More file actions
49 lines (37 loc) · 1.34 KB
/
Copy pathFlagsOverrideInfo.cpp
File metadata and controls
49 lines (37 loc) · 1.34 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
#include "runcpp2/Data/FlagsOverrideInfo.hpp"
#include "runcpp2/Data/ParseCommon.hpp"
#include "runcpp2/ParseUtil.hpp"
#include "ssLogger/ssLog.hpp"
bool runcpp2::Data::FlagsOverrideInfo::ParseYAML_Node(ryml::ConstNodeRef& node)
{
INTERNAL_RUNCPP2_SAFE_START();
std::vector<NodeRequirement> requirements =
{
NodeRequirement("Remove", ryml::NodeType_e::KEYVAL, false, true),
NodeRequirement("Append", ryml::NodeType_e::KEYVAL, false, true)
};
if(!CheckNodeRequirements(node, requirements))
{
ssLOG_ERROR("FlagsOverrideInfo: Failed to meet requirements");
return false;
}
if(ExistAndHasChild(node, "Remove"))
node["Remove"] >> Remove;
if(ExistAndHasChild(node, "Append"))
node["Append"] >> Append;
return true;
INTERNAL_RUNCPP2_SAFE_CATCH_RETURN(false);
}
std::string runcpp2::Data::FlagsOverrideInfo::ToString(std::string indentation) const
{
std::string out;
if(!Remove.empty())
out += indentation + "Remove: " + GetEscapedYAMLString(Remove) + "\n";
if(!Append.empty())
out += indentation + "Append: " + GetEscapedYAMLString(Append) + "\n";
return out;
}
bool runcpp2::Data::FlagsOverrideInfo::Equals(const FlagsOverrideInfo& other) const
{
return Remove == other.Remove && Append == other.Append;
}