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

Namespaces

 ievt
 

Classes

struct  EventHandlerInts
 A parser event handler that creates a compact representation of the YAML tree in a buffer of integers (see ievt::EventFlags) containing masks (to represent events) and offset+length (to represent strings in the source buffer). More...
 
struct  EventHandlerTestSuite
 This event produces standard YAML events as used in the YAML test suite. More...
 
struct  string
 an owning string class used by the yaml std event handler (and the YamlScript handler). More...
 
struct  string_vector
 a string collection used by the event handler. More...
 

Functions

int32_t estimate_events_ints_size (csubstr src)
 Read YAML source and, without undergoing a full parse, estimate the size of the integer buffer required for EventHandlerInts. More...
 
void append_scalar_escaped (extra::string *es, csubstr val)
 
size_t events_ints_to_testsuite (csubstr parsed_yaml, csubstr arena, ievt::DataType const *evts_ints, ievt::DataType evts_ints_sz, substr evts_testsuite)
 Create a testsuite event string from integer events. More...
 
template<class Container >
void events_ints_to_testsuite (csubstr parsed_yaml, csubstr arena, ievt::DataType const *evts_ints, ievt::DataType evts_ints_sz, Container *evts_testsuite)
 Create a testsuite event string from integer events, writing into an output container. More...
 
template<class Container >
Container events_ints_to_testsuite (csubstr parsed_yaml, csubstr arena, ievt::DataType const *evts_ints, ievt::DataType evts_ints_sz)
 Create a testsuite event string from integer events, returning a new container with the result. More...
 
void events_ints_print (csubstr parsed_yaml, csubstr arena, ievt::DataType const *evts_ints, ievt::DataType evts_ints_sz)
 Print integer events to stdout. More...
 
size_t escape_scalar (substr buffer, csubstr val)
 

Function Documentation

◆ append_scalar_escaped()

void c4::yml::extra::append_scalar_escaped ( extra::string es,
csubstr  val 
)

Definition at line 29 of file event_handler_testsuite.cpp.

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 }
size_t escape_scalar(substr buffer, csubstr val)
Definition: scalar.cpp:20

References c4::yml::extra::string::capacity(), escape_scalar(), c4::yml::extra::string::resize(), and c4::yml::extra::string::size().