Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the Water library.
  4. Copyright (c) 2016 ROLI Ltd.
  5. Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
  6. Permission is granted to use this software under the terms of the ISC license
  7. http://www.isc.org/downloads/software-support-policy/isc-license/
  8. Permission to use, copy, modify, and/or distribute this software for any
  9. purpose with or without fee is hereby granted, provided that the above
  10. copyright notice and this permission notice appear in all copies.
  11. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  12. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  13. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  14. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  15. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  17. OF THIS SOFTWARE.
  18. ==============================================================================
  19. */
  20. #ifndef JUCE_NEWLINE_H_INCLUDED
  21. #define JUCE_NEWLINE_H_INCLUDED
  22. #include "../water.h"
  23. namespace water {
  24. //==============================================================================
  25. /** This class is used for represent a new-line character sequence.
  26. To write a new-line to a stream, you can use the predefined 'newLine' variable, e.g.
  27. @code
  28. myOutputStream << "Hello World" << newLine << newLine;
  29. @endcode
  30. The exact character sequence that will be used for the new-line can be set and
  31. retrieved with OutputStream::setNewLineString() and OutputStream::getNewLineString().
  32. */
  33. class NewLine
  34. {
  35. public:
  36. /** Returns the default new-line sequence that the library uses.
  37. @see OutputStream::setNewLineString()
  38. */
  39. static const char* getDefault() noexcept { return "\r\n"; }
  40. /** Returns the default new-line sequence that the library uses.
  41. @see getDefault()
  42. */
  43. operator String() const { return getDefault(); }
  44. /** Returns the default new-line sequence that the library uses.
  45. @see OutputStream::setNewLineString()
  46. */
  47. operator StringRef() const noexcept { return getDefault(); }
  48. };
  49. //==============================================================================
  50. /** A predefined object representing a new-line, which can be written to a string or stream.
  51. To write a new-line to a stream, you can use the predefined 'newLine' variable like this:
  52. @code
  53. myOutputStream << "Hello World" << newLine << newLine;
  54. @endcode
  55. */
  56. extern NewLine newLine;
  57. //==============================================================================
  58. /** Writes a new-line sequence to a string.
  59. You can use the predefined object 'newLine' to invoke this, e.g.
  60. @code
  61. myString << "Hello World" << newLine << newLine;
  62. @endcode
  63. */
  64. inline String& operator<< (String& string1, const NewLine&) { return string1 += NewLine::getDefault(); }
  65. inline String& operator+= (String& s1, const NewLine&) { return s1 += NewLine::getDefault(); }
  66. inline String operator+ (const NewLine&, const NewLine&) { return String (NewLine::getDefault()) + NewLine::getDefault(); }
  67. inline String operator+ (String s1, const NewLine&) { return s1 += NewLine::getDefault(); }
  68. inline String operator+ (const NewLine&, const char* s2) { return String (NewLine::getDefault()) + s2; }
  69. }
  70. #endif // JUCE_NEWLINE_H_INCLUDED