rapidyaml  0.11.1
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 {
  KEY_ = (1 << 0) , VAL_ = (1 << 1) , PSTR = (1 << 2) , AREN = (1 << 3) ,
  BEG_ = (1 << 5) , END_ = (1 << 6) , SEQ_ = (1 << 7) , MAP_ = (1 << 8) ,
  DOC_ = (1 << 9) , EXPL = (1 << 10) , STRM = (1 << 11) , BSEQ = BEG_|SEQ_ ,
  ESEQ = END_|SEQ_ , BMAP = BEG_|MAP_ , EMAP = END_|MAP_ , BSTR = BEG_|STRM ,
  ESTR = END_|STRM , BDOC = BEG_|DOC_ , EDOC = END_|DOC_ , SCLR = (1 << 12) ,
  ALIA = (1 << 13) , ANCH = (1 << 14) , TAG_ = (1 << 15) , PLAI = (1 << 16) ,
  SQUO = (1 << 17) , DQUO = (1 << 18) , LITL = (1 << 19) , FOLD = (1 << 20) ,
  FLOW = (1 << 21) , BLCK = (1 << 22) , YAML = (1 << 23) , TAGD = (1 << 24) ,
  TAGV = (1 << 25) , UNFILT = (1 << 26) , 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
KEY_ 

as key

VAL_ 

as value 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. see also WSTR

PSTR 
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.

BEG_ 

scope: begin

END_ 

scope: end

SEQ_ 

scope: seq

MAP_ 

scope: map

DOC_ 

scope: doc

EXPL 

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

STRM 

scope: stream

BSEQ 

begin seq (+SEQ in test suite events)

ESEQ 

end seq (-SEQ in test suite events)

BMAP 

begin map (+MAP in test suite events)

EMAP 

end map (-MAP in test suite events)

BSTR 

begin stream (+STR in test suite events)

ESTR 

end stream (-STR in test suite events)

BDOC 

begin doc (+DOC in test suite events)

EDOC 

end doc (-DOC in test suite events)

SCLR 

scalar (=VAL in test suite events)

ALIA 

*ref (reference)

ANCH 

&anchor

TAG_ 

!tag

PLAI 

scalar: plain

SQUO 

scalar: single-quoted (')

DQUO 

scalar: double-quoted ("")

LITL 

scalar: block literal (|)

FOLD 

scalar: block folded (>)

FLOW 

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

BLCK 

container: block

YAML 

yaml directive: \YAML <version>

TAGD 

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

TAGV 

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

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

WSTR 

WithSTRing: mask of all the events that encode a string following the event. For such events, the next two integers will provide respectively the string's offset and length. See also PSTR.

Definition at line 44 of file event_handler_ints.hpp.

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

References MASK.

◆ 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 73 of file ints_utils.cpp.

74 {
75  size_t reqsize = ievt::to_chars(buf, flags);
76  _RYML_CHECK_BASIC(reqsize > 0u);
77  _RYML_CHECK_BASIC(reqsize < buf.len);
78  return buf.first(reqsize - 1u);
79 }
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().