NewLine.hpp 882 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-18
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #ifndef LS_STD_NEW_LINE_HPP
  10. #define LS_STD_NEW_LINE_HPP
  11. #include <string>
  12. namespace ls_std
  13. {
  14. class NewLine
  15. {
  16. public:
  17. NewLine() = default;
  18. ~NewLine() = default;
  19. static std::string get()
  20. {
  21. std::string newLine{};
  22. #if defined(unix) || defined(__APPLE__)
  23. newLine = ls_std::NewLine::getUnixNewLine();
  24. #endif
  25. #ifdef _WIN32
  26. newLine = ls_std::NewLine::getWindowsNewLine();
  27. #endif
  28. return newLine;
  29. }
  30. static std::string getUnixNewLine()
  31. {
  32. return "\n";
  33. }
  34. static std::string getWindowsNewLine()
  35. {
  36. return "\r\n";
  37. }
  38. };
  39. }
  40. #endif