SectionPairMessageFormatter.cpp 859 B

123456789101112131415161718192021222324
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-22
  6. * Changed: 2023-02-22
  7. *
  8. * */
  9. #include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
  10. #include <regex>
  11. ls::std::io::SectionPairMessageFormatter::SectionPairMessageFormatter() = default;
  12. ls::std::io::SectionPairMessageFormatter::~SectionPairMessageFormatter() = default;
  13. ::std::string ls::std::io::SectionPairMessageFormatter::getFormattedMessage(const ::std::string &_message)
  14. {
  15. ::std::string formattedMessage = _message;
  16. formattedMessage = ::std::regex_replace(formattedMessage, ::std::regex(R"(\r{1}\n{1})"), "{WINDOWS_LINE_BREAK}");
  17. formattedMessage = ::std::regex_replace(formattedMessage, ::std::regex(R"(\n{1})"), "{UNIX_LINE_BREAK}");
  18. return formattedMessage;
  19. }