Explorar el Código

Fix byte type clash with Windows OS

Patrick-Christopher Mattulat hace 1 año
padre
commit
9c4a74e7b8

+ 2 - 2
include/ls-std/boxing/String.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-14
- * Changed:         2023-02-22
+ * Changed:         2023-02-23
  *
  * */
 
@@ -64,7 +64,7 @@ namespace ls::std::boxing
       [[nodiscard]] bool endsWith(const ::std::string &_text);
       [[nodiscard]] bool equalsIgnoreCase(ls::std::boxing::String _string);
       [[nodiscard]] bool equalsIgnoreCase(::std::string _text);
-      [[nodiscard]] ::std::vector<ls::std::core::type::byte> getByteData();
+      [[nodiscard]] ::std::vector<ls::std::core::type::byte_type> getByteData();
       [[nodiscard]] ::std::string padLeft(size_t _width, char _fillCharacter);
       [[nodiscard]] ::std::string padRight(size_t _width, char _fillCharacter);
       [[nodiscard]] ::std::string reverse();

+ 2 - 2
include/ls-std/core/type/Types.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-07
- * Changed:         2023-02-08
+ * Changed:         2023-02-23
  *
  * */
 
@@ -15,7 +15,7 @@
 
 namespace ls::std::core::type
 {
-  using byte = char;
+  using byte_type = char;
   using byte_field = ::std::string;
   using long_type = long long int;
   using version_type = uint16_t;

+ 8 - 8
include/ls-std/io/logging/Logger.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-20
- * Changed:         2023-02-22
+ * Changed:         2023-02-23
  *
  * */
 
@@ -27,14 +27,14 @@ namespace ls::std::io
       explicit Logger(const ::std::shared_ptr<ls::std::core::interface_type::IWriter> &_writer);
       ~Logger() noexcept override;
 
-      void debug(const ls::std::core::type::byte *_data);
-      void error(const ls::std::core::type::byte *_data);
-      void fatal(const ls::std::core::type::byte *_data);
+      void debug(const ls::std::core::type::byte_type *_data);
+      void error(const ls::std::core::type::byte_type *_data);
+      void fatal(const ls::std::core::type::byte_type *_data);
       [[nodiscard]] ls::std::io::LogLevel getLogLevel();
-      void info(const ls::std::core::type::byte *_data);
+      void info(const ls::std::core::type::byte_type *_data);
       void setLogLevel(const ls::std::io::LogLevelValue &_logLevelValue);
-      void trace(const ls::std::core::type::byte *_data);
-      void warn(const ls::std::core::type::byte *_data);
+      void trace(const ls::std::core::type::byte_type *_data);
+      void warn(const ls::std::core::type::byte_type *_data);
 
     private:
 
@@ -45,7 +45,7 @@ namespace ls::std::io
       [[nodiscard]] static ::std::string _buildCharacterChain(size_t _amount);
       [[nodiscard]] static ::std::string _createFillContent(const ::std::string &_text);
       [[nodiscard]] static ::std::string _generateTimeString(tm *_localTime);
-      void _log(const ls::std::core::type::byte *_data, const ls::std::io::LogLevel &_logLevel);
+      void _log(const ls::std::core::type::byte_type *_data, const ls::std::io::LogLevel &_logLevel);
       [[nodiscard]] static ::std::string _padRight(const ::std::string &_text);
   };
 }

+ 3 - 3
source/ls-std/boxing/String.cpp

@@ -12,7 +12,7 @@
 
 using ls::std::boxing::String;
 using ls::std::core::Class;
-using ls::std::core::type::byte;
+using ls::std::core::type::byte_type;
 using std::move;
 using std::reverse;
 using std::string;
@@ -128,9 +128,9 @@ bool String::equalsIgnoreCase(string _text)
   return this->toLowerCase() == String{::move(_text)}.toLowerCase();
 }
 
-vector<byte> String::getByteData()
+vector<byte_type> String::getByteData()
 {
-  vector<byte> byteData(this->value.begin(), this->value.end());
+  vector<byte_type> byteData(this->value.begin(), this->value.end());
   byteData.push_back('\0');
 
   return byteData;

+ 3 - 3
source/ls-std/io/FileReader.cpp

@@ -14,8 +14,8 @@
 
 using ls::std::core::Class;
 using ls::std::core::FileOperationException;
-using ls::std::core::type::byte;
 using ls::std::core::type::byte_field;
+using ls::std::core::type::byte_type;
 using ls::std::io::File;
 using ls::std::io::FileExistenceEvaluator;
 using ls::std::io::FileReader;
@@ -30,10 +30,10 @@ FileReader::~FileReader() noexcept = default;
 
 byte_field FileReader::read()
 {
-  byte *data;
+  byte_type *data;
   ifstream inputStream{this->file.getAbsoluteFilePath(), ifstream::binary};
   int length = (int) this->file.getSize();
-  data = new byte[length];
+  data = new byte_type[length];
   inputStream.read(data, length);
 
   if (inputStream.fail())

+ 8 - 8
source/ls-std/io/logging/Logger.cpp

@@ -19,7 +19,7 @@
 using ls::std::core::Class;
 using ls::std::core::NullPointerArgumentEvaluator;
 using ls::std::core::interface_type::IWriter;
-using ls::std::core::type::byte;
+using ls::std::core::type::byte_type;
 using ls::std::io::Logger;
 using ls::std::io::LogLevel;
 using ls::std::io::LogLevelValue;
@@ -38,7 +38,7 @@ Logger::Logger(const shared_ptr<IWriter> &_writer) : Class("Logger"), logLevel(L
 
 Logger::~Logger() noexcept = default;
 
-void Logger::debug(const byte *_data)
+void Logger::debug(const byte_type *_data)
 {
   if (this->logLevel >= LogLevelValue::DEBUG)
   {
@@ -46,7 +46,7 @@ void Logger::debug(const byte *_data)
   }
 }
 
-void Logger::error(const byte *_data)
+void Logger::error(const byte_type *_data)
 {
   if (this->logLevel >= LogLevelValue::ERR)
   {
@@ -54,7 +54,7 @@ void Logger::error(const byte *_data)
   }
 }
 
-void Logger::fatal(const byte *_data)
+void Logger::fatal(const byte_type *_data)
 {
   if (this->logLevel >= LogLevelValue::FATAL)
   {
@@ -67,7 +67,7 @@ LogLevel Logger::getLogLevel()
   return this->logLevel;
 }
 
-void Logger::info(const byte *_data)
+void Logger::info(const byte_type *_data)
 {
   if (this->logLevel >= LogLevelValue::INFO)
   {
@@ -80,7 +80,7 @@ void Logger::setLogLevel(const LogLevelValue &_logLevelValue)
   this->logLevel = _logLevelValue;
 }
 
-void Logger::trace(const byte *_data)
+void Logger::trace(const byte_type *_data)
 {
   if (this->logLevel >= LogLevelValue::TRACE)
   {
@@ -88,7 +88,7 @@ void Logger::trace(const byte *_data)
   }
 }
 
-void Logger::warn(const byte *_data)
+void Logger::warn(const byte_type *_data)
 {
   if (this->logLevel >= LogLevelValue::WARN)
   {
@@ -136,7 +136,7 @@ string Logger::_generateTimeString(tm *_localTime)
   return _stream.str();
 }
 
-void Logger::_log(const byte *_data, const LogLevel &_logLevel)
+void Logger::_log(const byte_type *_data, const LogLevel &_logLevel)
 {
   time_t timestamp = ::time(nullptr);
   tm *localTime = localtime(&timestamp);