@@ -179,7 +179,7 @@ namespace Core::IO
179179 auto entry = node[" choices" ].append_child ();
180180 // Write every choice entry as a map to easily extend the information at a later point.
181181 entry |= ryml::MAP;
182- emit_value_as_yaml (entry[" name" ], choice_string);
182+ emit_value_as_yaml (YamlNodeRef ( entry[" name" ], " " ) , choice_string);
183183 }
184184 }
185185 };
@@ -225,7 +225,7 @@ namespace Core::IO
225225 // Pull up the std::optional aspect. The fact that this type wraps another type is specific
226226 // to C++ and not relevant to other tools. Simply knowing that a type can be empty is
227227 // enough for them.
228- emit_value_as_yaml (node[" noneable" ], true );
228+ emit_value_as_yaml (YamlNodeRef{ node[" noneable" ], " " } , true );
229229 YamlTypeEmitter<T>{}(node, size);
230230 }
231231 };
@@ -400,7 +400,7 @@ namespace Core::IO
400400
401401 // ! Emit metadata. This function always emits into a map, i.e., the implementation must
402402 // ! insert keys and values into the yaml emitter.
403- virtual void emit_metadata (ryml::NodeRef node) const = 0;
403+ virtual void emit_metadata (YamlNodeRef node) const = 0;
404404
405405 virtual bool emit (YamlNodeRef node, const InputParameterContainer&,
406406 const InputSpecEmitOptions& options) const = 0;
@@ -473,7 +473,7 @@ namespace Core::IO
473473 }
474474 }
475475
476- void emit_metadata (ryml::NodeRef node) const override { wrapped.emit_metadata (node); }
476+ void emit_metadata (YamlNodeRef node) const override { wrapped.emit_metadata (node); }
477477
478478 bool emit (YamlNodeRef node, const InputParameterContainer& container,
479479 const InputSpecEmitOptions& options) const override
@@ -751,7 +751,7 @@ namespace Core::IO
751751 void parse (ValueParser& parser, InputParameterContainer& container) const ;
752752 bool match (ConstYamlNodeRef node, InputParameterContainer& container,
753753 IO::Internal::MatchEntry& match_entry) const ;
754- void emit_metadata (ryml::NodeRef node) const ;
754+ void emit_metadata (YamlNodeRef node) const ;
755755 bool emit (YamlNodeRef node, const InputParameterContainer& container,
756756 const InputSpecEmitOptions& options) const ;
757757 [[nodiscard]] bool has_correct_size (
@@ -779,7 +779,7 @@ namespace Core::IO
779779 bool match (ConstYamlNodeRef node, InputParameterContainer& container,
780780 IO::Internal::MatchEntry& match_entry) const ;
781781 void print (std::ostream& stream, std::size_t indent) const ;
782- void emit_metadata (ryml::NodeRef node) const ;
782+ void emit_metadata (YamlNodeRef node) const ;
783783 bool emit (YamlNodeRef node, const InputParameterContainer& container,
784784 const InputSpecEmitOptions& options) const ;
785785 };
@@ -806,7 +806,7 @@ namespace Core::IO
806806 bool match (ConstYamlNodeRef node, InputParameterContainer& container,
807807 IO::Internal::MatchEntry& match_entry) const ;
808808 void print (std::ostream& stream, std::size_t indent) const ;
809- void emit_metadata (ryml::NodeRef node) const ;
809+ void emit_metadata (YamlNodeRef node) const ;
810810 bool emit (YamlNodeRef node, const InputParameterContainer& container,
811811 const InputSpecEmitOptions& options) const ;
812812 void set_default_value (InputParameterContainer& container) const ;
@@ -823,7 +823,7 @@ namespace Core::IO
823823 IO::Internal::MatchEntry& match_entry) const ;
824824 void set_default_value (InputParameterContainer& container) const ;
825825 void print (std::ostream& stream, std::size_t indent) const ;
826- void emit_metadata (ryml::NodeRef node) const ;
826+ void emit_metadata (YamlNodeRef node) const ;
827827 bool emit (YamlNodeRef node, const InputParameterContainer& container,
828828 const InputSpecEmitOptions& options) const ;
829829 };
@@ -838,7 +838,7 @@ namespace Core::IO
838838 IO::Internal::MatchEntry& match_entry) const ;
839839 void set_default_value (InputParameterContainer& container) const ;
840840 void print (std::ostream& stream, std::size_t indent) const ;
841- void emit_metadata (ryml::NodeRef node) const ;
841+ void emit_metadata (YamlNodeRef node) const ;
842842 bool emit (YamlNodeRef node, const InputParameterContainer& container,
843843 const InputSpecEmitOptions& options) const ;
844844 };
@@ -863,7 +863,7 @@ namespace Core::IO
863863
864864 void print (std::ostream& stream, std::size_t indent) const ;
865865
866- void emit_metadata (ryml::NodeRef node) const ;
866+ void emit_metadata (YamlNodeRef node) const ;
867867 bool emit (YamlNodeRef node, const InputParameterContainer& container,
868868 const InputSpecEmitOptions& options) const ;
869869 };
@@ -882,7 +882,7 @@ namespace Core::IO
882882 IO::Internal::MatchEntry& match_entry) const ;
883883 void set_default_value (InputParameterContainer& container) const ;
884884 void print (std::ostream& stream, std::size_t indent) const ;
885- void emit_metadata (ryml::NodeRef node) const ;
885+ void emit_metadata (YamlNodeRef node) const ;
886886 bool emit (YamlNodeRef node, const InputParameterContainer& container,
887887 const InputSpecEmitOptions& options) const ;
888888 };
@@ -1463,13 +1463,13 @@ bool Core::IO::Internal::ParameterSpec<T>::match(ConstYamlNodeRef node,
14631463
14641464
14651465template <Core::IO::SupportedType T>
1466- void Core::IO::Internal::ParameterSpec<T>::emit_metadata(ryml::NodeRef node) const
1466+ void Core::IO::Internal::ParameterSpec<T>::emit_metadata(YamlNodeRef node) const
14671467{
1468- node |= ryml::MAP;
1469- node[" name" ] << name;
1468+ node. node |= ryml::MAP;
1469+ node. node [" name" ] << name;
14701470
14711471 if constexpr (rank<T>() == 0 )
1472- IO::Internal::emit_type_as_yaml<StoredType>(node);
1472+ IO::Internal::emit_type_as_yaml<StoredType>(node. node );
14731473 else
14741474 {
14751475 struct DynamicSizeVisitor
@@ -1486,17 +1486,17 @@ void Core::IO::Internal::ParameterSpec<T>::emit_metadata(ryml::NodeRef node) con
14861486 {
14871487 size_info[i] = std::visit (DynamicSizeVisitor{}, data.size [i]);
14881488 }
1489- IO::Internal::emit_type_as_yaml<StoredType>(node, size_info);
1489+ IO::Internal::emit_type_as_yaml<StoredType>(node. node , size_info);
14901490 }
14911491
14921492 if (!data.description .empty ())
14931493 {
1494- emit_value_as_yaml (node[" description" ], data.description );
1494+ emit_value_as_yaml (node. wrap (node. node [" description" ]) , data.description );
14951495 }
1496- emit_value_as_yaml (node[" required" ], !(data.default_value .index () == 1 ));
1496+ emit_value_as_yaml (node. wrap (node. node [" required" ]) , !(data.default_value .index () == 1 ));
14971497 if (data.default_value .index () == 1 )
14981498 {
1499- emit_value_as_yaml (node[" default" ], std::get<1 >(data.default_value ));
1499+ emit_value_as_yaml (node. wrap (node. node [" default" ]) , std::get<1 >(data.default_value ));
15001500 }
15011501}
15021502
@@ -1513,7 +1513,7 @@ bool Core::IO::Internal::ParameterSpec<T>::emit(YamlNodeRef node,
15131513 {
15141514 auto value_node = node.node .append_child ();
15151515 value_node << ryml::key (name);
1516- emit_value_as_yaml (value_node, *value);
1516+ emit_value_as_yaml (node. wrap ( value_node) , *value);
15171517 }
15181518 return true ;
15191519 }
@@ -1524,7 +1524,7 @@ bool Core::IO::Internal::ParameterSpec<T>::emit(YamlNodeRef node,
15241524 {
15251525 auto value_node = node.node .append_child ();
15261526 value_node << ryml::key (name);
1527- emit_value_as_yaml (value_node, std::get<1 >(data.default_value ));
1527+ emit_value_as_yaml (node. wrap ( value_node) , std::get<1 >(data.default_value ));
15281528 }
15291529 return true ;
15301530 }
@@ -1691,35 +1691,35 @@ void Core::IO::Internal::DeprecatedSelectionSpec<T>::print(
16911691}
16921692
16931693template <typename T>
1694- void Core::IO::Internal::DeprecatedSelectionSpec<T>::emit_metadata(ryml::NodeRef node) const
1694+ void Core::IO::Internal::DeprecatedSelectionSpec<T>::emit_metadata(YamlNodeRef node) const
16951695{
1696- node |= ryml::MAP;
1697- node[" name" ] << name;
1696+ node. node |= ryml::MAP;
1697+ node. node [" name" ] << name;
16981698
1699- if constexpr (OptionalType<T>) emit_value_as_yaml (node[" noneable" ], true );
1700- node[" type" ] = " enum" ;
1699+ if constexpr (OptionalType<T>) emit_value_as_yaml (node. wrap (node. node [" noneable" ]) , true );
1700+ node. node [" type" ] = " enum" ;
17011701
17021702 if (!data.description .empty ())
17031703 {
1704- emit_value_as_yaml (node[" description" ], data.description );
1704+ emit_value_as_yaml (node. wrap (node. node [" description" ]) , data.description );
17051705 }
1706- emit_value_as_yaml (node[" required" ], !(data.default_value .index () == 1 ));
1706+ emit_value_as_yaml (node. wrap (node. node [" required" ]) , !(data.default_value .index () == 1 ));
17071707 if (data.default_value .index () == 1 )
17081708 {
17091709 // Find the choice that corresponds to the default value.
17101710 auto default_value_it = std::find_if (choices.begin (), choices.end (),
17111711 [&](const auto & choice) { return choice.second == std::get<1 >(data.default_value ); });
17121712 FOUR_C_ASSERT (
17131713 default_value_it != choices.end (), " Internal error: default value not found in choices." );
1714- emit_value_as_yaml (node[" default" ], default_value_it->first );
1714+ emit_value_as_yaml (node. wrap (node. node [" default" ]) , default_value_it->first );
17151715 }
1716- node[" choices" ] |= ryml::SEQ;
1716+ node. node [" choices" ] |= ryml::SEQ;
17171717 for (const auto & [choice_string, _] : choices)
17181718 {
1719- auto entry = node[" choices" ].append_child ();
1719+ auto entry = node. node [" choices" ].append_child ();
17201720 // Write every choice entry as a map to easily extend the information at a later point.
17211721 entry |= ryml::MAP;
1722- emit_value_as_yaml (entry[" name" ], choice_string);
1722+ emit_value_as_yaml (node. wrap ( entry[" name" ]) , choice_string);
17231723 }
17241724}
17251725
@@ -1737,7 +1737,7 @@ bool Core::IO::Internal::DeprecatedSelectionSpec<T>::emit(YamlNodeRef node,
17371737 {
17381738 auto value_node = node.node .append_child ();
17391739 value_node << ryml::key (key);
1740- emit_value_as_yaml (value_node, choice.first );
1740+ emit_value_as_yaml (node. wrap ( value_node) , choice.first );
17411741 return true ;
17421742 }
17431743 }
@@ -1860,28 +1860,28 @@ void Core::IO::Internal::SelectionSpec<T>::print(std::ostream& stream, std::size
18601860
18611861template <typename T>
18621862 requires (std::is_enum_v<T>)
1863- void Core::IO::Internal::SelectionSpec<T>::emit_metadata(ryml::NodeRef node) const
1863+ void Core::IO::Internal::SelectionSpec<T>::emit_metadata(YamlNodeRef node) const
18641864{
1865- node |= ryml::MAP;
1866- node[" name" ] << group_name;
1865+ node. node |= ryml::MAP;
1866+ node. node [" name" ] << group_name;
18671867
1868- if constexpr (OptionalType<T>) emit_value_as_yaml (node[" noneable" ], true );
1869- node[" type" ] = " selection" ;
1868+ if constexpr (OptionalType<T>) emit_value_as_yaml (node. wrap (node. node [" noneable" ]) , true );
1869+ node. node [" type" ] = " selection" ;
18701870
18711871 if (!data.description .empty ())
18721872 {
1873- emit_value_as_yaml (node[" description" ], data.description );
1873+ emit_value_as_yaml (node. wrap (node. node [" description" ]) , data.description );
18741874 }
1875- emit_value_as_yaml (node[" required" ], data.required );
1876- node[" selector" ] << based_on.selector ;
1875+ emit_value_as_yaml (node. wrap (node. node [" required" ]) , data.required );
1876+ node. node [" selector" ] << based_on.selector ;
18771877
1878- node[" choices" ] |= ryml::SEQ;
1878+ node. node [" choices" ] |= ryml::SEQ;
18791879 for (const auto & [choice, spec] : based_on.choices )
18801880 {
1881- auto entry = node[" choices" ].append_child ();
1881+ auto entry = node. node [" choices" ].append_child ();
18821882 entry |= ryml::MAP;
1883- emit_value_as_yaml (entry[" name" ], choice);
1884- spec.impl ().emit_metadata (entry[" spec" ]);
1883+ emit_value_as_yaml (node. wrap ( entry[" name" ]) , choice);
1884+ spec.impl ().emit_metadata (node. wrap ( entry[" spec" ]) );
18851885 }
18861886}
18871887
0 commit comments