Lines Matching +full:- +full:- +full:output +full:- +full:document
16 a set of key-value pairs where the key ends with a colon. For example:
18 .. code-block:: yaml
22 hat-size: 7
24 A sequence is a list of items where each item starts with a leading dash ('-').
27 .. code-block:: yaml
30 - x86
31 - x86_64
32 - PowerPC
37 .. code-block:: yaml
40 - name: Tom
42 - x86
43 - x86_64
44 - name: Bob
46 - x86
47 - name: Dan
49 - PowerPC
50 - x86
58 .. code-block:: yaml
61 - name: Tom
63 - name: Bob
65 - name: Dan
92 YAML I/O uses a non-invasive, traits based design. YAML I/O defines some
97 .. code-block:: c++
111 both reading and writing YAML. That is, the mapping between in-memory enum
120 .. code-block:: c++
129 io.mapOptional("hat-size", info.hatSize);
139 programmatically use YAML I/O to write a YAML document:
141 .. code-block:: c++
143 using llvm::yaml::Output;
155 Output yout(llvm::outs());
160 .. code-block:: yaml
162 - name: Tom
163 hat-size: 8
164 - name: Dan
165 hat-size: 7
169 .. code-block:: c++
176 Input yin(document.getBuffer());
182 // Process read document
190 single file. That is why reading YAML produces a vector of your document type.
197 When parsing a YAML document, if the input does not match your schema (as
200 return true. For instance the following document:
202 .. code-block:: yaml
204 - name: Tom
205 shoe-size: 12
206 - name: Dan
207 hat-size: 7
209 Has a key (shoe-size) that is not defined in the schema. YAML I/O will
212 .. code-block:: yaml
214 YAML:2:2: error: unknown key 'shoe-size'
215 shoe-size: 12
229 Built-in types
230 --------------
231 The following types have built-in support in YAML I/O:
253 ------------
259 like a typedef on built-in types, but expands to create a class with conversion
262 .. code-block:: c++
273 ---------
276 format used by the built-in integer types:
288 -----------------------
289 YAML I/O supports translating between in-memory enumerations and a set of string
295 .. code-block:: c++
312 .. code-block:: c++
342 --------
348 .. code-block:: c++
362 .. code-block:: c++
395 the above schema, a same valid YAML document is:
397 .. code-block:: yaml
403 defined by a bit-mask.
405 .. code-block:: c++
421 .. code-block:: c++
440 -------------
444 some time format (e.g. 4-May-2012 10:30pm). YAML I/O has a way to support
452 .. code-block:: c++
459 static void output(const MyCustomType &value, void*,
473 -------------
478 .. code-block:: yaml
486 your data type. The library doesn't provide any built-in support for block
491 ScalarTraits specialization - YAML I/O will provide the native type and your
498 .. code-block:: c++
509 static void output(const MyStringType &Value, void *Ctxt,
531 .. code-block:: c++
549 io.mapOptional("size", bar->size);
556 ----------------
563 .. code-block:: c++
572 io.mapOptional("hat-size", info.hatSize);
578 ----------------
589 .. code-block:: c++
599 .. code-block:: yaml
602 y: -4.7
608 .. code-block:: c++
636 io.mapRequired("x", keys->x);
637 io.mapRequired("y", keys->y);
648 methods will find the matching key in the YAML document and fill in the x and y
664 --------------
670 exist in the YAML document being read. So what value is put in the field
677 it is the value that mapOptional() should set that field to if the YAML document
681 and third parameter to mapOptional). When YAML I/O generates a YAML document,
687 --------------
689 When writing out a YAML document, the keys are written in the order that the
692 the YAML document would find natural. This may be different that the order
695 When reading in a YAML document, the keys in the document can be in any order,
703 .. code-block:: c++
727 ----
740 ----------
751 key/values are written. Any error during output will trigger an ``assert()``
755 .. code-block:: c++
778 ------------
784 .. code-block:: c++
802 Flow mappings are subject to line wrapping according to the Output object
813 .. code-block:: c++
830 -------------
836 .. code-block:: c++
849 will be used (e.g. [ 10, -3, 4 ]).
851 Flow sequences are subject to line wrapping according to the Output object
855 --------------
862 .. code-block:: c++
871 Document List
875 new document starts with a left aligned "---" token. The end of all documents
880 trait for you document list type. The trait has the same methods as
883 .. code-block:: c++
894 When an llvm::yaml::Input or llvm::yaml::Output object is created their
911 Output chapter
914 The llvm::yaml::Output class is used to generate a YAML document from your
915 in-memory data structures, using traits defined on your data types.
916 To instantiate an Output object you need an llvm::raw_ostream, an optional
919 .. code-block:: c++
921 class Output : public IO {
923 Output(llvm::raw_ostream &, void *context = NULL, int WrapColumn = 70);
925 Once you have an Output object, you can use the C++ stream operator on it
928 streaming as YAML is a mapping, scalar, or sequence, then Output assumes you
929 are generating one document and wraps the mapping output
930 with "``---``" and trailing "``...``".
933 line-wrap when they go over the supplied column. Pass 0 to completely
936 .. code-block:: c++
938 using llvm::yaml::Output;
941 Output yout(llvm::outs());
945 The above could produce output like:
947 .. code-block:: yaml
949 ---
951 hat-size: 7
955 has a DocumentListTraits specialization, then Output walks through each element
956 of your DocumentList and generates a "---" before the start of each element
959 .. code-block:: c++
961 using llvm::yaml::Output;
964 Output yout(llvm::outs());
968 The above could produce output like:
970 .. code-block:: yaml
972 ---
974 hat-size: 7
975 ---
977 shoe-size: 11
983 The llvm::yaml::Input class is used to parse YAML document(s) into your native
988 .. code-block:: c++
995 the document(s). If you expect there might be multiple YAML documents in
997 document type and stream in that document list type. Otherwise you can
998 just stream in the document type. Also, you can check if there was
1002 .. code-block:: c++
1004 // Reading a single document
1018 .. code-block:: c++