NewLine.hpp 867 B

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