NewLine.hpp 1.1 KB

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