NewLine.hpp 1.0 KB

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