rapidyaml  0.10.0
parse and emit YAML, and do it fast
event_handler_testsuite.cpp
Go to the documentation of this file.
1 #ifdef RYML_SINGLE_HEADER_INTS
2  #ifndef _RYML_SINGLE_HEADER_AMALGAMATED_HPP_
3  #include <ryml_ints.hpp>
4  #endif
5 #elif defined(RYML_SINGLE_HEADER)
6  #ifndef _RYML_SINGLE_HEADER_AMALGAMATED_HPP_
7  #include <ryml_all.hpp>
8  #endif
9 #else
10 #include <c4/yml/node.hpp>
12 #endif
13 
14 #ifndef _C4_YML_EXTRA_EVENT_HANDLER_TESTSUITE_HPP_
16 #endif
17 #ifndef _C4_YML_EXTRA_SCALAR_HPP_
18 #include "c4/yml/extra/scalar.hpp"
19 #endif
20 #ifndef _C4_YML_EXTRA_SCALAR_HPP_
21 #include "c4/yml/extra/string.hpp"
22 #endif
23 
24 
25 namespace c4 {
26 namespace yml {
27 namespace extra {
28 
29 void append_scalar_escaped(extra::string *es, csubstr val)
30 {
31  size_t orig = es->size();
32  es->resize(es->capacity());
33  size_t sz = escape_scalar(substr(*es).sub(orig), val);
34  if (orig + sz > es->size())
35  {
36  es->resize(orig + sz);
37  sz = escape_scalar(substr(*es).sub(orig), val);
38  }
39  es->resize(orig + sz);
40 }
41 
42 } // namespace extra
43 
44 // instantiate the template
45 template class ParseEngine<extra::EventHandlerTestSuite>;
46 
47 } // namespace yml
48 } // namespace c4
size_t escape_scalar(substr buffer, csubstr val)
Definition: scalar.cpp:20
void append_scalar_escaped(extra::string *es, csubstr val)
Definition: common.cpp:12
Node classes.
an owning string class used by the yaml std event handler (and the YamlScript handler).
Definition: string.hpp:33
void resize(id_type sz)
Definition: string.hpp:93
id_type size() const noexcept
Definition: string.hpp:85
id_type capacity() const noexcept
Definition: string.hpp:86