Browse Source

Add file reader for section pair documents

Patrick-Christopher Mattulat 1 year ago
parent
commit
ae62cd436c

+ 157 - 65
CMakeLists.txt

@@ -183,8 +183,8 @@ set(SOURCE_FILES_IO
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/model/SectionPairRowSingleValue.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/model/SectionPairRowValue.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/model/SectionPairSection.cpp
-        #        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/reader/SectionPairFileReader.cpp
-        #        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/reader/SectionPairFileReaderParameter.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/reader/SectionPairFileReader.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/reader/SectionPairFileReaderParameter.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairDocumentValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairIdentifierValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairRowListValueValidator.cpp
@@ -221,13 +221,13 @@ set(SOURCE_FILES_TIME
 ####################################################################################################################
 ####################################################################################################################
 ####################################################################################################################
-# Test Files Modularization
+# Unit Test Files Modularization
 ####################################################################################################################
 ####################################################################################################################
 ####################################################################################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    set(TEST_FILES_BOXING
+    set(UNIT_TEST_FILES_BOXING
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/BooleanTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/DoubleTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/FloatTest.cpp
@@ -235,7 +235,7 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/LongTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/boxing/StringTest.cpp)
 
-    set(TEST_FILES_CORE
+    set(UNIT_TEST_FILES_CORE
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/evaluator/EmptyStringArgumentEvaluatorTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/evaluator/IndexOutOfBoundsEvaluatorTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/evaluator/NullPointerArgumentEvaluatorTest.cpp
@@ -258,10 +258,10 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/core/ClassWrapper.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/core/MathOddValidator.cpp)
 
-    set(TEST_FILES_ENCODING
+    set(UNIT_TEST_FILES_ENCODING
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/encoding/Base64Test.cpp)
 
-    set(TEST_FILES_EVENT
+    set(UNIT_TEST_FILES_EVENT
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/serialization/SerializableJsonEventTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventHandlerTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/event/EventManagerTest.cpp
@@ -276,7 +276,7 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/TestDataCar.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/event/TestDataMercedesCar.cpp)
 
-    set(TEST_FILES_IO
+    set(UNIT_TEST_FILES_IO
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/evaluator/FileExistenceEvaluatorTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LoggerTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/logging/LogLevelTest.cpp
@@ -298,7 +298,7 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/model/SectionPairRowSingleValueTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/model/SectionPairRowTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/model/SectionPairSectionTest.cpp
-            #            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/reader/SectionPairFileReaderParameterTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/reader/SectionPairFileReaderParameterTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairDocumentTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairParameterTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairRowListValueTest.cpp
@@ -325,92 +325,146 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/TestDataFactory.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp)
 
-    set(TEST_FILES_SERIALIZATION
+    set(UNIT_TEST_FILES_SERIALIZATION
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/serialization/JsonTest.cpp)
 
-    set(TEST_FILES_TIME
+    set(UNIT_TEST_FILES_TIME
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/time/DateTest.cpp)
 endif ()
 
 ####################################################################################################################
 ####################################################################################################################
 ####################################################################################################################
-# Test Suite Builds
+# Unit Test Suite Builds
 ####################################################################################################################
 ####################################################################################################################
 ####################################################################################################################
 
 ##########################################################
-# Build Tests (boxing)
+# Unit Build Tests (boxing)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_BOXING}: Building tests...")
-    add_executable(${MODULE_NAME_BOXING}-test ${TEST_FILES_BOXING})
+    message("${MODULE_NAME_BOXING}: Building unit tests...")
+    add_executable(${MODULE_NAME_BOXING}-unit-test ${UNIT_TEST_FILES_BOXING})
 endif ()
 
 ##########################################################
-# Build Tests (core)
+# Unit Build Tests (core)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_CORE}: Building tests...")
-    add_executable(${MODULE_NAME_CORE}-test ${TEST_FILES_CORE})
+    message("${MODULE_NAME_CORE}: Building unit tests...")
+    add_executable(${MODULE_NAME_CORE}-unit-test ${UNIT_TEST_FILES_CORE})
 endif ()
 
 ##########################################################
-# Build Tests (encoding)
+# Unit Build Tests (encoding)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_ENCODING}: Building tests...")
-    add_executable(${MODULE_NAME_ENCODING}-test ${TEST_FILES_ENCODING})
+    message("${MODULE_NAME_ENCODING}: Building unit tests...")
+    add_executable(${MODULE_NAME_ENCODING}-unit-test ${UNIT_TEST_FILES_ENCODING})
 endif ()
 
 ##########################################################
-# Build Tests (event)
+# Unit Build Tests (event)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_EVENT}: Building tests...")
-    add_executable(${MODULE_NAME_EVENT}-test ${TEST_FILES_EVENT})
+    message("${MODULE_NAME_EVENT}: Building unit tests...")
+    add_executable(${MODULE_NAME_EVENT}-unit-test ${UNIT_TEST_FILES_EVENT})
 endif ()
 
 ##########################################################
-# Build Tests (io)
+# Unit Build Tests (io)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_IO}: Building tests...")
-    add_executable(${MODULE_NAME_IO}-test
+    message("${MODULE_NAME_IO}: Building unit tests...")
+    add_executable(${MODULE_NAME_IO}-unit-test
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
-            ${TEST_FILES_IO})
+            ${UNIT_TEST_FILES_IO})
 endif ()
 
 ##########################################################
-# Build Tests (time)
+# Unit Build Tests (time)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_TIME}: Building tests...")
-    add_executable(${MODULE_NAME_TIME}-test ${TEST_FILES_TIME})
+    message("${MODULE_NAME_TIME}: Building unit tests...")
+    add_executable(${MODULE_NAME_TIME}-unit-test ${UNIT_TEST_FILES_TIME})
 endif ()
 
 ##########################################################
-# Build Tests (all)
+# Unit Build Tests (all)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${PROJECT_NAME}: Building tests...")
+    message("${PROJECT_NAME}: Building unit tests...")
+    add_executable(${PROJECT_NAME}-unit-test
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
+            ${UNIT_TEST_FILES_BOXING}
+            ${UNIT_TEST_FILES_CORE}
+            ${UNIT_TEST_FILES_ENCODING}
+            ${UNIT_TEST_FILES_EVENT}
+            ${UNIT_TEST_FILES_IO}
+            ${UNIT_TEST_FILES_SERIALIZATION}
+            ${UNIT_TEST_FILES_TIME})
+endif ()
+
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+# Integration Test Files Modularization
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+
+if (${LS_STD_BUILD_WITH_TESTS})
+    set(INTEGRATION_TEST_FILES_IO
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/reader/SectionPairFileReaderIT.cpp)
+endif ()
+
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+# Integration Test Suite Builds
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+
+##########################################################
+# Integration Build Tests (io)
+##########################################################
+
+if (${LS_STD_BUILD_WITH_TESTS})
+    message("${MODULE_NAME_IO}: Building integration tests...")
+    add_executable(${MODULE_NAME_IO}-integration-test
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
+            ${INTEGRATION_TEST_FILES_IO})
+endif ()
+
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+# Whole Test Suite Builds
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+
+if (${LS_STD_BUILD_WITH_TESTS})
+    message("${PROJECT_NAME}: Building all tests...")
     add_executable(${PROJECT_NAME}-test
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/TestHelper.cpp
-            ${TEST_FILES_BOXING}
-            ${TEST_FILES_CORE}
-            ${TEST_FILES_ENCODING}
-            ${TEST_FILES_EVENT}
-            ${TEST_FILES_IO}
-            ${TEST_FILES_SERIALIZATION}
-            ${TEST_FILES_TIME})
+            ${UNIT_TEST_FILES_BOXING}
+            ${UNIT_TEST_FILES_CORE}
+            ${UNIT_TEST_FILES_ENCODING}
+            ${UNIT_TEST_FILES_EVENT}
+            ${UNIT_TEST_FILES_IO}
+            ${INTEGRATION_TEST_FILES_IO}
+            ${UNIT_TEST_FILES_SERIALIZATION}
+            ${UNIT_TEST_FILES_TIME})
 endif ()
 
 ####################################################################################################################
@@ -529,32 +583,31 @@ endif ()
 ####################################################################################################################
 ####################################################################################################################
 ####################################################################################################################
-# Test Suite: Linking
+# Unit Test Suite: Linking
 ####################################################################################################################
 ####################################################################################################################
 ####################################################################################################################
 
 ##########################################################
-# Linking (boxing)
+# Unit Linking (boxing)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_BOXING}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_BOXING}-test
+    message("${MODULE_NAME_BOXING}: Linking libraries for unit test application...")
+    target_link_libraries(${MODULE_NAME_BOXING}-unit-test
             gtest
-            gmock
             gtest_main
             "${MODULE_NAME_BOXING}"
             "${MODULE_NAME_CORE}")
 endif ()
 
 ##########################################################
-# Linking (core)
+# Unit Linking (core)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_CORE}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_CORE}-test
+    message("${MODULE_NAME_CORE}: Linking libraries for unit test application...")
+    target_link_libraries(${MODULE_NAME_CORE}-unit-test
             gtest
             gmock
             gtest_main
@@ -562,67 +615,106 @@ if (${LS_STD_BUILD_WITH_TESTS})
 endif ()
 
 ##########################################################
-# Linking (encoding)
+# Unit Linking (encoding)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_ENCODING}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_ENCODING}-test
+    message("${MODULE_NAME_ENCODING}: Linking libraries for unit test application...")
+    target_link_libraries(${MODULE_NAME_ENCODING}-unit-test
             gtest
-            gmock
             gtest_main
             "${MODULE_NAME_ENCODING}"
             "${MODULE_NAME_CORE}")
 endif ()
 
 ##########################################################
-# Linking (event)
+# Unit Linking (event)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_EVENT}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_EVENT}-test
+    message("${MODULE_NAME_EVENT}: Linking libraries for unit test application...")
+    target_link_libraries(${MODULE_NAME_EVENT}-unit-test
             gtest
-            gmock
             gtest_main
             "${MODULE_NAME_EVENT}"
             "${MODULE_NAME_CORE}")
 endif ()
 
 ##########################################################
-# Linking (io)
+# Unit Linking (io)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_IO}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_IO}-test
+    message("${MODULE_NAME_IO}: Linking libraries for unit test application...")
+    target_link_libraries(${MODULE_NAME_IO}-unit-test
             gtest
-            gmock
             gtest_main
             "${MODULE_NAME_IO}"
             "${MODULE_NAME_CORE}")
 endif ()
 
 ##########################################################
-# Linking (time)
+# Unit Linking (time)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${MODULE_NAME_TIME}: Linking libraries for test application...")
-    target_link_libraries(${MODULE_NAME_TIME}-test
+    message("${MODULE_NAME_TIME}: Linking libraries for unit test application...")
+    target_link_libraries(${MODULE_NAME_TIME}-unit-test
+            gtest
+            gtest_main
+            "${MODULE_NAME_TIME}"
+            "${MODULE_NAME_CORE}")
+endif ()
+
+##########################################################
+# Unit Linking (all)
+##########################################################
+
+if (${LS_STD_BUILD_WITH_TESTS})
+    message("${PROJECT_NAME}: Linking libraries for unit test application...")
+    target_link_libraries(${PROJECT_NAME}-unit-test
             gtest
             gmock
             gtest_main
+            "${MODULE_NAME_BOXING}"
+            "${MODULE_NAME_ENCODING}"
+            "${MODULE_NAME_EVENT}"
+            "${MODULE_NAME_IO}"
             "${MODULE_NAME_TIME}"
             "${MODULE_NAME_CORE}")
 endif ()
 
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+# Integration Test Suite: Linking
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+
 ##########################################################
-# Linking (all)
+# Integration Linking (io)
 ##########################################################
 
 if (${LS_STD_BUILD_WITH_TESTS})
-    message("${PROJECT_NAME}: Linking libraries for test application...")
+    message("${MODULE_NAME_IO}: Linking libraries for integration test application...")
+    target_link_libraries(${MODULE_NAME_IO}-integration-test
+            gtest
+            gtest_main
+            "${MODULE_NAME_IO}"
+            "${MODULE_NAME_CORE}")
+endif ()
+
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+# Whole Test Suite: Linking
+####################################################################################################################
+####################################################################################################################
+####################################################################################################################
+
+if (${LS_STD_BUILD_WITH_TESTS})
+    message("${PROJECT_NAME}: Linking libraries for whole test application...")
     target_link_libraries(${PROJECT_NAME}-test
             gtest
             gmock

+ 40 - 0
include/ls-std/io/section-pair/reader/SectionPairFileReader.hpp

@@ -0,0 +1,40 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-21
+* Changed:         2023-02-21
+*
+* */
+
+#ifndef LS_STD_SECTION_PAIR_FILE_READER_HPP
+#define LS_STD_SECTION_PAIR_FILE_READER_HPP
+
+#include "SectionPairFileReaderParameter.hpp"
+#include <ls-std/core/Class.hpp>
+#include <ls-std/core/interface/IReader.hpp>
+#include <ls-std/os/dynamic-goal.hpp>
+#include <memory>
+
+namespace ls::std::io
+{
+  class LS_STD_DYNAMIC_GOAL SectionPairFileReader : public ls::std::core::Class, public ls::std::core::interface_type::IReader
+  {
+    public:
+
+      explicit SectionPairFileReader(ls::std::io::SectionPairFileReaderParameter _parameter);
+      ~SectionPairFileReader() override;
+
+      [[nodiscard]] ::std::shared_ptr<ls::std::io::SectionPairDocument> getDocument();
+      ls::std::core::type::byte_field read() override; // nodiscard is optional here
+
+    private:
+
+      ls::std::io::SectionPairFileReaderParameter parameter{};
+
+      void _createDocument();
+      void _createReader();
+  };
+}
+
+#endif

+ 43 - 0
include/ls-std/io/section-pair/reader/SectionPairFileReaderParameter.hpp

@@ -0,0 +1,43 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-21
+* Changed:         2023-02-21
+*
+* */
+
+#ifndef LS_STD_SECTION_PAIR_FILE_READER_PARAMETER_HPP
+#define LS_STD_SECTION_PAIR_FILE_READER_PARAMETER_HPP
+
+#include <ls-std/core/interface/IReader.hpp>
+#include <ls-std/io/section-pair/model/SectionPairDocument.hpp>
+#include <ls-std/os/dynamic-goal.hpp>
+#include <memory>
+#include <string>
+
+namespace ls::std::io
+{
+  class LS_STD_DYNAMIC_GOAL SectionPairFileReaderParameter
+  {
+    public:
+
+      SectionPairFileReaderParameter();
+      ~SectionPairFileReaderParameter();
+
+      [[nodiscard]] ::std::shared_ptr<ls::std::io::SectionPairDocument> getDocument();
+      [[nodiscard]] ::std::string getFilePath();
+      void setDocument(const ::std::shared_ptr<ls::std::io::SectionPairDocument> &_document);
+      void setFilePath(const ::std::string &_filePath);
+      [[nodiscard]] ::std::shared_ptr<ls::std::core::interface_type::IReader> getReader();
+      void setReader(const ::std::shared_ptr<core::interface_type::IReader> &_reader);
+
+    private:
+
+      ::std::shared_ptr<ls::std::io::SectionPairDocument> document{};
+      ::std::string filePath{};
+      ::std::shared_ptr<ls::std::core::interface_type::IReader> reader{};
+  };
+}
+
+#endif

+ 2 - 2
include/ls-std/ls-std-io.hpp

@@ -30,8 +30,8 @@
 #include <ls-std/io/section-pair/model/SectionPairRowSingleValue.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRowValue.hpp>
 #include <ls-std/io/section-pair/model/SectionPairSection.hpp>
-//#include <ls-std/io/section-pair/reader/SectionPairFileReader.hpp>
-//#include <ls-std/io/section-pair/reader/SectionPairFileReaderParameter.hpp>
+#include <ls-std/io/section-pair/reader/SectionPairFileReader.hpp>
+#include <ls-std/io/section-pair/reader/SectionPairFileReaderParameter.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairDocument.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairParameter.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairRow.hpp>

+ 50 - 0
source/ls-std/io/section-pair/reader/SectionPairFileReader.cpp

@@ -0,0 +1,50 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-21
+* Changed:         2023-02-21
+*
+* */
+
+#include <ls-std/core/ConditionalFunctionExecutor.hpp>
+#include <ls-std/io/FileReader.hpp>
+#include <ls-std/io/evaluator/FileExistenceEvaluator.hpp>
+#include <ls-std/io/section-pair/model/SectionPairDocument.hpp>
+#include <ls-std/io/section-pair/reader/SectionPairFileReader.hpp>
+#include <memory>
+
+ls::std::io::SectionPairFileReader::SectionPairFileReader(SectionPairFileReaderParameter _parameter) : ls::std::core::Class("SectionPairFileReader")
+{
+  ls::std::io::FileExistenceEvaluator{_parameter.getFilePath()}.evaluate();
+  this->parameter = _parameter;
+  ls::std::core::ConditionalFunctionExecutor{this->parameter.getReader() == nullptr}.execute([this] { _createReader(); });
+  ls::std::core::ConditionalFunctionExecutor{this->parameter.getDocument() == nullptr}.execute([this] { _createDocument(); });
+}
+
+ls::std::io::SectionPairFileReader::~SectionPairFileReader() = default;
+
+::std::shared_ptr<ls::std::io::SectionPairDocument> ls::std::io::SectionPairFileReader::getDocument()
+{
+  return this->parameter.getDocument();
+}
+
+ls::std::core::type::byte_field ls::std::io::SectionPairFileReader::read()
+{
+  this->parameter.getDocument()->clear();
+  ls::std::core::type::byte_field data = this->parameter.getReader()->read();
+  this->parameter.getDocument()->unmarshal(data);
+
+  return data;
+}
+
+void ls::std::io::SectionPairFileReader::_createDocument()
+{
+  this->parameter.setDocument(::std::make_shared<ls::std::io::SectionPairDocument>());
+}
+
+void ls::std::io::SectionPairFileReader::_createReader()
+{
+  ls::std::io::File file{this->parameter.getFilePath()};
+  this->parameter.setReader(::std::make_shared<ls::std::io::FileReader>(file));
+}

+ 44 - 0
source/ls-std/io/section-pair/reader/SectionPairFileReaderParameter.cpp

@@ -0,0 +1,44 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-21
+* Changed:         2023-02-21
+*
+* */
+
+#include <ls-std/io/section-pair/reader/SectionPairFileReaderParameter.hpp>
+
+ls::std::io::SectionPairFileReaderParameter::SectionPairFileReaderParameter() = default;
+
+ls::std::io::SectionPairFileReaderParameter::~SectionPairFileReaderParameter() = default;
+
+::std::shared_ptr<ls::std::io::SectionPairDocument> ls::std::io::SectionPairFileReaderParameter::getDocument()
+{
+  return this->document;
+}
+
+::std::string ls::std::io::SectionPairFileReaderParameter::getFilePath()
+{
+  return this->filePath;
+}
+
+::std::shared_ptr<ls::std::core::interface_type::IReader> ls::std::io::SectionPairFileReaderParameter::getReader()
+{
+  return this->reader;
+}
+
+void ls::std::io::SectionPairFileReaderParameter::setDocument(const ::std::shared_ptr<ls::std::io::SectionPairDocument> &_document)
+{
+  this->document = _document;
+}
+
+void ls::std::io::SectionPairFileReaderParameter::setFilePath(const ::std::string &_filePath)
+{
+  this->filePath = _filePath;
+}
+
+void ls::std::io::SectionPairFileReaderParameter::setReader(const ::std::shared_ptr<core::interface_type::IReader> &_reader)
+{
+  this->reader = _reader;
+}

+ 86 - 0
test/cases/io/section-pair/reader/SectionPairFileReaderIT.cpp

@@ -0,0 +1,86 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-21
+* Changed:         2023-02-21
+*
+* */
+
+#include <classes/TestHelper.hpp>
+#include <gtest/gtest.h>
+#include <ls-std/ls-std-core.hpp>
+#include <ls-std/ls-std-io.hpp>
+#include <string>
+
+using namespace ls::std::core;
+using namespace ls::std::io;
+using namespace ::std;
+using namespace ls::std::test;
+
+namespace
+{
+  class SectionPairFileReaderIT : public ::testing::Test
+  {
+    protected:
+
+      SectionPairFileReaderIT() = default;
+      ~SectionPairFileReaderIT() override = default;
+
+      void SetUp() override
+      {}
+
+      void TearDown() override
+      {}
+
+      static string getSectionPairFileLocation()
+      {
+        return TestHelper::getResourcesFolderLocation() + "server-settings-unix.txt";
+      }
+  };
+
+  TEST_F(SectionPairFileReaderIT, constructor_file_does_not_exist)
+  {
+    EXPECT_THROW(
+        {
+          try
+          {
+            SectionPairFileReader reader{SectionPairFileReaderParameter{}};
+          }
+          catch (const FileNotFoundException &_exception)
+          {
+            throw;
+          }
+        },
+        FileNotFoundException);
+  }
+
+  TEST_F(SectionPairFileReaderIT, getClassName)
+  {
+    SectionPairFileReaderParameter parameter{};
+    parameter.setFilePath(SectionPairFileReaderIT::getSectionPairFileLocation());
+
+    ASSERT_STREQ("SectionPairFileReader", SectionPairFileReader{parameter}.getClassName().c_str());
+  }
+
+  TEST_F(SectionPairFileReaderIT, getDocument)
+  {
+    SectionPairFileReaderParameter parameter{};
+    parameter.setFilePath(SectionPairFileReaderIT::getSectionPairFileLocation());
+    SectionPairFileReader reader{parameter};
+
+    ASSERT_FALSE(reader.getDocument() == nullptr);
+  }
+
+  TEST_F(SectionPairFileReaderIT, read)
+  {
+    SectionPairFileReaderParameter parameter{};
+    parameter.setFilePath(SectionPairFileReaderIT::getSectionPairFileLocation());
+    SectionPairFileReader reader{parameter};
+    reader.read();
+
+    ASSERT_TRUE(!reader.getDocument()->getSectionList().empty());
+    ASSERT_STREQ("general", reader.getDocument()->get(0)->getSectionId().c_str());
+    ASSERT_EQ(2, reader.getDocument()->get(0)->getRowAmount());
+  }
+}

+ 62 - 0
test/cases/io/section-pair/reader/SectionPairFileReaderParameterTest.cpp

@@ -0,0 +1,62 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-21
+* Changed:         2023-02-21
+*
+* */
+
+#include <gtest/gtest.h>
+#include <ls-std/ls-std-io.hpp>
+
+using namespace ls::std::io;
+using namespace ::std;
+
+namespace
+{
+  class SectionPairFileReaderParameterTest : public ::testing::Test
+  {
+    protected:
+
+      SectionPairFileReaderParameterTest() = default;
+      ~SectionPairFileReaderParameterTest() override = default;
+
+      void SetUp() override
+      {}
+
+      void TearDown() override
+      {}
+  };
+
+  TEST_F(SectionPairFileReaderParameterTest, getDocument)
+  {
+    ASSERT_TRUE(SectionPairFileReaderParameter{}.getDocument() == nullptr);
+  }
+
+  TEST_F(SectionPairFileReaderParameterTest, getFilePath)
+  {
+    ASSERT_TRUE(SectionPairFileReaderParameter{}.getFilePath().empty());
+  }
+
+  TEST_F(SectionPairFileReaderParameterTest, getReader)
+  {
+    ASSERT_TRUE(SectionPairFileReaderParameter{}.getReader() == nullptr);
+  }
+
+  TEST_F(SectionPairFileReaderParameterTest, setDocument)
+  {
+    SectionPairFileReaderParameter parameter{};
+    parameter.setDocument(make_shared<SectionPairDocument>());
+
+    ASSERT_FALSE(parameter.getDocument() == nullptr);
+  }
+
+  TEST_F(SectionPairFileReaderParameterTest, setFilePath)
+  {
+    SectionPairFileReaderParameter parameter{};
+    parameter.setFilePath("var/log/log.txt");
+
+    ASSERT_FALSE(parameter.getFilePath().empty());
+  }
+}

+ 9 - 0
test/resources/server-settings-unix.txt

@@ -0,0 +1,9 @@
+# section-pair document
+
+[general]
+
+ports:
+  9090
+  8001
+  1989
+host=localhost