/* * Author: Patrick-Christopher Mattulat * Company: Lynar Studios * E-Mail: webmaster@lynarstudios.com * Created: 2023-02-15 * Changed: 2023-02-15 * * */ #include "SectionPairSectionProvider.hpp" test::io::SectionPairSectionProvider::SectionPairSectionProvider() = default; test::io::SectionPairSectionProvider::~SectionPairSectionProvider() = default; ::std::shared_ptr test::io::SectionPairSectionProvider::createSection() { ::std::shared_ptr section = ::std::make_shared("general"); ::std::shared_ptr name = ::std::make_shared("name", ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE); ::std::dynamic_pointer_cast(name->getValue())->set("Tom"); section->add(name); ::std::shared_ptr jobs = ::std::make_shared("jobs", ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_LIST_VALUE); ::std::shared_ptr jobList = ::std::dynamic_pointer_cast(jobs->getValue()); jobList->add("Farmer"); jobList->add("Bounty Hunter"); section->add(jobs); ::std::shared_ptr age = ::std::make_shared("age", ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE); ::std::dynamic_pointer_cast(age->getValue())->set("33"); section->add(age); return section; } ls::std::core::type::byte_field test::io::SectionPairSectionProvider::createSerializedSection() { ::std::string newLine = ls::std::io::NewLine::get(); ls::std::core::type::byte_field serializedSection = newLine + "[general]" + newLine; ls::std::core::type::byte_field serializedNameRow = "name=Tom" + newLine; ls::std::core::type::byte_field serializedJobsRow = "jobs:" + newLine + " Farmer" + newLine + " Bounty Hunter" + newLine; ls::std::core::type::byte_field serializedAgeRow = "age=33" + newLine; return serializedSection + serializedNameRow + serializedJobsRow + serializedAgeRow; }