SectionPairMessageFormatter.cpp 883 B

1234567891011121314151617181920212223242526272829
  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-23
  7. *
  8. * */
  9. #include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
  10. #include <regex>
  11. using ls::std::io::SectionPairMessageFormatter;
  12. using std::regex;
  13. using std::regex_replace;
  14. using std::string;
  15. SectionPairMessageFormatter::SectionPairMessageFormatter() = default;
  16. SectionPairMessageFormatter::~SectionPairMessageFormatter() = default;
  17. string SectionPairMessageFormatter::getFormattedMessage(const string &_message)
  18. {
  19. string formattedMessage = _message;
  20. formattedMessage = regex_replace(formattedMessage, regex(R"(\r{1}\n{1})"), "{WINDOWS_LINE_BREAK}");
  21. formattedMessage = regex_replace(formattedMessage, regex(R"(\n{1})"), "{UNIX_LINE_BREAK}");
  22. return formattedMessage;
  23. }