rapidyaml  0.10.0
parse and emit YAML, and do it fast
c4::yml::extra::ievt Namespace Reference

Typedefs

using DataType = int32_t
 data type for integer events. More...
 

Enumerations

enum  EventFlags : DataType {
  BSTR = (1 << 0) , ESTR = (1 << 1) , BDOC = (1 << 2) , EDOC = (1 << 3) ,
  BMAP = (1 << 4) , EMAP = (1 << 5) , BSEQ = (1 << 6) , ESEQ = (1 << 7) ,
  SCLR = (1 << 8) , ANCH = (1 << 9) , ALIA = (1 << 10) , TAG_ = (1 << 11) ,
  PLAI = (1 << 12) , SQUO = (1 << 13) , DQUO = (1 << 14) , LITL = (1 << 15) ,
  FOLD = (1 << 16) , FLOW = (1 << 17) , BLCK = (1 << 18) , KEY_ = (1 << 19) ,
  VAL_ = (1 << 20) , EXPL = (1 << 21) , YAML = (1 << 22) , TAGD = (1 << 23) ,
  TAGV = (1 << 24) , AREN = (1 << 25) , PSTR = (1 << 26) , UNFILT = (1 << 27) ,
  LAST = UNFILT , MASK = (LAST << 1) - 1 , WSTR = SCLR|ALIA|ANCH|TAG_|TAGD|TAGV|YAML
}
 enumeration of integer event bits. More...
 

Functions

size_t to_chars (substr buf, yml::extra::ievt::DataType flags)
 Convert bit mask of ievt::EventFlags to text. More...
 
csubstr to_chars_sub (substr buf, yml::extra::ievt::DataType flags)
 Convert bit mask of ievt::EventFlags to text. More...
 

Typedef Documentation

◆ DataType

using c4::yml::extra::ievt::DataType = typedef int32_t

data type for integer events.

This is set to a 32 bit signed integer to allow compatibility with a wide range of processing languages.

Definition at line 41 of file event_handler_ints.hpp.

Enumeration Type Documentation

◆ EventFlags

enumeration of integer event bits.

Enumerator
BSTR 

+STR begin stream

ESTR 

-STR end stream

BDOC 

+DOC begin doc

EDOC 

-DOC end doc

BMAP 

+MAP begin map

EMAP 

-MAP end map

BSEQ 

+SEQ begin seq

ESEQ 

-SEQ end seq

SCLR 

=VAL scalar

ANCH 

&anchor

ALIA 

*ref =ALI alias (reference)

TAG_ 

!tag

PLAI 

plain scalar

SQUO 

single-quoted scalar (')

DQUO 

double-quoted scalar ("")

LITL 

block literal scalar (|)

FOLD 

block folded scalar (>)

FLOW 

flow container: [] for seqs or {} for maps

BLCK 

block container

KEY_ 

as key

VAL_ 

as value

EXPL 

--- (with BDOC) or ... (with EDOC)

YAML 

YAML <version>

TAGD 

tag directive name : TAG <name> .......

TAGV 

tag directive value: TAG ...... <value>

AREN 

IMPORTANT. Marks events whose string was placed in the arena. This happens when the filtered string is larger than the original string in the YAML code (eg from tags that resolve to a larger string, or from "\L" or "\P" in double quotes, which expand from two to three bytes). Because of this size expansion, the filtered string cannot be placed in the original source and needs to be placed in the arena.

PSTR 

special flag to enable look-back in the event array. it signifies that the previous event has a string, meaning that the jump back to that event is 3 positions. without this flag it would be impossible to jump to the previous event.

UNFILT 

special flag to mark a scalar as unfiltered (when the parser is set not to filter).

LAST 

the last flag defined above

MASK 

a mask of all bits in this enumeration with string: mask of all the events that encode a string following the event. in the event has a string. the next two integers will provide respectively the string's offset and length. See also PSTR.

WSTR 

Definition at line 44 of file event_handler_ints.hpp.

44  : DataType {
45 
46  // Event types
47  BSTR = (1 << 0), ///< +STR begin stream
48  ESTR = (1 << 1), ///< -STR end stream
49  BDOC = (1 << 2), ///< +DOC begin doc
50  EDOC = (1 << 3), ///< -DOC end doc
51  BMAP = (1 << 4), ///< +MAP begin map
52  EMAP = (1 << 5), ///< -MAP end map
53  BSEQ = (1 << 6), ///< +SEQ begin seq
54  ESEQ = (1 << 7), ///< -SEQ end seq
55  SCLR = (1 << 8), ///< =VAL scalar
56  ANCH = (1 << 9), ///< &anchor
57  ALIA = (1 << 10), ///< *ref =ALI alias (reference)
58  TAG_ = (1 << 11), ///< !tag
59 
60  // Style flags
61  PLAI = (1 << 12), ///< plain scalar
62  SQUO = (1 << 13), ///< single-quoted scalar (')
63  DQUO = (1 << 14), ///< double-quoted scalar ("")
64  LITL = (1 << 15), ///< block literal scalar (|)
65  FOLD = (1 << 16), ///< block folded scalar (>)
66  FLOW = (1 << 17), ///< flow container: [] for seqs or {} for maps
67  BLCK = (1 << 18), ///< block container
68 
69  // Structure flags
70  KEY_ = (1 << 19), ///< as key
71  VAL_ = (1 << 20), ///< as value
72  EXPL = (1 << 21), ///< `---` (with BDOC) or
73  ///< `...` (with EDOC)
74 
75  // Directive flags
76  YAML = (1 << 22), ///< `%YAML <version>`
77  TAGD = (1 << 23), ///< tag directive name : `%TAG <name> .......`
78  TAGV = (1 << 24), ///< tag directive value: `%TAG ...... <value>`
79 
80  // Buffer flags
81  /// IMPORTANT. Marks events whose string was placed in the
82  /// arena. This happens when the filtered string is larger than the
83  /// original string in the YAML code (eg from tags that resolve to
84  /// a larger string, or from "\L" or "\P" in double quotes, which
85  /// expand from two to three bytes). Because of this size
86  /// expansion, the filtered string cannot be placed in the original
87  /// source and needs to be placed in the arena.
88  AREN = (1 << 25),
89  /// special flag to enable look-back in the event array. it
90  /// signifies that the previous event has a string, meaning that
91  /// the jump back to that event is 3 positions. without this flag it
92  /// would be impossible to jump to the previous event.
93  PSTR = (1 << 26),
94  /// special flag to mark a scalar as unfiltered (when the parser
95  /// is set not to filter).
96  UNFILT = (1 << 27),
97 
98  // Utility flags/masks
99  LAST = UNFILT, ///< the last flag defined above
100  MASK = (LAST << 1) - 1, ///< a mask of all bits in this enumeration
101  /// with string: mask of all the events that encode a string
102  /// following the event. in the event has a string. the next two
103  /// integers will provide respectively the string's offset and
104  /// length. See also @ref PSTR.
106 } EventFlags;
EventFlags
enumeration of integer event bits.
@ PSTR
special flag to enable look-back in the event array. it signifies that the previous event has a strin...
@ TAGD
tag directive name : TAG <name> .......
@ LITL
block literal scalar (|)
@ UNFILT
special flag to mark a scalar as unfiltered (when the parser is set not to filter).
@ DQUO
double-quoted scalar ("")
@ FOLD
block folded scalar (>)
@ MASK
a mask of all bits in this enumeration with string: mask of all the events that encode a string follo...
@ BSTR
+STR begin stream
@ FLOW
flow container: [] for seqs or {} for maps
@ AREN
IMPORTANT. Marks events whose string was placed in the arena. This happens when the filtered string i...
@ TAGV
tag directive value: TAG ...... <value>
@ ALIA
*ref =ALI alias (reference)
@ LAST
the last flag defined above
@ EXPL
--- (with BDOC) or ... (with EDOC)
@ SQUO
single-quoted scalar (')
int32_t DataType
data type for integer events.

Function Documentation

◆ to_chars()

size_t c4::yml::extra::ievt::to_chars ( substr  buf,
ievt::DataType  flags 
)

Convert bit mask of ievt::EventFlags to text.

Definition at line 68 of file ints_utils.cpp.

69 {
70  return c4::bm2str<ievt::EventFlags>((flags & ievt::MASK), buf.str, buf.len);
71 }

References MASK.

Referenced by c4::yml::Tree::to_arena(), c4::yml::to_chars_float(), and to_chars_sub().

◆ to_chars_sub()

csubstr c4::yml::extra::ievt::to_chars_sub ( substr  buf,
ievt::DataType  flags 
)

Convert bit mask of ievt::EventFlags to text.

Definition at line 72 of file ints_utils.cpp.

73 {
74  size_t reqsize = ievt::to_chars(buf, flags);
75  RYML_CHECK(reqsize > 0u);
76  RYML_CHECK(reqsize < buf.len);
77  return buf.first(reqsize - 1u);
78 }
size_t to_chars(substr buf, ievt::DataType flags)
Convert bit mask of ievt::EventFlags to text.
Definition: ints_utils.cpp:68

References to_chars().

Referenced by c4::yml::extra::events_ints_print().