OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library yaml.style; | |
6 | |
7 /// An enum of source scalar styles. | |
8 class ScalarStyle { | |
9 /// No source style was specified. | |
10 /// | |
11 /// This usually indicates a scalar constructed with [YamlScalar.wrap]. | |
12 static const ANY = const ScalarStyle._("ANY"); | |
13 | |
14 /// The plain scalar style, unquoted and without a prefix. | |
15 /// | |
16 /// See http://yaml.org/spec/1.2/spec.html#style/flow/plain. | |
17 static const PLAIN = const ScalarStyle._("PLAIN"); | |
18 | |
19 /// The literal scalar style, with a `|` prefix. | |
20 /// | |
21 /// See http://yaml.org/spec/1.2/spec.html#id2795688. | |
22 static const LITERAL = const ScalarStyle._("LITERAL"); | |
23 | |
24 | |
25 /// The folded scalar style, with a `>` prefix. | |
26 /// | |
27 /// See http://yaml.org/spec/1.2/spec.html#id2796251. | |
28 static const FOLDED = const ScalarStyle._("FOLDED"); | |
29 | |
30 /// The single-quoted scalar style. | |
31 /// | |
32 /// See http://yaml.org/spec/1.2/spec.html#style/flow/single-quoted. | |
33 static const SINGLE_QUOTED = const ScalarStyle._("SINGLE_QUOTED"); | |
34 | |
35 /// The double-quoted scalar style. | |
36 /// | |
37 /// See http://yaml.org/spec/1.2/spec.html#style/flow/double-quoted. | |
38 static const DOUBLE_QUOTED = const ScalarStyle._("DOUBLE_QUOTED"); | |
39 | |
40 final String name; | |
41 | |
42 /// Whether this is a quoted style ([SINGLE_QUOTED] or [DOUBLE_QUOTED]). | |
43 bool get isQuoted => this == SINGLE_QUOTED || this == DOUBLE_QUOTED; | |
44 | |
45 const ScalarStyle._(this.name); | |
46 | |
47 String toString() => name; | |
48 } | |
49 | |
50 /// An enum of collection styles. | |
51 class CollectionStyle { | |
52 /// No source style was specified. | |
53 /// | |
54 /// This usually indicates a collection constructed with [YamlList.wrap] or | |
55 /// [YamlMap.wrap]. | |
56 static const ANY = const CollectionStyle._("ANY"); | |
57 | |
58 /// The indentation-based block style. | |
59 /// | |
60 /// See http://yaml.org/spec/1.2/spec.html#id2797293. | |
61 static const BLOCK = const CollectionStyle._("BLOCK"); | |
62 | |
63 /// The delimiter-based block style. | |
64 /// | |
65 /// See http://yaml.org/spec/1.2/spec.html#id2790088. | |
66 static const FLOW = const CollectionStyle._("FLOW"); | |
67 | |
68 final String name; | |
69 | |
70 const CollectionStyle._(this.name); | |
71 | |
72 String toString() => name; | |
73 } | |
OLD | NEW |