123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2023-02-16
- * Changed: 2023-06-06
- *
- * */
- #include "SectionPairDocumentProvider.hpp"
- #include <classes/io/section-pair/SectionPairSectionProvider.hpp>
- #include <ls-std/ls-std-io.hpp>
- using ls::std::core::type::byte_field;
- using ls::std::io::NewLine;
- using ls::std::io::SectionPairDocument;
- using ls::std::io::SectionPairRow;
- using ls::std::io::SectionPairRowEnumType;
- using ls::std::io::SectionPairRowSingleValue;
- using ls::std::io::SectionPairSection;
- using std::dynamic_pointer_cast;
- using std::make_shared;
- using std::shared_ptr;
- using std::string;
- using test::io::SectionPairDocumentProvider;
- using test::io::SectionPairSectionProvider;
- SectionPairDocumentProvider::SectionPairDocumentProvider() = default;
- SectionPairDocumentProvider::~SectionPairDocumentProvider() = default;
- shared_ptr<SectionPairDocument> SectionPairDocumentProvider::createDocument()
- {
- auto document = make_shared<SectionPairDocument>();
- // general section
- shared_ptr<SectionPairSection> generalSection = SectionPairSectionProvider::createSectionWithSandraExample();
- document->add(generalSection);
- // physical
- auto physicalSection = make_shared<SectionPairSection>("physical");
- auto eyeColor = make_shared<SectionPairRow>("eye-color", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
- dynamic_pointer_cast<SectionPairRowSingleValue>(eyeColor->getValue())->set("blue");
- physicalSection->add(eyeColor);
- auto hairColor = make_shared<SectionPairRow>("hair-color", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
- dynamic_pointer_cast<SectionPairRowSingleValue>(hairColor->getValue())->set("red");
- physicalSection->add(hairColor);
- auto height = make_shared<SectionPairRow>("height", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
- dynamic_pointer_cast<SectionPairRowSingleValue>(height->getValue())->set("167");
- physicalSection->add(height);
- document->add(physicalSection);
- return document;
- }
- byte_field SectionPairDocumentProvider::createSerializedDocument(const string &_newLine)
- {
- byte_field serializedDocument = "# section-pair document" + _newLine;
- // general section
- serializedDocument += SectionPairSectionProvider::createSerializedSectionWithSandraExample(_newLine);
- // physical
- serializedDocument += _newLine + "[physical]" + _newLine + _newLine;
- serializedDocument += "eye-color=blue" + _newLine;
- serializedDocument += "hair-color=red" + _newLine;
- serializedDocument += "height=167" + _newLine;
- return serializedDocument;
- }
- byte_field SectionPairDocumentProvider::createSerializedDocumentColineExample(const string &_newLine)
- {
- string paragraph = _newLine + _newLine;
- string _resourcesFolderLocation = R"lit(C:\Users\Admin\CLionProjects\coline-documentation\test\resources)lit";
- byte_field fileContent = "# section-pair document" + paragraph;
- fileContent += "[general]" + paragraph;
- fileContent += "name=Lynar Studios - Standard Library" + _newLine;
- fileContent += "version=2023.2.0" + paragraph;
- fileContent += "[input]" + paragraph;
- fileContent += "directories:" + _newLine;
- fileContent += " " + _resourcesFolderLocation + "source" + _newLine;
- fileContent += "extensions:" + _newLine;
- fileContent += " .cpp" + paragraph;
- fileContent += "[output]" + paragraph;
- fileContent += "directory=" + _resourcesFolderLocation + "doc" + _newLine;
- return fileContent;
- }
- byte_field SectionPairDocumentProvider::createSerializedDocumentComputerExample(const string &_newLine)
- {
- byte_field serializedDocument = "# section-pair document" + _newLine;
- serializedDocument += _newLine + "[model]" + _newLine + _newLine;
- serializedDocument += "graphics-card=GTX 720" + _newLine;
- serializedDocument += "ram-size=4096" + _newLine;
- serializedDocument += "graphics-ram-size=4096" + _newLine;
- serializedDocument += "cpu=Intel i7" + _newLine;
- serializedDocument += _newLine + "[requirements]" + _newLine + _newLine;
- serializedDocument += "graphics-ram-size=2048" + _newLine;
- serializedDocument += "io-devices:" + _newLine;
- serializedDocument += " mouse" + _newLine;
- serializedDocument += " keyboard" + _newLine;
- serializedDocument += " screen" + _newLine;
- serializedDocument += " headset" + _newLine;
- return serializedDocument;
- }
|