Переглянути джерело

Allow OS specific new line for section pair serialization classes

Patrick-Christopher Mattulat 2 роки тому
батько
коміт
42dfc1dc30
43 змінених файлів з 676 додано та 275 видалено
  1. 3 0
      CMakeLists.txt
  2. 4 1
      include/ls-std/io/section-pair/model/SectionPairRow.hpp
  3. 3 1
      include/ls-std/io/section-pair/model/SectionPairRowValue.hpp
  4. 4 1
      include/ls-std/io/section-pair/model/SectionPairSection.hpp
  5. 7 7
      include/ls-std/io/section-pair/serialization/SerializableSectionPairDocument.hpp
  6. 39 0
      include/ls-std/io/section-pair/serialization/SerializableSectionPairParameter.hpp
  7. 3 3
      include/ls-std/io/section-pair/serialization/SerializableSectionPairRow.hpp
  8. 4 4
      include/ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.hpp
  9. 3 4
      include/ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.hpp
  10. 7 7
      include/ls-std/io/section-pair/serialization/SerializableSectionPairSection.hpp
  11. 4 2
      include/ls-std/io/section-pair/validator/SectionPairSectionIdUnmarshalValidator.hpp
  12. 2 1
      include/ls-std/ls-std-io.hpp
  13. 4 2
      source/ls-std/io/section-pair/model/SectionPairDocument.cpp
  14. 15 2
      source/ls-std/io/section-pair/model/SectionPairRow.cpp
  15. 10 2
      source/ls-std/io/section-pair/model/SectionPairRowListValue.cpp
  16. 11 3
      source/ls-std/io/section-pair/model/SectionPairRowSingleValue.cpp
  17. 6 1
      source/ls-std/io/section-pair/model/SectionPairRowValue.cpp
  18. 15 2
      source/ls-std/io/section-pair/model/SectionPairSection.cpp
  19. 19 21
      source/ls-std/io/section-pair/serialization/SerializableSectionPairDocument.cpp
  20. 36 0
      source/ls-std/io/section-pair/serialization/SerializableSectionPairParameter.cpp
  21. 16 19
      source/ls-std/io/section-pair/serialization/SerializableSectionPairRow.cpp
  22. 14 18
      source/ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.cpp
  23. 7 12
      source/ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.cpp
  24. 21 23
      source/ls-std/io/section-pair/serialization/SerializableSectionPairSection.cpp
  25. 6 2
      source/ls-std/io/section-pair/validator/SectionPairRowValueValidator.cpp
  26. 5 6
      source/ls-std/io/section-pair/validator/SectionPairSectionIdUnmarshalValidator.cpp
  27. 3 3
      test/cases/io/section-pair/model/SectionPairDocumentTest.cpp
  28. 3 3
      test/cases/io/section-pair/model/SectionPairSectionTest.cpp
  29. 36 10
      test/cases/io/section-pair/serialization/SerializableSectionPairDocumentTest.cpp
  30. 60 0
      test/cases/io/section-pair/serialization/SerializableSectionPairParameterTest.cpp
  31. 38 11
      test/cases/io/section-pair/serialization/SerializableSectionPairRowListValueTest.cpp
  32. 36 11
      test/cases/io/section-pair/serialization/SerializableSectionPairRowSingleValueTest.cpp
  33. 50 36
      test/cases/io/section-pair/serialization/SerializableSectionPairRowTest.cpp
  34. 49 17
      test/cases/io/section-pair/serialization/SerializableSectionPairSectionTest.cpp
  35. 2 1
      test/cases/io/section-pair/validator/SectionPairRowValueValidatorTest.cpp
  36. 7 7
      test/cases/io/section-pair/validator/SectionPairSectionIdUnmarshalValidatorTest.cpp
  37. 8 9
      test/classes/io/section-pair/SectionPairDocumentProvider.cpp
  38. 3 2
      test/classes/io/section-pair/SectionPairDocumentProvider.hpp
  39. 14 17
      test/classes/io/section-pair/SectionPairSectionProvider.cpp
  40. 4 3
      test/classes/io/section-pair/SectionPairSectionProvider.hpp
  41. 60 0
      test/classes/io/section-pair/SerializableSectionPairRowProvider.cpp
  42. 33 0
      test/classes/io/section-pair/SerializableSectionPairRowProvider.hpp
  43. 2 1
      test/ls-std-io-test.hpp

+ 3 - 0
CMakeLists.txt

@@ -182,6 +182,7 @@ set(SOURCE_FILES_IO
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairRowValueValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairSectionIdUnmarshalValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairDocument.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairParameter.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRow.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.cpp
@@ -278,6 +279,7 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${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/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
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairRowSingleValueTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairRowTest.cpp
@@ -298,6 +300,7 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/StorableFileTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/section-pair/SectionPairDocumentProvider.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/section-pair/SectionPairSectionProvider.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/section-pair/SerializableSectionPairRowProvider.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/TestDataFactory.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/classes/io/xml/XmlParserTestWrapper.cpp)
 

+ 4 - 1
include/ls-std/io/section-pair/model/SectionPairRow.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-08
-* Changed:         2023-02-13
+* Changed:         2023-02-17
 *
 * */
 
@@ -17,6 +17,7 @@
 #include <ls-std/io/section-pair/model/SectionPairRowValue.hpp>
 #include <ls-std/os/dynamic-goal.hpp>
 #include <memory>
+#include <string>
 
 namespace ls::std::io
 {
@@ -32,12 +33,14 @@ namespace ls::std::io
       [[nodiscard]] bool isList();
       [[nodiscard]] bool isSingleValue();
       [[nodiscard]] ls::std::core::type::byte_field marshal() override;
+      void reserveNewLine(const ::std::string &_reservedNewLine);
       void setKey(const ls::std::io::section_pair_identifier &_key);
       void unmarshal(const ls::std::core::type::byte_field &_data) override;
 
     private:
 
       ls::std::io::section_pair_identifier key{};
+      ::std::string reservedNewLine{};
       ::std::shared_ptr<ls::std::core::interface_type::ISerializable> serializable{};
       ::std::shared_ptr<ls::std::io::SectionPairRowValue> value{};
 

+ 3 - 1
include/ls-std/io/section-pair/model/SectionPairRowValue.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -25,10 +25,12 @@ namespace ls::std::io
 
       virtual ls::std::io::SectionPairRowEnumType getType() = 0;
       [[nodiscard]] ls::std::core::type::byte_field marshal() override;
+      void reserveNewLine(const ::std::string &_reservedNewLine);
       void unmarshal(const ls::std::core::type::byte_field &_data) override;
 
     protected:
 
+      ::std::string reservedNewLine{};
       ls::std::io::SectionPairRowEnumType type{};
   };
 }

+ 4 - 1
include/ls-std/io/section-pair/model/SectionPairSection.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-13
-* Changed:         2023-02-16
+* Changed:         2023-02-18
 *
 * */
 
@@ -17,6 +17,7 @@
 #include <ls-std/io/section-pair/type/SectionPairSectionTypes.hpp>
 #include <ls-std/os/dynamic-goal.hpp>
 #include <memory>
+#include <string>
 
 namespace ls::std::io
 {
@@ -34,11 +35,13 @@ namespace ls::std::io
       [[nodiscard]] size_t getRowAmount();
       [[nodiscard]] ls::std::io::section_pair_identifier getSectionId();
       [[nodiscard]] ls::std::core::type::byte_field marshal() override;
+      void reserveNewLine(const ::std::string &_reservedNewLine);
       void setSectionId(const ls::std::io::section_pair_identifier &_sectionId);
       void unmarshal(const ls::std::core::type::byte_field &_data) override;
 
     private:
 
+      ::std::string reservedNewLine{};
       ls::std::io::section_pair_row_list rows{};
       ls::std::io::section_pair_identifier sectionId{};
       ::std::shared_ptr<ls::std::core::interface_type::ISerializable> serializable{};

+ 7 - 7
include/ls-std/io/section-pair/serialization/SerializableSectionPairDocument.hpp

@@ -3,13 +3,14 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-16
-* Changed:         2023-02-17
+* Changed:         2023-02-18
 *
 * */
 
 #ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_DOCUMENT_HPP
 #define LS_STD_SERIALIZABLE_SECTION_PAIR_DOCUMENT_HPP
 
+#include "SerializableSectionPairParameter.hpp"
 #include <ls-std/core/Class.hpp>
 #include <ls-std/core/interface/ISerializable.hpp>
 #include <ls-std/os/dynamic-goal.hpp>
@@ -21,7 +22,7 @@ namespace ls::std::io
   {
     public:
 
-      explicit SerializableSectionPairDocument(const ::std::shared_ptr<ls::std::core::Class> &_value);
+      explicit SerializableSectionPairDocument(const ls::std::io::SerializableSectionPairParameter &_parameter);
       ~SerializableSectionPairDocument() override;
 
       [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getValue();
@@ -30,12 +31,11 @@ namespace ls::std::io
 
     private:
 
-      ::std::shared_ptr<ls::std::core::Class> value{};
+      ls::std::io::SerializableSectionPairParameter parameter{};
 
-      [[nodiscard]] static core::type::byte_field _getCurrentRow(size_t _iterations, const ls::std::core::type::byte_field &_serializedDocument);
-      [[nodiscard]] static ls::std::core::type::byte_field _getNextSerializedSection(const ls::std::core::type::byte_field &_serializedDocument);
-      [[nodiscard]] static bool _isNotNewSection(const ls::std::core::type::byte_field &_currentRow);
-      void _setValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
+      [[nodiscard]] ls::std::core::type::byte_field _getCurrentRow(size_t _iterations, const ls::std::core::type::byte_field &_serializedDocument);
+      [[nodiscard]] ls::std::core::type::byte_field _getNextSerializedSection(const ls::std::core::type::byte_field &_serializedDocument);
+      [[nodiscard]] bool _isNotNewSection(const ls::std::core::type::byte_field &_currentRow);
       void _addSection(const ls::std::core::type::byte_field &_serializedSection);
   };
 }

+ 39 - 0
include/ls-std/io/section-pair/serialization/SerializableSectionPairParameter.hpp

@@ -0,0 +1,39 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-17
+* Changed:         2023-02-17
+*
+* */
+
+#ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_PARAMETER_HPP
+#define LS_STD_SERIALIZABLE_SECTION_PAIR_PARAMETER_HPP
+
+#include <ls-std/core/Class.hpp>
+#include <ls-std/os/dynamic-goal.hpp>
+#include <memory>
+#include <string>
+
+namespace ls::std::io
+{
+  class LS_STD_DYNAMIC_GOAL SerializableSectionPairParameter
+  {
+    public:
+
+      SerializableSectionPairParameter();
+      ~SerializableSectionPairParameter();
+
+      [[nodiscard]] ::std::string getNewLine();
+      [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getValue() const;
+      void setNewLine(const ::std::string &_newLine);
+      void setValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
+
+    private:
+
+      ::std::string parseNewLine{};
+      ::std::shared_ptr<ls::std::core::Class> value{};
+  };
+}
+
+#endif

+ 3 - 3
include/ls-std/io/section-pair/serialization/SerializableSectionPairRow.hpp

@@ -10,6 +10,7 @@
 #ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_HPP
 #define LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_HPP
 
+#include "SerializableSectionPairParameter.hpp"
 #include <ls-std/core/Class.hpp>
 #include <ls-std/core/interface/ISerializable.hpp>
 #include <memory>
@@ -21,7 +22,7 @@ namespace ls::std::io
   {
     public:
 
-      explicit SerializableSectionPairRow(const ::std::shared_ptr<ls::std::core::Class> &_value);
+      explicit SerializableSectionPairRow(const ls::std::io::SerializableSectionPairParameter &_parameter);
       ~SerializableSectionPairRow() override;
 
       [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getValue();
@@ -30,10 +31,9 @@ namespace ls::std::io
 
     private:
 
-      ::std::shared_ptr<ls::std::core::Class> value{};
+      ls::std::io::SerializableSectionPairParameter parameter{};
 
       [[nodiscard]] ::std::string _marshalKey();
-      void _setValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
       void _unmarshalListValue(const ls::std::core::type::byte_field &_data);
       void _unmarshalSingleValue(const ls::std::core::type::byte_field &_data);
   };

+ 4 - 4
include/ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.hpp

@@ -10,6 +10,7 @@
 #ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_LIST_VALUE_HPP
 #define LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_LIST_VALUE_HPP
 
+#include "SerializableSectionPairParameter.hpp"
 #include <ls-std/core/Class.hpp>
 #include <ls-std/core/interface/ISerializable.hpp>
 #include <ls-std/os/dynamic-goal.hpp>
@@ -21,7 +22,7 @@ namespace ls::std::io
   {
     public:
 
-      explicit SerializableSectionPairRowListValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
+      explicit SerializableSectionPairRowListValue(const ls::std::io::SerializableSectionPairParameter &_parameter);
       ~SerializableSectionPairRowListValue() override;
 
       [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getValue();
@@ -30,11 +31,10 @@ namespace ls::std::io
 
     private:
 
-      ::std::shared_ptr<ls::std::core::Class> value{};
+      ls::std::io::SerializableSectionPairParameter parameter{};
 
       [[nodiscard]] static ::std::string _getLine(::std::string::size_type _position, const ls::std::core::type::byte_field &_searchText);
-      void _setValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
-      static void _updateSearchText(::std::string::size_type _position, ls::std::core::type::byte_field &_searchText);
+      void _updateSearchText(::std::string::size_type _position, ls::std::core::type::byte_field &_searchText);
   };
 }
 

+ 3 - 4
include/ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.hpp

@@ -10,6 +10,7 @@
 #ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_SINGLE_VALUE_HPP
 #define LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_SINGLE_VALUE_HPP
 
+#include "SerializableSectionPairParameter.hpp"
 #include <ls-std/core/Class.hpp>
 #include <ls-std/core/interface/ISerializable.hpp>
 #include <ls-std/os/dynamic-goal.hpp>
@@ -21,7 +22,7 @@ namespace ls::std::io
   {
     public:
 
-      explicit SerializableSectionPairRowSingleValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
+      explicit SerializableSectionPairRowSingleValue(const ls::std::io::SerializableSectionPairParameter &_parameter);
       ~SerializableSectionPairRowSingleValue() override;
 
       [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getValue();
@@ -30,9 +31,7 @@ namespace ls::std::io
 
     private:
 
-      ::std::shared_ptr<ls::std::core::Class> value{};
-
-      void _setValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
+      ls::std::io::SerializableSectionPairParameter parameter{};
   };
 }
 

+ 7 - 7
include/ls-std/io/section-pair/serialization/SerializableSectionPairSection.hpp

@@ -10,6 +10,7 @@
 #ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_SECTION_HPP
 #define LS_STD_SERIALIZABLE_SECTION_PAIR_SECTION_HPP
 
+#include "SerializableSectionPairParameter.hpp"
 #include <ls-std/core/Class.hpp>
 #include <ls-std/core/interface/ISerializable.hpp>
 #include <ls-std/io/section-pair/SectionPairRowEnumType.hpp>
@@ -21,7 +22,7 @@ namespace ls::std::io
   {
     public:
 
-      explicit SerializableSectionPairSection(const ::std::shared_ptr<ls::std::core::Class> &_value);
+      explicit SerializableSectionPairSection(const ls::std::io::SerializableSectionPairParameter &_parameter);
       ~SerializableSectionPairSection() override;
 
       [[nodiscard]] ::std::shared_ptr<ls::std::core::Class> getValue();
@@ -30,21 +31,20 @@ namespace ls::std::io
 
     private:
 
-      ::std::shared_ptr<ls::std::core::Class> value{};
+      ls::std::io::SerializableSectionPairParameter parameter{};
 
-      static void _checkSectionHeader(const ls::std::core::type::byte_field &_sectionHeader);
-      [[nodiscard]] static ls::std::core::type::byte_field _collectSectionRow(const ls::std::core::type::byte_field &_currentRows, ls::std::io::SectionPairRowEnumType &_type);
-      [[nodiscard]] static core::type::byte_field _collectSectionListValueRow(const core::type::byte_field &_currentRows, SectionPairRowEnumType &_type);
+      void _checkSectionHeader(const ls::std::core::type::byte_field &_sectionHeader);
+      [[nodiscard]] ls::std::core::type::byte_field _collectSectionRow(const ls::std::core::type::byte_field &_currentRows, ls::std::io::SectionPairRowEnumType &_type);
+      [[nodiscard]] ls::std::core::type::byte_field _collectSectionListValueRow(const core::type::byte_field &_currentRows, SectionPairRowEnumType &_type);
       [[nodiscard]] static core::type::byte_field _collectSectionSingleValueRow(const ls::std::core::type::byte_field &_firstRow, SectionPairRowEnumType &type);
       [[nodiscard]] static size_t _getNthSubStringPosition(const ls::std::core::type::byte_field &_text, const ls::std::core::type::byte_field &_subText);
-      [[nodiscard]] static ls::std::core::type::byte_field _getSectionHeader(const ls::std::core::type::byte_field &_data);
+      [[nodiscard]] ls::std::core::type::byte_field _getSectionHeader(const ls::std::core::type::byte_field &_data);
       [[nodiscard]] static ls::std::core::type::byte_field _getSectionId(const ls::std::core::type::byte_field &_sectionHeader);
       [[nodiscard]] static bool _isListValueRow(const ::std::string &_currentRow);
       [[nodiscard]] static bool _isStartingValueRow(const ::std::string &_currentRow);
       [[nodiscard]] static bool _isSingleValueRow(const ::std::string &_currentRow);
       [[nodiscard]] ls::std::core::type::byte_field _marshalRows();
       [[nodiscard]] ls::std::core::type::byte_field _marshalSectionId();
-      void _setValue(const ::std::shared_ptr<ls::std::core::Class> &_value);
       void _unmarshalRow(const ::std::string &_sectionRow, ls::std::io::SectionPairRowEnumType _type);
       void _unmarshalRows(const ls::std::core::type::byte_field &_serializedRows);
       [[nodiscard]] size_t _unmarshalSectionHeader(const ls::std::core::type::byte_field &_data);

+ 4 - 2
include/ls-std/io/section-pair/validator/SectionPairSectionIdUnmarshalValidator.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-14
-* Changed:         2023-02-15
+* Changed:         2023-02-17
 *
 * */
 
@@ -14,6 +14,7 @@
 #include <ls-std/core/interface/IValidator.hpp>
 #include <ls-std/core/type/Types.hpp>
 #include <ls-std/os/dynamic-goal.hpp>
+#include <string>
 
 namespace ls::std::io
 {
@@ -21,7 +22,7 @@ namespace ls::std::io
   {
     public:
 
-      explicit SectionPairSectionIdUnmarshalValidator(ls::std::core::type::byte_field _data);
+      explicit SectionPairSectionIdUnmarshalValidator(ls::std::core::type::byte_field _data, ::std::string _newLine);
       ~SectionPairSectionIdUnmarshalValidator() override;
 
       [[nodiscard]] bool isValid() override;
@@ -29,6 +30,7 @@ namespace ls::std::io
     private:
 
       ls::std::core::type::byte_field data{};
+      ::std::string newLine{};
 
       [[nodiscard]] static bool _isValidSection(const ls::std::core::type::byte_field &_bracketsNotation);
       [[nodiscard]] static ls::std::core::type::byte_field _trimStartAndEnd(const ls::std::core::type::byte_field &_trimmedWord, const ls::std::core::type::byte_field &_beginningTrimWord, const ls::std::core::type::byte_field &_endingTrimWord);

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

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-11
- * Changed:         2023-02-16
+ * Changed:         2023-02-17
  *
  * */
 
@@ -25,6 +25,7 @@
 #include <ls-std/io/section-pair/model/SectionPairRowValue.hpp>
 #include <ls-std/io/section-pair/model/SectionPairSection.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>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.hpp>

+ 4 - 2
source/ls-std/io/section-pair/model/SectionPairDocument.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-15
-* Changed:         2023-02-16
+* Changed:         2023-02-18
 *
 * */
 
@@ -89,7 +89,9 @@ void ls::std::io::SectionPairDocument::_checkSectionExistence(const ls::std::io:
 
 void ls::std::io::SectionPairDocument::_createSerializable()
 {
-  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairDocument>(shared_from_this());
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setValue(shared_from_this());
+  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairDocument>(parameter);
 }
 
 bool ls::std::io::SectionPairDocument::_hasSection(const ls::std::io::section_pair_identifier &_identifier)

+ 15 - 2
source/ls-std/io/section-pair/model/SectionPairRow.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-08
-* Changed:         2023-02-13
+* Changed:         2023-02-17
 *
 * */
 
@@ -50,6 +50,11 @@ ls::std::core::type::byte_field ls::std::io::SectionPairRow::marshal()
   return this->serializable->marshal();
 }
 
+void ls::std::io::SectionPairRow::reserveNewLine(const ::std::string &_reservedNewLine)
+{
+  this->reservedNewLine = _reservedNewLine;
+}
+
 void ls::std::io::SectionPairRow::setKey(const ls::std::io::section_pair_identifier &_key)
 {
   this->_setKey(_key);
@@ -63,7 +68,15 @@ void ls::std::io::SectionPairRow::unmarshal(const ls::std::core::type::byte_fiel
 
 void ls::std::io::SectionPairRow::_createSerializable()
 {
-  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairRow>(shared_from_this());
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setValue(shared_from_this());
+
+  if (!this->reservedNewLine.empty())
+  {
+    parameter.setNewLine(this->reservedNewLine);
+  }
+
+  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairRow>(parameter);
 }
 
 void ls::std::io::SectionPairRow::_initValue(const ls::std::io::SectionPairRowEnumType &_type)

+ 10 - 2
source/ls-std/io/section-pair/model/SectionPairRowListValue.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -81,5 +81,13 @@ void ls::std::io::SectionPairRowListValue::unmarshal(const ls::std::core::type::
 
 void ls::std::io::SectionPairRowListValue::_createSerializable()
 {
-  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairRowListValue>(shared_from_this());
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setValue(shared_from_this());
+
+  if (!this->reservedNewLine.empty())
+  {
+    parameter.setNewLine(this->reservedNewLine);
+  }
+
+  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairRowListValue>(parameter);
 }

+ 11 - 3
source/ls-std/io/section-pair/model/SectionPairRowSingleValue.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-02-15
+* Changed:         2023-02-17
 *
 * */
 
@@ -50,14 +50,22 @@ void ls::std::io::SectionPairRowSingleValue::unmarshal(const ls::std::core::type
 
 void ls::std::io::SectionPairRowSingleValue::_createSerializable()
 {
-  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairRowSingleValue>(shared_from_this());
+  SerializableSectionPairParameter parameter{};
+  parameter.setValue(shared_from_this());
+
+  if (!this->reservedNewLine.empty())
+  {
+    parameter.setNewLine(this->reservedNewLine);
+  }
+
+  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairRowSingleValue>(parameter);
 }
 
 void ls::std::io::SectionPairRowSingleValue::_set(const ls::std::io::section_pair_row_value &_value)
 {
   ls::std::core::EmptyStringArgumentEvaluator{_value}.evaluate();
   ls::std::io::SectionPairRowValueArgumentEvaluator(_value, this->getClassName() + ": section pair single value \"" + _value + "\" contains invalid characters!").evaluate();
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::string newLine = this->reservedNewLine.empty() ? NewLine::get() : this->reservedNewLine;
   this->value = _value;
 
   if (this->value.find(newLine) != ::std::string::npos)

+ 6 - 1
source/ls-std/io/section-pair/model/SectionPairRowValue.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-02-11
+* Changed:         2023-02-17
 *
 * */
 
@@ -19,5 +19,10 @@ ls::std::core::type::byte_field ls::std::io::SectionPairRowValue::marshal()
   return ls::std::core::type::byte_field{};
 }
 
+void ls::std::io::SectionPairRowValue::reserveNewLine(const ::std::string &_reservedNewLine)
+{
+  this->reservedNewLine = _reservedNewLine;
+}
+
 void ls::std::io::SectionPairRowValue::unmarshal(const ls::std::core::type::byte_field &_data)
 {}

+ 15 - 2
source/ls-std/io/section-pair/model/SectionPairSection.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-13
-* Changed:         2023-02-16
+* Changed:         2023-02-18
 *
 * */
 
@@ -76,6 +76,11 @@ ls::std::core::type::byte_field ls::std::io::SectionPairSection::marshal()
   return this->serializable->marshal();
 }
 
+void ls::std::io::SectionPairSection::reserveNewLine(const ::std::string &_reservedNewLine)
+{
+  this->reservedNewLine = _reservedNewLine;
+}
+
 void ls::std::io::SectionPairSection::setSectionId(const ls::std::io::section_pair_identifier &_sectionId)
 {
   this->_setSectionId(_sectionId);
@@ -89,7 +94,15 @@ void ls::std::io::SectionPairSection::unmarshal(const ls::std::core::type::byte_
 
 void ls::std::io::SectionPairSection::_createSerializable()
 {
-  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairSection>(shared_from_this());
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setValue(shared_from_this());
+
+  if (!this->reservedNewLine.empty())
+  {
+    parameter.setNewLine(this->reservedNewLine);
+  }
+
+  this->serializable = ::std::make_shared<ls::std::io::SerializableSectionPairSection>(parameter);
 }
 
 bool ls::std::io::SectionPairSection::_hasRow(const ls::std::io::section_pair_identifier &_key)

+ 19 - 21
source/ls-std/io/section-pair/serialization/SerializableSectionPairDocument.cpp

@@ -3,35 +3,38 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-16
-* Changed:         2023-02-17
+* Changed:         2023-02-18
 *
 * */
 
 #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
-#include <ls-std/io/NewLine.hpp>
 #include <ls-std/io/section-pair/model/SectionPairDocument.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairDocument.hpp>
+#include <string>
 
-ls::std::io::SerializableSectionPairDocument::SerializableSectionPairDocument(const ::std::shared_ptr<ls::std::core::Class> &_value) : ls::std::core::Class("SerializableSectionPairDocument")
+ls::std::io::SerializableSectionPairDocument::SerializableSectionPairDocument(const ls::std::io::SerializableSectionPairParameter &_parameter) : ls::std::core::Class("SerializableSectionPairDocument")
 {
-  this->_setValue(_value);
+  ::std::string message = this->getClassName() + ": model reference is null!";
+  ls::std::core::NullPointerArgumentEvaluator{_parameter.getValue(), message}.evaluate();
+  this->parameter = _parameter;
 }
 
 ls::std::io::SerializableSectionPairDocument::~SerializableSectionPairDocument() = default;
 
 ::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairDocument::getValue()
 {
-  return this->value;
+  return this->parameter.getValue();
 }
 
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairDocument::marshal()
 {
-  ::std::shared_ptr<ls::std::io::SectionPairDocument> document = ::std::dynamic_pointer_cast<ls::std::io::SectionPairDocument>(this->value);
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::shared_ptr<ls::std::io::SectionPairDocument> document = ::std::dynamic_pointer_cast<ls::std::io::SectionPairDocument>(this->parameter.getValue());
+  ::std::string newLine = this->parameter.getNewLine();
   ls::std::core::type::byte_field serializedDocument = document->getHeader() + newLine + newLine;
 
   for (const auto &_section : document->getSectionList())
   {
+    _section->reserveNewLine(this->parameter.getNewLine());
     serializedDocument += _section->marshal();
   }
 
@@ -41,13 +44,13 @@ ls::std::core::type::byte_field ls::std::io::SerializableSectionPairDocument::ma
 void ls::std::io::SerializableSectionPairDocument::unmarshal(const ls::std::core::type::byte_field &_data)
 {
   ls::std::core::type::byte_field serializedDocument = _data;
-  size_t headerSize = ::std::dynamic_pointer_cast<ls::std::io::SectionPairDocument>(this->value)->getHeader().size() + 2 * ls::std::io::NewLine::get().size();
+  size_t headerSize = ::std::dynamic_pointer_cast<ls::std::io::SectionPairDocument>(this->parameter.getValue())->getHeader().size() + 2 * this->parameter.getNewLine().size();
   serializedDocument = serializedDocument.substr(headerSize);
   ls::std::core::type::byte_field serializedSection{};
 
   do
   {
-    serializedSection = ls::std::io::SerializableSectionPairDocument::_getNextSerializedSection(serializedDocument);
+    serializedSection = this->_getNextSerializedSection(serializedDocument);
     this->_addSection(serializedSection);
     serializedDocument = serializedDocument.substr(serializedSection.size());
   } while (!serializedDocument.empty());
@@ -56,13 +59,14 @@ void ls::std::io::SerializableSectionPairDocument::unmarshal(const ls::std::core
 void ls::std::io::SerializableSectionPairDocument::_addSection(const ls::std::core::type::byte_field &_serializedSection)
 {
   ::std::shared_ptr<ls::std::io::SectionPairSection> section = ::std::make_shared<ls::std::io::SectionPairSection>("tmp-id");
+  section->reserveNewLine(this->parameter.getNewLine());
   section->unmarshal(_serializedSection);
-  ::std::dynamic_pointer_cast<ls::std::io::SectionPairDocument>(this->value)->add(section);
+  ::std::dynamic_pointer_cast<ls::std::io::SectionPairDocument>(this->parameter.getValue())->add(section);
 }
 
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairDocument::_getCurrentRow(size_t _iterations, const ls::std::core::type::byte_field &_serializedDocument)
 {
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::string newLine = this->parameter.getNewLine();
   ::std::string currentRow{};
 
   if (_iterations == 1 || _serializedDocument.find('[') != ::std::string::npos)
@@ -83,13 +87,13 @@ ls::std::core::type::byte_field ls::std::io::SerializableSectionPairDocument::_g
   size_t iterations{};
   ls::std::core::type::byte_field serializedDocument = _serializedDocument;
   bool isNotNewSection{};
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::string newLine = this->parameter.getNewLine();
 
   do
   {
     ++iterations;
-    currentRow = ls::std::io::SerializableSectionPairDocument::_getCurrentRow(iterations, serializedDocument);
-    isNotNewSection = ls::std::io::SerializableSectionPairDocument::_isNotNewSection(currentRow) && !serializedDocument.empty() || iterations == 1;
+    currentRow = this->_getCurrentRow(iterations, serializedDocument);
+    isNotNewSection = this->_isNotNewSection(currentRow) && !serializedDocument.empty() || iterations == 1;
     serializedDocument = serializedDocument.substr(currentRow.size());
     serializedSection += currentRow;
   } while (isNotNewSection);
@@ -99,12 +103,6 @@ ls::std::core::type::byte_field ls::std::io::SerializableSectionPairDocument::_g
 
 bool ls::std::io::SerializableSectionPairDocument::_isNotNewSection(const ls::std::core::type::byte_field &_currentRow)
 {
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::string newLine = this->parameter.getNewLine();
   return _currentRow.find(newLine + newLine) == ::std::string::npos;
 }
-
-void ls::std::io::SerializableSectionPairDocument::_setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
-{
-  ls::std::core::NullPointerArgumentEvaluator{_value}.evaluate();
-  this->value = _value;
-}

+ 36 - 0
source/ls-std/io/section-pair/serialization/SerializableSectionPairParameter.cpp

@@ -0,0 +1,36 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-17
+* Changed:         2023-02-17
+*
+* */
+
+#include <ls-std/io/NewLine.hpp>
+#include <ls-std/io/section-pair/serialization/SerializableSectionPairParameter.hpp>
+
+ls::std::io::SerializableSectionPairParameter::SerializableSectionPairParameter() : parseNewLine(ls::std::io::NewLine::get())
+{}
+
+ls::std::io::SerializableSectionPairParameter::~SerializableSectionPairParameter() = default;
+
+::std::string ls::std::io::SerializableSectionPairParameter::getNewLine()
+{
+  return this->parseNewLine;
+}
+
+::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairParameter::getValue() const
+{
+  return this->value;
+}
+
+void ls::std::io::SerializableSectionPairParameter::setNewLine(const ::std::string &_newLine)
+{
+  this->parseNewLine = _newLine;
+}
+
+void ls::std::io::SerializableSectionPairParameter::setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
+{
+  this->value = _value;
+}

+ 16 - 19
source/ls-std/io/section-pair/serialization/SerializableSectionPairRow.cpp

@@ -8,33 +8,37 @@
 * */
 
 #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
-#include <ls-std/io/NewLine.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRow.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRowListValue.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRowSingleValue.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairRow.hpp>
 
-ls::std::io::SerializableSectionPairRow::SerializableSectionPairRow(const ::std::shared_ptr<ls::std::core::Class> &_value) : ls::std::core::Class("SerializableSectionPairRow")
+ls::std::io::SerializableSectionPairRow::SerializableSectionPairRow(const SerializableSectionPairParameter &_parameter) : ls::std::core::Class("SerializableSectionPairRow")
 {
-  this->_setValue(_value);
+  ::std::string message = this->getClassName() + ": model reference is null!";
+  ls::std::core::NullPointerArgumentEvaluator{_parameter.getValue(), message}.evaluate();
+  this->parameter = _parameter;
 }
 
 ls::std::io::SerializableSectionPairRow::~SerializableSectionPairRow() = default;
 
 ::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairRow::getValue()
 {
-  return this->value;
+  return this->parameter.getValue();
 }
 
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairRow::marshal()
 {
   ls::std::core::type::byte_field data = this->_marshalKey();
-  return data + ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->value)->getValue()->marshal();
+  ::std::shared_ptr<SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->parameter.getValue());
+  row->getValue()->reserveNewLine(this->parameter.getNewLine());
+  return data + row->getValue()->marshal();
 }
 
 void ls::std::io::SerializableSectionPairRow::unmarshal(const ls::std::core::type::byte_field &_data)
 {
-  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->value);
+  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->parameter.getValue());
+  row->getValue()->reserveNewLine(this->parameter.getNewLine());
 
   if (row->isSingleValue())
   {
@@ -50,7 +54,7 @@ void ls::std::io::SerializableSectionPairRow::unmarshal(const ls::std::core::typ
 ::std::string ls::std::io::SerializableSectionPairRow::_marshalKey()
 {
   ::std::string serializedKey{};
-  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->value);
+  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->parameter.getValue());
 
   if (row->isSingleValue())
   {
@@ -59,28 +63,22 @@ void ls::std::io::SerializableSectionPairRow::unmarshal(const ls::std::core::typ
 
   if (row->isList())
   {
-    serializedKey = row->getKey() + ":" + ls::std::io::NewLine::get();
+    serializedKey = row->getKey() + ":" + this->parameter.getNewLine();
   }
 
   return serializedKey;
 }
 
-void ls::std::io::SerializableSectionPairRow::_setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
-{
-  ls::std::core::NullPointerArgumentEvaluator{_value}.evaluate();
-  this->value = _value;
-}
-
 void ls::std::io::SerializableSectionPairRow::_unmarshalListValue(const ls::std::core::type::byte_field &_data)
 {
   ::std::string::size_type separatorPosition = _data.find(':');
-  ls::std::io::section_pair_identifier identifier{};
+  ::std::string newLine = this->parameter.getNewLine();
 
   if (separatorPosition != ::std::string::npos)
   {
-    ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->value);
+    ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->parameter.getValue());
     row->setKey(_data.substr(0, separatorPosition));
-    ::std::string::size_type newLinePosition = _data.find(NewLine::get()) + (NewLine::get().size() - 1);
+    ::std::string::size_type newLinePosition = _data.find(newLine) + (newLine.size() - 1);
     ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowListValue>(row->getValue())->unmarshal(_data.substr(newLinePosition + 1));
   }
 }
@@ -88,11 +86,10 @@ void ls::std::io::SerializableSectionPairRow::_unmarshalListValue(const ls::std:
 void ls::std::io::SerializableSectionPairRow::_unmarshalSingleValue(const ls::std::core::type::byte_field &_data)
 {
   ::std::string::size_type position = _data.find('=');
-  ls::std::io::section_pair_identifier identifier{};
 
   if (position != ::std::string::npos)
   {
-    ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->value);
+    ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRow>(this->parameter.getValue());
     row->setKey(_data.substr(0, position));
     ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(row->getValue())->unmarshal(_data.substr(position + 1));
   }

+ 14 - 18
source/ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.cpp

@@ -9,29 +9,30 @@
 
 #include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
 #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
-#include <ls-std/io/NewLine.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRowListValue.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.hpp>
 
-ls::std::io::SerializableSectionPairRowListValue::SerializableSectionPairRowListValue(const ::std::shared_ptr<ls::std::core::Class> &_value) : ls::std::core::Class("SerializableSectionPairRowListValue")
+ls::std::io::SerializableSectionPairRowListValue::SerializableSectionPairRowListValue(const ls::std::io::SerializableSectionPairParameter &_parameter) : ls::std::core::Class("SerializableSectionPairRowListValue")
 {
-  this->_setValue(_value);
+  ::std::string message = this->getClassName() + ": model reference is null!";
+  ls::std::core::NullPointerArgumentEvaluator{_parameter.getValue(), message}.evaluate();
+  this->parameter = _parameter;
 }
 
 ls::std::io::SerializableSectionPairRowListValue::~SerializableSectionPairRowListValue() = default;
 
 ::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairRowListValue::getValue()
 {
-  return this->value;
+  return this->parameter.getValue();
 }
 
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairRowListValue::marshal()
 {
   ls::std::core::type::byte_field data{};
 
-  for (const auto &_value : ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowListValue>(this->value)->getList())
+  for (const auto &_value : ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowListValue>(this->getValue())->getList())
   {
-    data += "  " + _value + ls::std::io::NewLine::get();
+    data += "  " + _value + this->parameter.getNewLine();
   }
 
   return data;
@@ -41,14 +42,15 @@ void ls::std::io::SerializableSectionPairRowListValue::unmarshal(const ls::std::
 {
   ls::std::core::EmptyStringArgumentEvaluator{_data}.evaluate();
   ls::std::core::type::byte_field searchText = _data;
+  ::std::string newLine = this->parameter.getNewLine();
 
-  while (!searchText.empty() && searchText != ls::std::io::NewLine::get())
+  while (!searchText.empty() && searchText != newLine)
   {
-    ::std::string::size_type positionOfNewLine = searchText.find(ls::std::io::NewLine::get());
+    ::std::string::size_type positionOfNewLine = searchText.find(newLine);
     ::std::string line = ls::std::io::SerializableSectionPairRowListValue::_getLine(positionOfNewLine, searchText);
     line = line.substr(2);
-    ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowListValue>(this->value)->add(line);
-    ls::std::io::SerializableSectionPairRowListValue::_updateSearchText(positionOfNewLine, searchText);
+    ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowListValue>(this->getValue())->add(line);
+    this->_updateSearchText(positionOfNewLine, searchText);
   }
 }
 
@@ -58,7 +60,7 @@ void ls::std::io::SerializableSectionPairRowListValue::unmarshal(const ls::std::
 
   if (_position != ::std::string::npos)
   {
-    line = _searchText.substr(0, _position + (ls::std::io::NewLine::get().size() - 1));
+    line = _searchText.substr(0, _position);
   }
   else
   {
@@ -68,17 +70,11 @@ void ls::std::io::SerializableSectionPairRowListValue::unmarshal(const ls::std::
   return line;
 }
 
-void ls::std::io::SerializableSectionPairRowListValue::_setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
-{
-  ls::std::core::NullPointerArgumentEvaluator{_value}.evaluate();
-  this->value = _value;
-}
-
 void ls::std::io::SerializableSectionPairRowListValue::_updateSearchText(::std::string::size_type _position, ls::std::core::type::byte_field &_searchText)
 {
   if (_position != ::std::string::npos)
   {
-    _searchText = _searchText.substr(_position + ls::std::io::NewLine::get().size());
+    _searchText = _searchText.substr(_position + this->parameter.getNewLine().size());
   }
   else
   {

+ 7 - 12
source/ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.cpp

@@ -9,35 +9,30 @@
 
 #include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
 #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
-#include <ls-std/io/NewLine.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRowSingleValue.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.hpp>
 
-ls::std::io::SerializableSectionPairRowSingleValue::SerializableSectionPairRowSingleValue(const ::std::shared_ptr<ls::std::core::Class> &_value) : ls::std::core::Class("SerializableSectionPairRowSingleValue")
+ls::std::io::SerializableSectionPairRowSingleValue::SerializableSectionPairRowSingleValue(const ls::std::io::SerializableSectionPairParameter &_parameter) : ls::std::core::Class("SerializableSectionPairRowSingleValue")
 {
-  this->_setValue(_value);
+  ::std::string message = this->getClassName() + ": model reference is null!";
+  ls::std::core::NullPointerArgumentEvaluator{_parameter.getValue(), message}.evaluate();
+  this->parameter = _parameter;
 }
 
 ls::std::io::SerializableSectionPairRowSingleValue::~SerializableSectionPairRowSingleValue() = default;
 
 ::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairRowSingleValue::getValue()
 {
-  return this->value;
+  return this->parameter.getValue();
 }
 
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairRowSingleValue::marshal()
 {
-  return ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->value)->get() + ls::std::io::NewLine::get();
+  return ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->parameter.getValue())->get() + this->parameter.getNewLine();
 }
 
 void ls::std::io::SerializableSectionPairRowSingleValue::unmarshal(const ls::std::core::type::byte_field &_data)
 {
   ls::std::core::EmptyStringArgumentEvaluator{_data}.evaluate();
-  ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->value)->set(_data);
-}
-
-void ls::std::io::SerializableSectionPairRowSingleValue::_setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
-{
-  ls::std::core::NullPointerArgumentEvaluator{_value, "model reference for SerializableSectionPairRowSingleValue is null!"}.evaluate();
-  this->value = _value;
+  ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->parameter.getValue())->set(_data);
 }

+ 21 - 23
source/ls-std/io/section-pair/serialization/SerializableSectionPairSection.cpp

@@ -9,22 +9,23 @@
 
 #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
-#include <ls-std/io/NewLine.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRow.hpp>
 #include <ls-std/io/section-pair/model/SectionPairSection.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairSection.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairSectionIdUnmarshalValidator.hpp>
 
-ls::std::io::SerializableSectionPairSection::SerializableSectionPairSection(const ::std::shared_ptr<ls::std::core::Class> &_value) : ls::std::core::Class("SerializableSectionPairSection")
+ls::std::io::SerializableSectionPairSection::SerializableSectionPairSection(const ls::std::io::SerializableSectionPairParameter &_parameter) : ls::std::core::Class("SerializableSectionPairSection")
 {
-  this->_setValue(_value);
+  ::std::string message = this->getClassName() + ": model reference is null!";
+  ls::std::core::NullPointerArgumentEvaluator(_parameter.getValue(), message).evaluate();
+  this->parameter = _parameter;
 }
 
 ls::std::io::SerializableSectionPairSection::~SerializableSectionPairSection() = default;
 
 ::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairSection::getValue()
 {
-  return this->value;
+  return this->parameter.getValue();
 }
 
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::marshal()
@@ -45,7 +46,7 @@ void ls::std::io::SerializableSectionPairSection::unmarshal(const ls::std::core:
 
 void ls::std::io::SerializableSectionPairSection::_checkSectionHeader(const ls::std::core::type::byte_field &_sectionHeader)
 {
-  if (!ls::std::io::SectionPairSectionIdUnmarshalValidator{_sectionHeader}.isValid())
+  if (!ls::std::io::SectionPairSectionIdUnmarshalValidator{_sectionHeader, this->parameter.getNewLine()}.isValid())
   {
     throw ls::std::core::IllegalArgumentException{"serialized section header is not valid!"};
   }
@@ -54,7 +55,7 @@ void ls::std::io::SerializableSectionPairSection::_checkSectionHeader(const ls::
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::_collectSectionRow(const ls::std::core::type::byte_field &_currentRows, ls::std::io::SectionPairRowEnumType &_type)
 {
   ::std::string row{};
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::string newLine = this->parameter.getNewLine();
   ::std::string firstRow = _currentRows.substr(0, _currentRows.find(newLine) + newLine.size());
 
   if (ls::std::io::SerializableSectionPairSection::_isSingleValueRow(firstRow))
@@ -64,7 +65,7 @@ ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::_co
 
   if (ls::std::io::SerializableSectionPairSection::_isListValueRow(firstRow))
   {
-    row = ls::std::io::SerializableSectionPairSection::_collectSectionListValueRow(_currentRows, _type);
+    row = this->_collectSectionListValueRow(_currentRows, _type);
   }
 
   return row;
@@ -74,7 +75,7 @@ ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::_co
 {
   ls::std::core::type::byte_field currentRows = _currentRows;
   ls::std::core::type::byte_field currentRow{}, row{};
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::string newLine = this->parameter.getNewLine();
   _type = SectionPairRowEnumType::SECTION_PAIR_ROW_LIST_VALUE;
   size_t iterations{};
   bool isStillListRow{};
@@ -131,7 +132,7 @@ size_t ls::std::io::SerializableSectionPairSection::_getNthSubStringPosition(con
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::_getSectionHeader(const ls::std::core::type::byte_field &_data)
 {
   ls::std::core::type::byte_field sectionHeader{};
-  ::std::string newLine = ls::std::io::NewLine::get();
+  ::std::string newLine = this->parameter.getNewLine();
   size_t position = ls::std::io::SerializableSectionPairSection::_getNthSubStringPosition(_data, newLine);
 
   if (position != -1)
@@ -170,8 +171,9 @@ ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::_ma
 {
   ls::std::core::type::byte_field serializedSectionRows{};
 
-  for (const auto &_row : ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->value)->getList())
+  for (const auto &_row : ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->parameter.getValue())->getList())
   {
+    _row->reserveNewLine(this->parameter.getNewLine());
     serializedSectionRows += _row->marshal();
   }
 
@@ -180,31 +182,27 @@ ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::_ma
 
 ls::std::core::type::byte_field ls::std::io::SerializableSectionPairSection::_marshalSectionId()
 {
-  return ls::std::io::NewLine::get() + "[" + ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->value)->getSectionId() + "]" + ls::std::io::NewLine::get() + ls::std::io::NewLine::get();
-}
-
-void ls::std::io::SerializableSectionPairSection::_setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
-{
-  ls::std::core::NullPointerArgumentEvaluator{_value, "model reference for SerializableSectionPairSection is null!"}.evaluate();
-  this->value = _value;
+  ::std::string newLine = this->parameter.getNewLine();
+  return newLine + "[" + ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->parameter.getValue())->getSectionId() + "]" + newLine + newLine;
 }
 
 void ls::std::io::SerializableSectionPairSection::_unmarshalRow(const ::std::string &_sectionRow, ls::std::io::SectionPairRowEnumType _type)
 {
   ls::std::io::section_pair_row_list_element row = ::std::make_shared<ls::std::io::SectionPairRow>("tmp-dir", _type);
+  row->reserveNewLine(this->parameter.getNewLine());
   row->unmarshal(_sectionRow);
-  ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->value)->add(row);
+  ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->parameter.getValue())->add(row);
 }
 
 void ls::std::io::SerializableSectionPairSection::_unmarshalRows(const ls::std::core::type::byte_field &_serializedRows)
 {
-  ::std::string newLine = ls::std::io::NewLine::get();
   ::std::string currentRows = _serializedRows;
   ls::std::io::SectionPairRowEnumType type{};
+  ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->parameter.getValue());
 
   while (!currentRows.empty())
   {
-    ::std::string sectionRow = ls::std::io::SerializableSectionPairSection::_collectSectionRow(currentRows, type);
+    ::std::string sectionRow = this->_collectSectionRow(currentRows, type);
     this->_unmarshalRow(sectionRow, type);
     currentRows = currentRows.substr(sectionRow.size());
   }
@@ -212,9 +210,9 @@ void ls::std::io::SerializableSectionPairSection::_unmarshalRows(const ls::std::
 
 size_t ls::std::io::SerializableSectionPairSection::_unmarshalSectionHeader(const ls::std::core::type::byte_field &_data)
 {
-  ls::std::core::type::byte_field sectionHeader = ls::std::io::SerializableSectionPairSection::_getSectionHeader(_data);
-  ls::std::io::SerializableSectionPairSection::_checkSectionHeader(sectionHeader);
-  ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->value)->setSectionId(ls::std::io::SerializableSectionPairSection::_getSectionId(sectionHeader));
+  ls::std::core::type::byte_field sectionHeader = this->_getSectionHeader(_data);
+  this->_checkSectionHeader(sectionHeader);
+  ::std::dynamic_pointer_cast<ls::std::io::SectionPairSection>(this->parameter.getValue())->setSectionId(ls::std::io::SerializableSectionPairSection::_getSectionId(sectionHeader));
 
   return sectionHeader.size();
 }

+ 6 - 2
source/ls-std/io/section-pair/validator/SectionPairRowValueValidator.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-09
-* Changed:         2023-02-16
+* Changed:         2023-02-18
 *
 * */
 
@@ -18,7 +18,11 @@ ls::std::io::SectionPairRowValueValidator::~SectionPairRowValueValidator() = def
 
 bool ls::std::io::SectionPairRowValueValidator::isValid()
 {
-  this->value = ::std::regex_replace(this->value, ::std::regex(ls::std::io::NewLine::get()), "");
+  static ::std::regex windowsLineBreakRegex{ls::std::io::NewLine::getWindowsNewLine()};
+  static ::std::regex unixLineBreakRegex{ls::std::io::NewLine::getUnixNewLine()};
+
+  this->value = ::std::regex_replace(this->value, windowsLineBreakRegex, "");
+  this->value = ::std::regex_replace(this->value, unixLineBreakRegex, "");
   size_t foundPosition = this->value.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789_#![]{}()/$ۤ%?<>+:;., *\"");
   return foundPosition == ls::std::io::section_pair_row_value::npos;
 }

+ 5 - 6
source/ls-std/io/section-pair/validator/SectionPairSectionIdUnmarshalValidator.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-14
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -11,20 +11,19 @@
 #include <ls-std/io/section-pair/validator/SectionPairIdentifierValidator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairSectionIdUnmarshalValidator.hpp>
 
-ls::std::io::SectionPairSectionIdUnmarshalValidator::SectionPairSectionIdUnmarshalValidator(ls::std::core::type::byte_field _data) : ls::std::core::Class("SectionPairSectionIdUnmarshalValidator"), data(::std::move(_data))
+ls::std::io::SectionPairSectionIdUnmarshalValidator::SectionPairSectionIdUnmarshalValidator(ls::std::core::type::byte_field _data, ::std::string _newLine) : ls::std::core::Class("SectionPairSectionIdUnmarshalValidator"), data(::std::move(_data)), newLine(::std::move(_newLine))
 {}
 
 ls::std::io::SectionPairSectionIdUnmarshalValidator::~SectionPairSectionIdUnmarshalValidator() = default;
 
 bool ls::std::io::SectionPairSectionIdUnmarshalValidator::isValid()
 {
-  ::std::string newLine = ls::std::io::NewLine::get();
-  bool isValidSectionId = this->data.rfind(newLine, 0) == 0;
-  isValidSectionId = isValidSectionId && this->data.rfind(newLine + newLine) == (this->data.size() - 2 * newLine.size());
+  bool isValidSectionId = this->data.rfind(this->newLine, 0) == 0;
+  isValidSectionId = isValidSectionId && this->data.rfind(this->newLine + this->newLine) == (this->data.size() - 2 * this->newLine.size());
 
   if (isValidSectionId)
   {
-    isValidSectionId = ls::std::io::SectionPairSectionIdUnmarshalValidator::_isValidSection(ls::std::io::SectionPairSectionIdUnmarshalValidator::_trimStartAndEnd(this->data, newLine, newLine + newLine));
+    isValidSectionId = ls::std::io::SectionPairSectionIdUnmarshalValidator::_isValidSection(ls::std::io::SectionPairSectionIdUnmarshalValidator::_trimStartAndEnd(this->data, this->newLine, this->newLine + this->newLine));
   }
 
   return isValidSectionId;

+ 3 - 3
test/cases/io/section-pair/model/SectionPairDocumentTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-15
-* Changed:         2023-02-17
+* Changed:         2023-02-18
 *
 * */
 
@@ -128,7 +128,7 @@ namespace
   TEST_F(SectionPairDocumentTest, marshal)
   {
     shared_ptr<SectionPairDocument> document = SectionPairDocumentProvider::createDocument();
-    byte_field expected = SectionPairDocumentProvider::createSerializedDocument();
+    byte_field expected = SectionPairDocumentProvider::createSerializedDocument(NewLine::get());
 
     ASSERT_STREQ(expected.c_str(), document->marshal().c_str());
   }
@@ -136,7 +136,7 @@ namespace
   TEST_F(SectionPairDocumentTest, unmarshal)
   {
     shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
-    document->unmarshal(SectionPairDocumentProvider::createSerializedDocument());
+    document->unmarshal(SectionPairDocumentProvider::createSerializedDocument(NewLine::get()));
 
     ASSERT_EQ(2, document->getAmountOfSections());
 

+ 3 - 3
test/cases/io/section-pair/model/SectionPairSectionTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-13
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -155,7 +155,7 @@ namespace
   TEST_F(SectionPairSectionTest, marshal)
   {
     shared_ptr<SectionPairSection> section = SectionPairSectionProvider::createSectionWithTomExample();
-    byte_field expected = SectionPairSectionProvider::createSerializedSectionWithTomExample();
+    byte_field expected = SectionPairSectionProvider::createSerializedSectionWithTomExample(NewLine::get());
     byte_field actual = section->marshal();
 
     ASSERT_STREQ(expected.c_str(), actual.c_str());
@@ -208,7 +208,7 @@ namespace
   TEST_F(SectionPairSectionTest, unmarshal)
   {
     shared_ptr<SectionPairSection> section = make_shared<SectionPairSection>("tmp-id");
-    section->unmarshal(SectionPairSectionProvider::createSerializedSectionWithTomExample());
+    section->unmarshal(SectionPairSectionProvider::createSerializedSectionWithTomExample(NewLine::get()));
 
     ASSERT_STREQ("general", section->getSectionId().c_str());
     ASSERT_EQ(3, section->getRowAmount());

+ 36 - 10
test/cases/io/section-pair/serialization/SerializableSectionPairDocumentTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-16
-* Changed:         2023-02-17
+* Changed:         2023-02-18
 *
 * */
 
@@ -35,13 +35,23 @@ namespace
       {}
   };
 
+  class SerializableSectionPairDocumentSerializationTest : public ::testing::TestWithParam<string>
+  {
+    protected:
+
+      SerializableSectionPairDocumentSerializationTest() = default;
+      ~SerializableSectionPairDocumentSerializationTest() override = default;
+  };
+
   TEST_F(SerializableSectionPairDocumentTest, constructor_no_value)
   {
+    SerializableSectionPairParameter parameter{};
+
     EXPECT_THROW(
         {
           try
           {
-            SerializableSectionPairDocument serializable = SerializableSectionPairDocument(nullptr);
+            SerializableSectionPairDocument serializable = SerializableSectionPairDocument(parameter);
           }
           catch (const IllegalArgumentException &_exception)
           {
@@ -53,27 +63,41 @@ namespace
 
   TEST_F(SerializableSectionPairDocumentTest, getClassName)
   {
-    ASSERT_STREQ("SerializableSectionPairDocument", SerializableSectionPairDocument{make_shared<SectionPairDocument>()}.getClassName().c_str());
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairDocument>());
+
+    ASSERT_STREQ("SerializableSectionPairDocument", SerializableSectionPairDocument{parameter}.getClassName().c_str());
   }
 
   TEST_F(SerializableSectionPairDocumentTest, getValue)
   {
-    SerializableSectionPairDocument serializable(make_shared<SectionPairDocument>());
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairDocument>());
+    SerializableSectionPairDocument serializable(parameter);
+
     ASSERT_TRUE(serializable.getValue() != nullptr);
   }
 
-  TEST_F(SerializableSectionPairDocumentTest, marshal)
+  TEST_P(SerializableSectionPairDocumentSerializationTest, marshal)
   {
-    SerializableSectionPairDocument serializable(SectionPairDocumentProvider::createDocument());
-    byte_field expected = SectionPairDocumentProvider::createSerializedDocument();
+    string newLine = GetParam();
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(SectionPairDocumentProvider::createDocument());
+    parameter.setNewLine(newLine);
+    SerializableSectionPairDocument serializable(parameter);
+    byte_field expected = SectionPairDocumentProvider::createSerializedDocument(newLine);
 
     ASSERT_STREQ(expected.c_str(), serializable.marshal().c_str());
   }
 
-  TEST_F(SerializableSectionPairDocumentTest, unmarshal)
+  TEST_P(SerializableSectionPairDocumentSerializationTest, unmarshal)
   {
-    SerializableSectionPairDocument serializable(make_shared<SectionPairDocument>());
-    serializable.unmarshal(SectionPairDocumentProvider::createSerializedDocument());
+    string newLine = GetParam();
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairDocument>());
+    parameter.setNewLine(newLine);
+    SerializableSectionPairDocument serializable(parameter);
+    serializable.unmarshal(SectionPairDocumentProvider::createSerializedDocument(newLine));
     shared_ptr<SectionPairDocument> document = dynamic_pointer_cast<SectionPairDocument>(serializable.getValue());
 
     ASSERT_EQ(2, document->getAmountOfSections());
@@ -112,4 +136,6 @@ namespace
     ASSERT_STREQ("height", physical->get(2)->getKey().c_str());
     ASSERT_STREQ("167", dynamic_pointer_cast<SectionPairRowSingleValue>(physical->get(2)->getValue())->get().c_str());
   }
+
+  INSTANTIATE_TEST_SUITE_P(SerializableSectionPairDocumentTest, SerializableSectionPairDocumentSerializationTest, ::testing::Values(NewLine::getUnixNewLine(), NewLine::getWindowsNewLine()));
 }

+ 60 - 0
test/cases/io/section-pair/serialization/SerializableSectionPairParameterTest.cpp

@@ -0,0 +1,60 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-17
+* Changed:         2023-02-17
+*
+* */
+
+#include <gtest/gtest.h>
+#include <ls-std/ls-std-io.hpp>
+#include <memory>
+
+using namespace ls::std::core;
+using namespace ls::std::core::type;
+using namespace ls::std::io;
+using namespace ::std;
+
+namespace
+{
+  class SerializableSectionPairParameterTest : public ::testing::Test
+  {
+    protected:
+
+      SerializableSectionPairParameterTest() = default;
+      ~SerializableSectionPairParameterTest() override = default;
+
+      void SetUp() override
+      {}
+
+      void TearDown() override
+      {}
+  };
+
+  TEST_F(SerializableSectionPairParameterTest, getNewLine)
+  {
+    ASSERT_STREQ(NewLine::get().c_str(), SerializableSectionPairParameter{}.getNewLine().c_str());
+  }
+
+  TEST_F(SerializableSectionPairParameterTest, getValue)
+  {
+    ASSERT_TRUE(SerializableSectionPairParameter{}.getValue() == nullptr);
+  }
+
+  TEST_F(SerializableSectionPairParameterTest, setNewLine)
+  {
+    SerializableSectionPairParameter parameter{};
+    parameter.setNewLine("\r\n");
+
+    ASSERT_STREQ("\r\n", parameter.getNewLine().c_str());
+  }
+
+  TEST_F(SerializableSectionPairParameterTest, setValue)
+  {
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRowSingleValue>("blue"));
+
+    ASSERT_TRUE(parameter.getValue() != nullptr);
+  }
+}

+ 38 - 11
test/cases/io/section-pair/serialization/SerializableSectionPairRowListValueTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-11
-* Changed:         2023-02-17
+* Changed:         2023-02-18
 *
 * */
 
@@ -32,13 +32,23 @@ namespace
       {}
   };
 
+  class SerializableSectionPairRowListValueSerializationTest : public ::testing::TestWithParam<string>
+  {
+    protected:
+
+      SerializableSectionPairRowListValueSerializationTest() = default;
+      ~SerializableSectionPairRowListValueSerializationTest() override = default;
+  };
+
   TEST_F(SerializableSectionPairRowListValueTest, constructor_no_reference)
   {
+    SerializableSectionPairParameter parameter{};
+
     EXPECT_THROW(
         {
           try
           {
-            SerializableSectionPairRowListValue serializable(nullptr);
+            SerializableSectionPairRowListValue serializable(parameter);
           }
           catch (const IllegalArgumentException &_exception)
           {
@@ -50,35 +60,48 @@ namespace
 
   TEST_F(SerializableSectionPairRowListValueTest, getClassName)
   {
-    ASSERT_STREQ("SerializableSectionPairRowListValue", SerializableSectionPairRowListValue{make_shared<SectionPairRowListValue>()}.getClassName().c_str());
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRowListValue>());
+
+    ASSERT_STREQ("SerializableSectionPairRowListValue", SerializableSectionPairRowListValue{parameter}.getClassName().c_str());
   }
 
   TEST_F(SerializableSectionPairRowListValueTest, getValue)
   {
+    SerializableSectionPairParameter parameter{};
     shared_ptr<SectionPairRowListValue> value = make_shared<SectionPairRowListValue>();
-    SerializableSectionPairRowListValue serializable(value);
+    parameter.setValue(value);
+    SerializableSectionPairRowListValue serializable(parameter);
 
     ASSERT_TRUE(value == serializable.getValue());
   }
 
-  TEST_F(SerializableSectionPairRowListValueTest, marshal)
+  TEST_P(SerializableSectionPairRowListValueSerializationTest, marshal)
   {
+    SerializableSectionPairParameter parameter{};
     shared_ptr<SectionPairRowListValue> value = make_shared<SectionPairRowListValue>();
     value->add("Drumming");
     value->add("Reading");
     value->add("Coding");
-    SerializableSectionPairRowListValue serializable(value);
+    parameter.setValue(value);
+    string newLine = GetParam();
+    parameter.setNewLine(newLine);
+    SerializableSectionPairRowListValue serializable(parameter);
 
-    ::std::string expected = "  Drumming" + NewLine::get() + "  Reading" + NewLine::get() + "  Coding" + NewLine::get();
+    string expected = "  Drumming" + newLine + "  Reading" + newLine + "  Coding" + newLine;
 
     ASSERT_STREQ(expected.c_str(), serializable.marshal().c_str());
   }
 
-  TEST_F(SerializableSectionPairRowListValueTest, unmarshal)
+  TEST_P(SerializableSectionPairRowListValueSerializationTest, unmarshal)
   {
+    SerializableSectionPairParameter parameter{};
     shared_ptr<SectionPairRowListValue> value = make_shared<SectionPairRowListValue>();
-    SerializableSectionPairRowListValue serializable(value);
-    ::std::string serializedListValue = "  Drumming" + NewLine::get() + "  Reading" + NewLine::get() + "  Coding" + NewLine::get();
+    parameter.setValue(value);
+    string newLine = GetParam();
+    parameter.setNewLine(newLine);
+    SerializableSectionPairRowListValue serializable(parameter);
+    string serializedListValue = "  Drumming" + newLine + "  Reading" + newLine + "  Coding" + newLine;
     serializable.unmarshal(serializedListValue);
 
     ASSERT_EQ(3, value->getSize());
@@ -89,7 +112,9 @@ namespace
 
   TEST_F(SerializableSectionPairRowListValueTest, unmarshal_empty_string)
   {
-    SerializableSectionPairRowListValue serializable(make_shared<SectionPairRowListValue>());
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRowListValue>());
+    SerializableSectionPairRowListValue serializable(parameter);
 
     EXPECT_THROW(
         {
@@ -104,4 +129,6 @@ namespace
         },
         IllegalArgumentException);
   }
+
+  INSTANTIATE_TEST_SUITE_P(SerializableSectionPairRowListValueTest, SerializableSectionPairRowListValueSerializationTest, ::testing::Values(NewLine::getUnixNewLine(), NewLine::getWindowsNewLine()));
 }

+ 36 - 11
test/cases/io/section-pair/serialization/SerializableSectionPairRowSingleValueTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-11
-* Changed:         2023-02-17
+* Changed:         2023-02-18
 *
 * */
 
@@ -33,13 +33,23 @@ namespace
       {}
   };
 
+  class SerializableSectionPairRowSingleValueSerializationTest : public ::testing::TestWithParam<string>
+  {
+    protected:
+
+      SerializableSectionPairRowSingleValueSerializationTest() = default;
+      ~SerializableSectionPairRowSingleValueSerializationTest() override = default;
+  };
+
   TEST_F(SerializableSectionPairRowSingleValueTest, constructor_no_reference)
   {
+    SerializableSectionPairParameter parameter{};
+
     EXPECT_THROW(
         {
           try
           {
-            SerializableSectionPairRowSingleValue serializable(nullptr);
+            SerializableSectionPairRowSingleValue serializable(parameter);
           }
           catch (const IllegalArgumentException &_exception)
           {
@@ -51,21 +61,31 @@ namespace
 
   TEST_F(SerializableSectionPairRowSingleValueTest, getClassName)
   {
-    ASSERT_STREQ("SerializableSectionPairRowSingleValue", SerializableSectionPairRowSingleValue{make_shared<SectionPairRowSingleValue>("empty")}.getClassName().c_str());
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRowSingleValue>("empty"));
+
+    ASSERT_STREQ("SerializableSectionPairRowSingleValue", SerializableSectionPairRowSingleValue{parameter}.getClassName().c_str());
   }
 
   TEST_F(SerializableSectionPairRowSingleValueTest, getValue)
   {
+    SerializableSectionPairParameter parameter{};
     shared_ptr<SectionPairRowSingleValue> value = make_shared<SectionPairRowSingleValue>("empty");
-    SerializableSectionPairRowSingleValue serializable(value);
+    parameter.setValue(value);
+    SerializableSectionPairRowSingleValue serializable(parameter);
 
     ASSERT_TRUE(value == serializable.getValue());
   }
 
-  TEST_F(SerializableSectionPairRowSingleValueTest, marshal)
+  TEST_P(SerializableSectionPairRowSingleValueSerializationTest, marshal)
   {
-    SerializableSectionPairRowSingleValue serializable(make_shared<SectionPairRowSingleValue>("empty"));
-    byte_field expected = "empty" + NewLine::get();
+    string newLine = GetParam();
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRowSingleValue>("empty"));
+    parameter.setNewLine(newLine);
+    SerializableSectionPairRowSingleValue serializable(parameter);
+
+    byte_field expected = "empty" + newLine;
     byte_field actual = serializable.marshal();
 
     ASSERT_STREQ(expected.c_str(), actual.c_str());
@@ -73,16 +93,19 @@ namespace
 
   TEST_F(SerializableSectionPairRowSingleValueTest, unmarshal)
   {
-    shared_ptr<SectionPairRowSingleValue> value = make_shared<SectionPairRowSingleValue>("empty");
-    SerializableSectionPairRowSingleValue serializable(value);
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRowSingleValue>("empty"));
+    SerializableSectionPairRowSingleValue serializable(parameter);
     serializable.unmarshal("blue");
 
-    ASSERT_STREQ("blue", value->get().c_str());
+    ASSERT_STREQ("blue", dynamic_pointer_cast<SectionPairRowSingleValue>(parameter.getValue())->get().c_str());
   }
 
   TEST_F(SerializableSectionPairRowSingleValueTest, unmarshal_empty_string)
   {
-    SerializableSectionPairRowSingleValue serializable(make_shared<SectionPairRowSingleValue>("empty"));
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRowSingleValue>("empty"));
+    SerializableSectionPairRowSingleValue serializable(parameter);
 
     EXPECT_THROW(
         {
@@ -97,4 +120,6 @@ namespace
         },
         IllegalArgumentException);
   }
+
+  INSTANTIATE_TEST_SUITE_P(SerializableSectionPairRowSingleValueTest, SerializableSectionPairRowSingleValueSerializationTest, ::testing::Values(NewLine::getUnixNewLine(), NewLine::getWindowsNewLine()));
 }

+ 50 - 36
test/cases/io/section-pair/serialization/SerializableSectionPairRowTest.cpp

@@ -8,14 +8,17 @@
 * */
 
 #include <gtest/gtest.h>
+#include <ls-std-io-test.hpp>
 #include <ls-std/ls-std-core.hpp>
 #include <ls-std/ls-std-io.hpp>
 #include <memory>
 
 using namespace ls::std::core;
+using namespace ls::std::core::interface_type;
 using namespace ls::std::core::type;
 using namespace ls::std::io;
 using namespace ::std;
+using namespace test::io;
 
 namespace
 {
@@ -33,13 +36,23 @@ namespace
       {}
   };
 
+  class SerializableSectionPairRowSerializationTest : public ::testing::TestWithParam<string>
+  {
+    protected:
+
+      SerializableSectionPairRowSerializationTest() = default;
+      ~SerializableSectionPairRowSerializationTest() override = default;
+  };
+
   TEST_F(SerializableSectionPairRowTest, constructor_no_reference)
   {
+    SerializableSectionPairParameter parameter{};
+
     EXPECT_THROW(
         {
           try
           {
-            SerializableSectionPairRow serializable(nullptr);
+            SerializableSectionPairRow serializable(parameter);
           }
           catch (const IllegalArgumentException &_exception)
           {
@@ -51,66 +64,67 @@ namespace
 
   TEST_F(SerializableSectionPairRowTest, getClassName)
   {
-    ASSERT_STREQ("SerializableSectionPairRow", SerializableSectionPairRow{make_shared<SectionPairRow>("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE)}.getClassName().c_str());
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRow>("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE));
+
+    ASSERT_STREQ("SerializableSectionPairRow", SerializableSectionPairRow{parameter}.getClassName().c_str());
   }
 
   TEST_F(SerializableSectionPairRowTest, getValue)
   {
-    SerializableSectionPairRow serializable{make_shared<SectionPairRow>("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE)};
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairRow>("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE));
+    SerializableSectionPairRow serializable{parameter};
+
     ASSERT_TRUE(serializable.getValue() != nullptr);
   }
 
-  TEST_F(SerializableSectionPairRowTest, marshal_single_value)
+  TEST_P(SerializableSectionPairRowSerializationTest, marshal_single_value)
   {
-    shared_ptr<SectionPairRow> row = make_shared<SectionPairRow>("favourite-color", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
-    shared_ptr<SectionPairRowSingleValue> singleValue = dynamic_pointer_cast<SectionPairRowSingleValue>(row->getValue());
-    singleValue->set("blue");
-    SerializableSectionPairRow serializable{row};
-    byte_field expected = "favourite-color=blue" + NewLine::get();
-    byte_field actual = serializable.marshal();
+    string newLine = GetParam();
+    shared_ptr<SerializableSectionPairRow> serializable = SerializableSectionPairRowProvider::createSingleValueForMarshal(newLine);
+
+    byte_field expected = "favourite-color=blue" + newLine;
+    byte_field actual = serializable->marshal();
 
     ASSERT_STREQ(expected.c_str(), actual.c_str());
   }
 
-  TEST_F(SerializableSectionPairRowTest, marshal_list_value)
+  TEST_P(SerializableSectionPairRowSerializationTest, marshal_list_value)
   {
-    shared_ptr<SectionPairRow> row = make_shared<SectionPairRow>("favourite-colors", SectionPairRowEnumType::SECTION_PAIR_ROW_LIST_VALUE);
-    shared_ptr<SectionPairRowListValue> listValue = dynamic_pointer_cast<SectionPairRowListValue>(row->getValue());
-    listValue->add("blue");
-    listValue->add("red");
-    listValue->add("purple");
-    SerializableSectionPairRow serializable{row};
+    string newLine = GetParam();
+    shared_ptr<SerializableSectionPairRow> serializable = SerializableSectionPairRowProvider::createListValueForMarshal(newLine);
 
-    string expected = "favourite-colors:" + NewLine::get() + "  blue" + NewLine::get() + "  red" + NewLine::get() + "  purple" + NewLine::get();
+    string expected = "favourite-colors:" + newLine + "  blue" + newLine + "  red" + newLine + "  purple" + newLine;
 
-    ASSERT_STREQ(expected.c_str(), serializable.marshal().c_str());
+    ASSERT_STREQ(expected.c_str(), serializable->marshal().c_str());
   }
 
-  TEST_F(SerializableSectionPairRowTest, unmarshal_single_value)
+  TEST_P(SerializableSectionPairRowSerializationTest, unmarshal_single_value)
   {
-    shared_ptr<SectionPairRow> row = make_shared<SectionPairRow>("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
-    shared_ptr<SectionPairRowSingleValue> singleValue = dynamic_pointer_cast<SectionPairRowSingleValue>(row->getValue());
-    SerializableSectionPairRow serializable{row};
-
-    serializable.unmarshal("favourite-color=blue");
+    shared_ptr<SerializableSectionPairRow> serializable = SerializableSectionPairRowProvider::createSingleValueForUnmarshal(GetParam());
+    serializable->unmarshal("favourite-color=blue");
+    shared_ptr<SectionPairRow> row = dynamic_pointer_cast<SectionPairRow>(serializable->getValue());
 
     ASSERT_STREQ("favourite-color", row->getKey().c_str());
-    ASSERT_STREQ("blue", singleValue->get().c_str());
+    ASSERT_STREQ("blue", dynamic_pointer_cast<SectionPairRowSingleValue>(row->getValue())->get().c_str());
   }
 
-  TEST_F(SerializableSectionPairRowTest, unmarshal_list_value)
+  TEST_P(SerializableSectionPairRowSerializationTest, unmarshal_list_value)
   {
-    shared_ptr<SectionPairRow> row = make_shared<SectionPairRow>("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_LIST_VALUE);
-    shared_ptr<SectionPairRowListValue> listValue = dynamic_pointer_cast<SectionPairRowListValue>(row->getValue());
-    SerializableSectionPairRow serializable{row};
+    string newLine = GetParam();
+    shared_ptr<SerializableSectionPairRow> serializable = SerializableSectionPairRowProvider::createListValueForUnmarshal(newLine);
 
-    string data = "favourite-colors:" + NewLine::get() + "  blue" + NewLine::get() + "  red" + NewLine::get() + "  purple" + NewLine::get();
-    serializable.unmarshal(data);
+    string data = "favourite-colors:" + newLine + "  blue" + newLine + "  red" + newLine + "  purple" + newLine;
+    serializable->unmarshal(data);
+    shared_ptr<SectionPairRow> row = dynamic_pointer_cast<SectionPairRow>(serializable->getValue());
 
     ASSERT_STREQ("favourite-colors", row->getKey().c_str());
-    ASSERT_EQ(3, listValue->getSize());
-    ASSERT_STREQ("blue", listValue->get(0).c_str());
-    ASSERT_STREQ("red", listValue->get(1).c_str());
-    ASSERT_STREQ("purple", listValue->get(2).c_str());
+    ASSERT_EQ(3, dynamic_pointer_cast<SectionPairRowListValue>(row->getValue())->getSize());
+    ASSERT_STREQ("blue", dynamic_pointer_cast<SectionPairRowListValue>(row->getValue())->get(0).c_str());
+    ASSERT_STREQ("red", dynamic_pointer_cast<SectionPairRowListValue>(row->getValue())->get(1).c_str());
+    ASSERT_STREQ("purple", dynamic_pointer_cast<SectionPairRowListValue>(row->getValue())->get(2).c_str());
   }
+
+  INSTANTIATE_TEST_SUITE_P(SerializableSectionPairRowTest, SerializableSectionPairRowSerializationTest, ::testing::Values(NewLine::getUnixNewLine(), NewLine::getWindowsNewLine()));
 }

+ 49 - 17
test/cases/io/section-pair/serialization/SerializableSectionPairSectionTest.cpp

@@ -35,13 +35,23 @@ namespace
       {}
   };
 
+  class SerializableSectionPairSectionSerializationTest : public ::testing::TestWithParam<string>
+  {
+    protected:
+
+      SerializableSectionPairSectionSerializationTest() = default;
+      ~SerializableSectionPairSectionSerializationTest() override = default;
+  };
+
   TEST_F(SerializableSectionPairSectionTest, constructor_no_reference)
   {
+    SerializableSectionPairParameter parameter{};
+
     EXPECT_THROW(
         {
           try
           {
-            SerializableSectionPairSection serializable(nullptr);
+            SerializableSectionPairSection serializable(parameter);
           }
           catch (const IllegalArgumentException &_exception)
           {
@@ -53,40 +63,56 @@ namespace
 
   TEST_F(SerializableSectionPairSectionTest, getClassName)
   {
-    ASSERT_STREQ("SerializableSectionPairSection", SerializableSectionPairSection{make_shared<SectionPairSection>("general")}.getClassName().c_str());
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairSection>("general"));
+
+    ASSERT_STREQ("SerializableSectionPairSection", SerializableSectionPairSection{parameter}.getClassName().c_str());
   }
 
   TEST_F(SerializableSectionPairSectionTest, getValue)
   {
-    SerializableSectionPairSection serializable{make_shared<SectionPairSection>("general")};
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(make_shared<SectionPairSection>("general"));
+    SerializableSectionPairSection serializable{parameter};
+
     ASSERT_TRUE(serializable.getValue() != nullptr);
   }
 
-  TEST_F(SerializableSectionPairSectionTest, marshal_sandra)
+  TEST_P(SerializableSectionPairSectionSerializationTest, marshal_sandra)
   {
-    shared_ptr<SectionPairSection> section = SectionPairSectionProvider::createSectionWithSandraExample();
-    SerializableSectionPairSection serializable{section};
-    byte_field expected = SectionPairSectionProvider::createSerializedSectionWithSandraExample();
+    string newLine = GetParam();
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(SectionPairSectionProvider::createSectionWithSandraExample());
+    parameter.setNewLine(newLine);
+    SerializableSectionPairSection serializable{parameter};
+    byte_field expected = SectionPairSectionProvider::createSerializedSectionWithSandraExample(newLine);
     byte_field actual = serializable.marshal();
 
     ASSERT_STREQ(expected.c_str(), actual.c_str());
   }
 
-  TEST_F(SerializableSectionPairSectionTest, marshal_tom)
+  TEST_P(SerializableSectionPairSectionSerializationTest, marshal_tom)
   {
-    shared_ptr<SectionPairSection> section = SectionPairSectionProvider::createSectionWithTomExample();
-    SerializableSectionPairSection serializable{section};
-    byte_field expected = SectionPairSectionProvider::createSerializedSectionWithTomExample();
+    string newLine = GetParam();
+    SerializableSectionPairParameter parameter{};
+    parameter.setValue(SectionPairSectionProvider::createSectionWithTomExample());
+    parameter.setNewLine(newLine);
+    SerializableSectionPairSection serializable{parameter};
+    byte_field expected = SectionPairSectionProvider::createSerializedSectionWithTomExample(newLine);
     byte_field actual = serializable.marshal();
 
     ASSERT_STREQ(expected.c_str(), actual.c_str());
   }
 
-  TEST_F(SerializableSectionPairSectionTest, unmarshal_sandra)
+  TEST_P(SerializableSectionPairSectionSerializationTest, unmarshal_sandra)
   {
+    string newLine = GetParam();
+    SerializableSectionPairParameter parameter{};
     shared_ptr<SectionPairSection> section = make_shared<SectionPairSection>("tmp-id");
-    SerializableSectionPairSection serializable{section};
-    serializable.unmarshal(SectionPairSectionProvider::createSerializedSectionWithSandraExample());
+    parameter.setValue(section);
+    parameter.setNewLine(newLine);
+    SerializableSectionPairSection serializable{parameter};
+    serializable.unmarshal(SectionPairSectionProvider::createSerializedSectionWithSandraExample(newLine));
 
     ASSERT_STREQ("general", section->getSectionId().c_str());
     ASSERT_EQ(3, section->getRowAmount());
@@ -104,11 +130,15 @@ namespace
     ASSERT_STREQ("singing", listRow->get(2).c_str());
   }
 
-  TEST_F(SerializableSectionPairSectionTest, unmarshal_tom)
+  TEST_P(SerializableSectionPairSectionSerializationTest, unmarshal_tom)
   {
+    string newLine = GetParam();
+    SerializableSectionPairParameter parameter{};
     shared_ptr<SectionPairSection> section = make_shared<SectionPairSection>("tmp-id");
-    SerializableSectionPairSection serializable{section};
-    serializable.unmarshal(SectionPairSectionProvider::createSerializedSectionWithTomExample());
+    parameter.setValue(section);
+    parameter.setNewLine(newLine);
+    SerializableSectionPairSection serializable{parameter};
+    serializable.unmarshal(SectionPairSectionProvider::createSerializedSectionWithTomExample(newLine));
 
     ASSERT_STREQ("general", section->getSectionId().c_str());
     ASSERT_EQ(3, section->getRowAmount());
@@ -122,4 +152,6 @@ namespace
     ASSERT_STREQ("age", section->get(2)->getKey().c_str());
     ASSERT_STREQ("33", dynamic_pointer_cast<SectionPairRowSingleValue>(section->get(2)->getValue())->get().c_str());
   }
+
+  INSTANTIATE_TEST_SUITE_P(SerializableSectionPairSectionTest, SerializableSectionPairSectionSerializationTest, ::testing::Values(NewLine::getUnixNewLine(), NewLine::getWindowsNewLine()));
 }

+ 2 - 1
test/cases/io/section-pair/validator/SectionPairRowValueValidatorTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-09
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -43,6 +43,7 @@ namespace
     ASSERT_TRUE(SectionPairRowValueValidator{"Tom"}.isValid());
     ASSERT_TRUE(SectionPairRowValueValidator{"\"Tom\""}.isValid());
     ASSERT_TRUE(SectionPairRowValueValidator{"Hello!" + NewLine::get()}.isValid());
+    ASSERT_TRUE(SectionPairRowValueValidator{"Hello!" + NewLine::getWindowsNewLine()}.isValid());
   }
 
   TEST_F(SectionPairRowValueValidatorTest, isValid_not_valid)

+ 7 - 7
test/cases/io/section-pair/validator/SectionPairSectionIdUnmarshalValidatorTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-14
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -34,7 +34,7 @@ namespace
 
   TEST_F(SectionPairSectionIdUnmarshalValidatorTest, getClassName)
   {
-    ASSERT_STREQ("SectionPairSectionIdUnmarshalValidator", SectionPairSectionIdUnmarshalValidator{"\n[general]\n"}.getClassName().c_str());
+    ASSERT_STREQ("SectionPairSectionIdUnmarshalValidator", SectionPairSectionIdUnmarshalValidator("\n[general]\n", NewLine::get()).getClassName().c_str());
   }
 
   TEST_F(SectionPairSectionIdUnmarshalValidatorTest, isValid)
@@ -43,8 +43,8 @@ namespace
     byte_field generalSection = newLine + "[general]" + newLine + newLine;
     byte_field localServerSection = newLine + "[local-server]" + newLine + newLine;
 
-    ASSERT_TRUE(SectionPairSectionIdUnmarshalValidator{generalSection}.isValid());
-    ASSERT_TRUE(SectionPairSectionIdUnmarshalValidator{localServerSection}.isValid());
+    ASSERT_TRUE(SectionPairSectionIdUnmarshalValidator(generalSection, newLine).isValid());
+    ASSERT_TRUE(SectionPairSectionIdUnmarshalValidator(localServerSection, newLine).isValid());
   }
 
   TEST_F(SectionPairSectionIdUnmarshalValidatorTest, isValid_not_valid)
@@ -54,8 +54,8 @@ namespace
     byte_field localServerSection = newLine + "[local-server]";
     byte_field position = newLine + "position" + newLine;
 
-    ASSERT_FALSE(SectionPairSectionIdUnmarshalValidator{generalSection}.isValid());
-    ASSERT_FALSE(SectionPairSectionIdUnmarshalValidator{localServerSection}.isValid());
-    ASSERT_FALSE(SectionPairSectionIdUnmarshalValidator{position}.isValid());
+    ASSERT_FALSE(SectionPairSectionIdUnmarshalValidator(generalSection, newLine).isValid());
+    ASSERT_FALSE(SectionPairSectionIdUnmarshalValidator(localServerSection, newLine).isValid());
+    ASSERT_FALSE(SectionPairSectionIdUnmarshalValidator(position, newLine).isValid());
   }
 }

+ 8 - 9
test/classes/io/section-pair/SectionPairDocumentProvider.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-16
-* Changed:         2023-02-16
+* Changed:         2023-02-18
 *
 * */
 
@@ -45,21 +45,20 @@ test::io::SectionPairDocumentProvider::~SectionPairDocumentProvider() = default;
   return document;
 }
 
-ls::std::core::type::byte_field test::io::SectionPairDocumentProvider::createSerializedDocument()
+ls::std::core::type::byte_field test::io::SectionPairDocumentProvider::createSerializedDocument(const ::std::string &_newLine)
 {
-  ::std::string newLine = ls::std::io::NewLine::get();
-  ls::std::core::type::byte_field serializedDocument = "# section-pair document" + newLine + newLine;
+  ls::std::core::type::byte_field serializedDocument = "# section-pair document" + _newLine + _newLine;
 
   // general section
 
-  serializedDocument += test::io::SectionPairSectionProvider::createSerializedSectionWithSandraExample();
+  serializedDocument += test::io::SectionPairSectionProvider::createSerializedSectionWithSandraExample(_newLine);
 
   // physical
 
-  serializedDocument += newLine + "[physical]" + newLine + newLine;
-  serializedDocument += "eye-color=blue" + newLine;
-  serializedDocument += "hair-color=red" + newLine;
-  serializedDocument += "height=167" + newLine;
+  serializedDocument += _newLine + "[physical]" + _newLine + _newLine;
+  serializedDocument += "eye-color=blue" + _newLine;
+  serializedDocument += "hair-color=red" + _newLine;
+  serializedDocument += "height=167" + _newLine;
 
   return serializedDocument;
 }

+ 3 - 2
test/classes/io/section-pair/SectionPairDocumentProvider.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-16
-* Changed:         2023-02-16
+* Changed:         2023-02-18
 *
 * */
 
@@ -13,6 +13,7 @@
 #include <ls-std/ls-std-core.hpp>
 #include <ls-std/ls-std-io.hpp>
 #include <memory>
+#include <string>
 
 namespace test::io
 {
@@ -24,7 +25,7 @@ namespace test::io
       ~SectionPairDocumentProvider();
 
       static ::std::shared_ptr<ls::std::io::SectionPairDocument> createDocument();
-      static ls::std::core::type::byte_field createSerializedDocument();
+      static ls::std::core::type::byte_field createSerializedDocument(const ::std::string &_newLine);
   };
 }
 

+ 14 - 17
test/classes/io/section-pair/SectionPairSectionProvider.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-15
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -55,30 +55,27 @@ test::io::SectionPairSectionProvider::~SectionPairSectionProvider() = default;
   return section;
 }
 
-ls::std::core::type::byte_field test::io::SectionPairSectionProvider::createSerializedSectionWithSandraExample()
+ls::std::core::type::byte_field test::io::SectionPairSectionProvider::createSerializedSectionWithSandraExample(const ::std::string &_newLine)
 {
   ls::std::core::type::byte_field serializedDocument{};
-  ::std::string newLine = ls::std::io::NewLine::get();
 
-  serializedDocument += newLine + "[general]" + newLine + newLine;
-  serializedDocument += "name=Sandra" + newLine;
-  serializedDocument += "age=24" + newLine;
-  serializedDocument += "hobbies:" + newLine;
-  serializedDocument += "  swimming" + newLine;
-  serializedDocument += "  cycling" + newLine;
-  serializedDocument += "  singing" + newLine;
+  serializedDocument += _newLine + "[general]" + _newLine + _newLine;
+  serializedDocument += "name=Sandra" + _newLine;
+  serializedDocument += "age=24" + _newLine;
+  serializedDocument += "hobbies:" + _newLine;
+  serializedDocument += "  swimming" + _newLine;
+  serializedDocument += "  cycling" + _newLine;
+  serializedDocument += "  singing" + _newLine;
 
   return serializedDocument;
 }
 
-ls::std::core::type::byte_field test::io::SectionPairSectionProvider::createSerializedSectionWithTomExample()
+ls::std::core::type::byte_field test::io::SectionPairSectionProvider::createSerializedSectionWithTomExample(const ::std::string &_newLine)
 {
-  ::std::string newLine = ls::std::io::NewLine::get();
-
-  ls::std::core::type::byte_field serializedSection = newLine + "[general]" + newLine + 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;
+  ls::std::core::type::byte_field serializedSection = _newLine + "[general]" + _newLine + _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;
 }

+ 4 - 3
test/classes/io/section-pair/SectionPairSectionProvider.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-15
-* Changed:         2023-02-16
+* Changed:         2023-02-17
 *
 * */
 
@@ -13,6 +13,7 @@
 #include <ls-std/ls-std-core.hpp>
 #include <ls-std/ls-std-io.hpp>
 #include <memory>
+#include <string>
 
 namespace test::io
 {
@@ -25,8 +26,8 @@ namespace test::io
 
       static ::std::shared_ptr<ls::std::io::SectionPairSection> createSectionWithSandraExample();
       static ::std::shared_ptr<ls::std::io::SectionPairSection> createSectionWithTomExample();
-      static ls::std::core::type::byte_field createSerializedSectionWithSandraExample();
-      static ls::std::core::type::byte_field createSerializedSectionWithTomExample();
+      static ls::std::core::type::byte_field createSerializedSectionWithSandraExample(const ::std::string &_newLine);
+      static ls::std::core::type::byte_field createSerializedSectionWithTomExample(const ::std::string &_newLine);
   };
 }
 

+ 60 - 0
test/classes/io/section-pair/SerializableSectionPairRowProvider.cpp

@@ -0,0 +1,60 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-17
+* Changed:         2023-02-17
+*
+* */
+
+#include "SerializableSectionPairRowProvider.hpp"
+
+test::io::SerializableSectionPairRowProvider::SerializableSectionPairRowProvider() = default;
+
+test::io::SerializableSectionPairRowProvider::~SerializableSectionPairRowProvider() = default;
+
+::std::shared_ptr<ls::std::io::SerializableSectionPairRow> test::io::SerializableSectionPairRowProvider::createListValueForMarshal(const ::std::string &_newLine)
+{
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setNewLine(_newLine);
+  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::make_shared<ls::std::io::SectionPairRow>("favourite-colors", ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_LIST_VALUE);
+  parameter.setValue(row);
+  ::std::shared_ptr<ls::std::io::SectionPairRowListValue> listValue = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowListValue>(row->getValue());
+  listValue->add("blue");
+  listValue->add("red");
+  listValue->add("purple");
+
+  return ::std::make_shared<ls::std::io::SerializableSectionPairRow>(parameter);
+}
+
+::std::shared_ptr<ls::std::io::SerializableSectionPairRow> test::io::SerializableSectionPairRowProvider::createListValueForUnmarshal(const ::std::string &_newLine)
+{
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setNewLine(_newLine);
+  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::make_shared<ls::std::io::SectionPairRow>("tmp-key", ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_LIST_VALUE);
+  parameter.setValue(row);
+
+  return ::std::make_shared<ls::std::io::SerializableSectionPairRow>(parameter);
+}
+
+::std::shared_ptr<ls::std::io::SerializableSectionPairRow> test::io::SerializableSectionPairRowProvider::createSingleValueForMarshal(const ::std::string &_newLine)
+{
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setNewLine(_newLine);
+  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::make_shared<ls::std::io::SectionPairRow>("favourite-color", ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
+  parameter.setValue(row);
+  ::std::shared_ptr<ls::std::io::SectionPairRowSingleValue> singleValue = ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(row->getValue());
+  singleValue->set("blue");
+
+  return ::std::make_shared<ls::std::io::SerializableSectionPairRow>(parameter);
+}
+
+::std::shared_ptr<ls::std::io::SerializableSectionPairRow> test::io::SerializableSectionPairRowProvider::createSingleValueForUnmarshal(const ::std::string &_newLine)
+{
+  ls::std::io::SerializableSectionPairParameter parameter{};
+  parameter.setNewLine(_newLine);
+  ::std::shared_ptr<ls::std::io::SectionPairRow> row = ::std::make_shared<ls::std::io::SectionPairRow>("tmp-key", ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
+  parameter.setValue(row);
+
+  return ::std::make_shared<ls::std::io::SerializableSectionPairRow>(parameter);
+}

+ 33 - 0
test/classes/io/section-pair/SerializableSectionPairRowProvider.hpp

@@ -0,0 +1,33 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-17
+* Changed:         2023-02-17
+*
+* */
+
+#ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_PROVIDER_HPP
+#define LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_PROVIDER_HPP
+
+#include <ls-std/ls-std-io.hpp>
+#include <memory>
+#include <string>
+
+namespace test::io
+{
+  class SerializableSectionPairRowProvider
+  {
+    public:
+
+      SerializableSectionPairRowProvider();
+      ~SerializableSectionPairRowProvider();
+
+      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createListValueForMarshal(const ::std::string &_newLine);
+      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createListValueForUnmarshal(const ::std::string &_newLine);
+      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createSingleValueForMarshal(const ::std::string &_newLine);
+      static ::std::shared_ptr<ls::std::io::SerializableSectionPairRow> createSingleValueForUnmarshal(const ::std::string &_newLine);
+  };
+}
+
+#endif

+ 2 - 1
test/ls-std-io-test.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-05-14
- * Changed:         2023-02-16
+ * Changed:         2023-02-17
  *
  * */
 
@@ -12,6 +12,7 @@
 
 #include <classes/io/section-pair/SectionPairDocumentProvider.hpp>
 #include <classes/io/section-pair/SectionPairSectionProvider.hpp>
+#include <classes/io/section-pair/SerializableSectionPairRowProvider.hpp>
 
 #include <classes/io/xml/TestDataFactory.hpp>
 #include <classes/io/xml/XmlParserTestWrapper.hpp>