aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ext_depends/D-YAML/source/dyaml/linebreak.d
blob: 1f0f661ac1587b486803b110206c1b6e2b784e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//          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
{
    ///Unix line break ("\n").
    unix,
    ///Windows line break ("\r\n").
    windows,
    ///Macintosh line break ("\r").
    macintosh
}

package:

//Get line break string for specified line break.
string lineBreak(in LineBreak b) pure @safe nothrow
{
    final switch(b)
    {
        case LineBreak.unix:      return "\n";
        case LineBreak.windows:   return "\r\n";
        case LineBreak.macintosh: return "\r";
    }
}