1 
2 //          Copyright Ferdinand Majerech 2011.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module dyaml.linebreak;
8 
9 
10 ///Enumerates platform specific line breaks.
11 enum LineBreak
12 {
13     ///Unix line break ("\n").
14     Unix,
15     ///Windows line break ("\r\n").
16     Windows,
17     ///Macintosh line break ("\r").
18     Macintosh
19 }
20 
21 package:
22 
23 //Get line break string for specified line break.
24 string lineBreak(in LineBreak b) pure @safe nothrow
25 {
26     final switch(b)
27     {
28         case LineBreak.Unix:      return "\n";
29         case LineBreak.Windows:   return "\r\n";
30         case LineBreak.Macintosh: return "\r";
31     }
32 }