@@ -95,11 +95,6 @@ namespace Core::IO
9595 {
9696 // ! Node in the tree of the associated InputFileImpl.
9797 ryml::NodeRef node;
98-
99- // ! String representation of the section in the .dat format. This is intended as a buffer
100- // ! to store the content if it should be requested via `get_as_dat_style_string()`. Do not
101- // ! assume this to contain a particular content.
102- std::string dat_style_string{};
10398 };
10499
105100 // ! Content of the section is either in the .dat format or in the yaml format.
@@ -573,55 +568,8 @@ namespace Core::IO
573568 }
574569 else
575570 {
576- // flatten the yaml node into a string
577- std::ostringstream ss;
578- ss << node;
579- // replace all the yaml markup characters with spaces to receive a dat-style string
580- auto & str = pimpl_->section ->as_yaml ().dat_style_string ;
581- str = ss.str ();
582- std::replace (str.begin (), str.end (), ' \n ' , ' ' );
583- std::replace (str.begin (), str.end (), ' :' , ' ' );
584- std::replace (str.begin (), str.end (), ' ,' , ' ' );
585- std::replace (str.begin (), str.end (), ' [' , ' ' );
586- std::replace (str.begin (), str.end (), ' ]' , ' ' );
587- str = Core::Utils::trim (str);
588-
589- return std::string_view (str);
590- }
591- }
592- }
593-
594-
595- std::optional<InputParameterContainer> InputFile::Fragment::match (const InputSpec& spec) const
596- {
597- FOUR_C_ASSERT (pimpl_, " Implementation error: fragment is not initialized." );
598-
599- if (std::holds_alternative<std::string_view>(pimpl_->fragment ))
600- {
601- Core::IO::ValueParser parser{get_as_dat_style_string (),
602- {.base_path = std::filesystem::path (pimpl_->section ->file ).parent_path ()}};
603- InputParameterContainer container;
604- spec.fully_parse (parser, container);
605- return container;
606- }
607- else
608- {
609- const auto node = std::get<ryml::ConstNodeRef>(pimpl_->fragment );
610- // We need to check whether the node contains structured yaml or just a dat-style string.
611- if (node.is_val ())
612- {
613- std::string_view dat_style_string{node.val ().data (), node.val ().size ()};
614- Core::IO::ValueParser parser{dat_style_string,
615- {.base_path = std::filesystem::path (pimpl_->section ->file ).parent_path ()}};
616- InputParameterContainer container;
617- spec.fully_parse (parser, container);
618- return container;
619- }
620- else
621- {
622- InputParameterContainer container;
623- spec.match (ConstYamlNodeRef (node, pimpl_->section ->file ), container);
624- return container;
571+ FOUR_C_THROW (
572+ " Yaml node does not contain a string. This legacy function is only meant for strings." );
625573 }
626574 }
627575 }
0 commit comments