66bool runcpp2::Data::ProfilesDefines::ParseYAML_Node (ryml::ConstNodeRef node)
77{
88 ssLOG_FUNC_DEBUG ();
9-
109 INTERNAL_RUNCPP2_SAFE_START ();
1110
1211 if (!node.is_map ())
@@ -17,40 +16,63 @@ bool runcpp2::Data::ProfilesDefines::ParseYAML_Node(ryml::ConstNodeRef node)
1716
1817 for (int i = 0 ; i < node.num_children (); ++i)
1918 {
20- if (!INTERNAL_RUNCPP2_BIT_CONTANTS (node[i].type ().type , ryml::NodeType_e::SEQ))
21- {
22- ssLOG_ERROR (" ProfilesDefines: Defines type requires a list" );
23- return false ;
24- }
25-
2619 ryml::ConstNodeRef currentProfileDefinesNode = node[i];
2720 ProfileName profile = GetKey (currentProfileDefinesNode);
21+ if (!ParseYAML_NodeWithProfile (currentProfileDefinesNode, profile))
22+ return false ;
23+ }
24+
25+ return true ;
26+ INTERNAL_RUNCPP2_SAFE_CATCH_RETURN (false );
27+ }
2828
29- for (int j = 0 ; j < currentProfileDefinesNode.num_children (); ++j)
29+ bool runcpp2::Data::ProfilesDefines::ParseYAML_NodeWithProfile ( ryml::ConstNodeRef node,
30+ ProfileName profile)
31+ {
32+ ssLOG_FUNC_DEBUG ();
33+ INTERNAL_RUNCPP2_SAFE_START ();
34+
35+ if (!INTERNAL_RUNCPP2_BIT_CONTANTS (node.type ().type , ryml::NodeType_e::SEQ))
36+ {
37+ ssLOG_ERROR (" ProfilesDefines: Paths type requires a list" );
38+ return false ;
39+ }
40+
41+ for (int i = 0 ; i < node.num_children (); ++i)
42+ {
43+ std::string defineStr = GetValue (node[i]);
44+ Define define;
45+
46+ size_t equalPos = defineStr.find (' =' );
47+ if (equalPos != std::string::npos)
3048 {
31- std::string defineStr = GetValue (currentProfileDefinesNode[j]);
32- Define define;
33-
34- size_t equalPos = defineStr.find (' =' );
35- if (equalPos != std::string::npos)
36- {
37- define.Name = defineStr.substr (0 , equalPos);
38- define.Value = defineStr.substr (equalPos + 1 );
39- define.HasValue = true ;
40- }
41- else
42- {
43- define.Name = defineStr;
44- define.Value = " " ;
45- define.HasValue = false ;
46- }
47-
48- Defines[profile].push_back (define);
49+ define.Name = defineStr.substr (0 , equalPos);
50+ define.Value = defineStr.substr (equalPos + 1 );
51+ define.HasValue = true ;
52+ }
53+ else
54+ {
55+ define.Name = defineStr;
56+ define.Value = " " ;
57+ define.HasValue = false ;
4958 }
59+
60+ Defines[profile].push_back (define);
5061 }
5162
5263 return true ;
64+ INTERNAL_RUNCPP2_SAFE_CATCH_RETURN (false );
65+ }
66+
67+ bool runcpp2::Data::ProfilesDefines::IsYAML_NodeParsableAsDefault (ryml::ConstNodeRef node) const
68+ {
69+ ssLOG_FUNC_DEBUG ();
70+ INTERNAL_RUNCPP2_SAFE_START ();
5371
72+ if (!INTERNAL_RUNCPP2_BIT_CONTANTS (node.type ().type , ryml::NodeType_e::SEQ))
73+ return false ;
74+
75+ return true ;
5476 INTERNAL_RUNCPP2_SAFE_CATCH_RETURN (false );
5577}
5678
0 commit comments