2 İşlemeler 0c82ab391a ... a3602810f9

Yazar SHA1 Mesaj Tarih
  Patrick-Christopher Mattulat a3602810f9 Fix section pair file reader test 2 hafta önce
  Patrick-Christopher Mattulat 6e9c75bc06 Fix namespace renaming issue 2 hafta önce

+ 1 - 1
README.md

@@ -35,7 +35,7 @@ A __Date__ class comes with this submodule, which you can use to represent a dat
 #### Features ####
 
 - GNU-like compilers are not supported anymore to focus more in depth on MSVC, Clang, Apple Clang - thus, still supporting the major platforms Linux, macOS and Windows
-- ls::std:: namespace was renamed to ls::standard to avoid clashes with C++-STL.
+- ls::standard:: namespace was renamed to ls::standard to avoid clashes with C++-STL.
 
 #### Improvements ####
 

+ 1 - 1
doc/internal/coding-guidelines.md

@@ -28,4 +28,4 @@ The following naming conventions must be met for code contribution:
 
 The following source code creation guidelines must be followed:
 
-1. In source code (.cpp files) namespaces must not be used throughout the code and must be announced through the __using__ keyword after the imports (e.g. using ls::std::boxing::Integer). The only exception is when the same class name is being used in more than one namespace.
+1. In source code (.cpp files) namespaces must not be used throughout the code and must be announced through the __using__ keyword after the imports (e.g. using ls::standard::boxing::Integer). The only exception is when the same class name is being used in more than one namespace.

+ 2 - 1
include/ls-std/io/section-pair/reader/SectionPairFileReader.hpp

@@ -4,7 +4,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-21
-* Changed:         2026-06-23
+* Changed:         2026-06-24
 *
 * */
 
@@ -42,6 +42,7 @@ namespace ls::standard::io
       void _createDocument();
       void _createFileExistenceEvaluator();
       void _createReader();
+      [[nodiscard]] static ::std::string _detectNewLine(const ls::standard::core::type::byte_field &_data);
   };
 }
 

+ 10 - 1
source/ls-std/io/section-pair/reader/SectionPairFileReader.cpp

@@ -4,13 +4,14 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-21
-* Changed:         2026-06-23
+* Changed:         2026-06-24
 *
 * */
 
 #include <ls-std/core/ConditionalFunctionExecutor.hpp>
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
 #include <ls-std/io/FileReader.hpp>
+#include <ls-std/io/NewLine.hpp>
 #include <ls-std/io/evaluator/FileExistenceEvaluator.hpp>
 #include <ls-std/io/section-pair/model/SectionPairDocument.hpp>
 #include <ls-std/io/section-pair/reader/SectionPairFileReader.hpp>
@@ -24,6 +25,7 @@ using ls::standard::core::type::byte_field;
 using ls::standard::io::File;
 using ls::standard::io::FileExistenceEvaluator;
 using ls::standard::io::FileReader;
+using ls::standard::io::NewLine;
 using ls::standard::io::SectionPairDocument;
 using ls::standard::io::SectionPairFileExtensionValidator;
 using ls::standard::io::SectionPairFileReader;
@@ -52,11 +54,13 @@ byte_field SectionPairFileReader::read()
 {
   this->parameter.getDocument()->clear();
   byte_field data = this->parameter.getReader()->read();
+  this->parameter.getDocument()->reserveNewLine(SectionPairFileReader::_detectNewLine(data));
   this->parameter.getDocument()->unmarshal(data);
 
   return data;
 }
 
+
 void SectionPairFileReader::_checkFileExtension() const
 {
   if (!SectionPairFileExtensionValidator{this->parameter.getFilePath()}.isValid())
@@ -81,3 +85,8 @@ void SectionPairFileReader::_createReader()
   File file{this->parameter.getFilePath()};
   this->parameter.setReader(make_shared<FileReader>(file));
 }
+
+string SectionPairFileReader::_detectNewLine(const byte_field &_data)
+{
+  return _data.find(NewLine::getWindowsNewLine()) != string::npos ? NewLine::getWindowsNewLine() : NewLine::getUnixNewLine();
+}

+ 2 - 2
test/classes/time/system-time/MockClock.hpp

@@ -16,14 +16,14 @@
 
 namespace test::time
 {
-  class MockClock : public ls::std::time::IClock
+  class MockClock : public ls::standard::time::IClock
   {
     public:
 
       MockClock();
       ~MockClock() noexcept override;
 
-      MOCK_METHOD(bool, setTime, (const ls::std::time::DateParameter &_dateParameter), (override));
+      MOCK_METHOD(bool, setTime, (const ls::standard::time::DateParameter &_dateParameter), (override));
   };
 }