2011-10-11 13:58:23 +00:00
|
|
|
|
|
|
|
// Copyright Ferdinand Majerech 2011.
|
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
|
|
|
|
module dyaml.linebreak;
|
|
|
|
|
|
|
|
|
|
|
|
///Enumerates platform specific line breaks.
|
|
|
|
enum LineBreak
|
|
|
|
{
|
2011-10-14 08:34:53 +00:00
|
|
|
///Unix line break ("\n").
|
2018-08-27 00:49:14 +00:00
|
|
|
unix,
|
2011-10-14 08:34:53 +00:00
|
|
|
///Windows line break ("\r\n").
|
2018-08-27 00:49:14 +00:00
|
|
|
windows,
|
2011-10-14 08:34:53 +00:00
|
|
|
///Macintosh line break ("\r").
|
2018-08-27 00:49:14 +00:00
|
|
|
macintosh
|
2011-10-11 13:58:23 +00:00
|
|
|
}
|
|
|
|
|
2011-10-14 08:34:53 +00:00
|
|
|
package:
|
|
|
|
|
|
|
|
//Get line break string for specified line break.
|
2012-09-08 23:42:13 +00:00
|
|
|
string lineBreak(in LineBreak b) pure @safe nothrow
|
2011-10-11 13:58:23 +00:00
|
|
|
{
|
|
|
|
final switch(b)
|
|
|
|
{
|
2018-08-27 00:49:14 +00:00
|
|
|
case LineBreak.unix: return "\n";
|
|
|
|
case LineBreak.windows: return "\r\n";
|
|
|
|
case LineBreak.macintosh: return "\r";
|
2011-10-11 13:58:23 +00:00
|
|
|
}
|
|
|
|
}
|