rapidyaml 0.15.2
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
c4::yml::detail Namespace Reference

Classes

struct  RoNodeMethods
 a CRTP base providing read-only methods for ConstNodeRef and NodeRef More...

Enumerations

enum  : type_bits {
  styles_block_key_ = KEY_LITERAL|KEY_FOLDED , styles_block_val_ = VAL_LITERAL|VAL_FOLDED , styles_block_ = ((type_bits)styles_block_key_) | ((type_bits)styles_block_val_) , styles_flow_key_ = KEY_STYLE & (~((type_bits)styles_block_key_)) ,
  styles_flow_val_ = VAL_STYLE & (~((type_bits)styles_block_val_)) , styles_flow_ = ((type_bits)styles_flow_key_) | ((type_bits)styles_flow_val_) , styles_squo_ = KEY_SQUO|VAL_SQUO , styles_dquo_ = KEY_DQUO|VAL_DQUO ,
  styles_plain_ = KEY_PLAIN|VAL_PLAIN , styles_literal_ = KEY_LITERAL|VAL_LITERAL , styles_folded_ = KEY_FOLDED|VAL_FOLDED
}

Functions

csubstr _get_text_region (csubstr text, size_t pos, size_t num_lines_before, size_t num_lines_after)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : type_bits
Enumerator
styles_block_key_ 
styles_block_val_ 
styles_block_ 
styles_flow_key_ 
styles_flow_val_ 
styles_flow_ 
styles_squo_ 
styles_dquo_ 
styles_plain_ 
styles_literal_ 
styles_folded_ 

Definition at line 34 of file emitter.def.hpp.

34 : type_bits { // NOLINT
46};
uint32_t type_bits
the integral type necessary to cover all the bits for NodeType_e
Definition node_type.hpp:30
@ KEY_DQUO
mark key scalar as double quoted "
@ VAL_FOLDED
mark val scalar as multiline, block folded >
@ VAL_STYLE
mask of VALQUO|VAL_PLAIN : all the val scalar styles for val (not container styles!...
@ VAL_SQUO
mark val scalar as single quoted '
@ KEY_STYLE
mask of KEYQUO|KEY_PLAIN : all the key scalar styles for key (not container styles!...
@ VAL_PLAIN
mark val scalar as plain scalar (unquoted, even when multiline)
@ VAL_DQUO
mark val scalar as double quoted "
@ KEY_SQUO
mark key scalar as single quoted '
@ VAL_LITERAL
mark val scalar as multiline, block literal |
@ KEY_LITERAL
mark key scalar as multiline, block literal |
@ KEY_PLAIN
mark key scalar as plain scalar (unquoted, even when multiline)
@ KEY_FOLDED
mark key scalar as multiline, block folded >

Function Documentation

◆ _get_text_region()

csubstr c4::yml::detail::_get_text_region ( csubstr text,
size_t pos,
size_t num_lines_before,
size_t num_lines_after )

Definition at line 283 of file common.cpp.

284{
285 if(pos > text.len)
286 return text.last(0);
287 size_t before = text.first(pos).last_of('\n');
288 size_t before_count = 0;
289 while((before != npos) && (++before_count <= num_lines_before))
290 {
291 if(before == 0)
292 break;
293 before = text.first(--before).last_of('\n');
294 }
295 if(before < text.len || before == npos)
296 ++before;
297 size_t after = text.first_of('\n', pos);
298 size_t after_count = 0;
299 while((after != npos) && (++after_count <= num_lines_after))
300 {
301 ++after;
302 if(after >= text.len)
303 break;
304 after = text.first_of('\n', after);
305 }
306 return before <= after ? text.range(before, after) : text.first(0);
307}
@ npos
a null string position
Definition common.hpp:319
basic_substring range(size_t first, size_t last=npos) const noexcept
return [first,last[.
Definition substr.hpp:520
size_t last_of(const C c, size_t start=npos) const
Definition substr.hpp:947
size_t len
the length of the substring
Definition substr.hpp:218
basic_substring last(size_t num) const noexcept
return the last num elements: [len-num,len[
Definition substr.hpp:537
size_t first_of(const C c, size_t start=0) const
Definition substr.hpp:935
basic_substring first(size_t num) const noexcept
return the first num elements: [0,num[
Definition substr.hpp:530