rapidyaml  0.16.0
parseandemitYAML,anddoitfast
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_ = (styles_block_key_ | styles_block_val_), styles_flow_key_ = KEY_STYLE & ~styles_block_key_,
  styles_flow_val_ = VAL_STYLE & ~styles_block_val_, styles_flow_ = styles_flow_key_ | 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 : 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 31 of file emitter.def.hpp.

31  : type_bits { // NOLINT
36  styles_flow_val_ = VAL_STYLE & ~styles_block_val_,
43 };
mark val scalar as plain scalar (unquoted, even when multiline)
Definition: node_type.hpp:156
mark key scalar as double quoted "
Definition: node_type.hpp:153
mark key scalar as multiline, block literal |
Definition: node_type.hpp:147
mark val scalar as single quoted '
Definition: node_type.hpp:152
mark val scalar as double quoted "
Definition: node_type.hpp:154
mark val scalar as multiline, block folded >
Definition: node_type.hpp:150
mark key scalar as multiline, block folded >
Definition: node_type.hpp:149
mask of KEYQUO|KEY_PLAIN : all the key scalar styles for key (not container styles!) ...
Definition: node_type.hpp:176
mark key scalar as plain scalar (unquoted, even when multiline)
Definition: node_type.hpp:155
mark val scalar as multiline, block literal |
Definition: node_type.hpp:148
uint32_t type_bits
the integral type necessary to cover all the bits for NodeType_e
Definition: node_type.hpp:26
mark key scalar as single quoted '
Definition: node_type.hpp:151
mask of VALQUO|VAL_PLAIN : all the val scalar styles for val (not container styles!) ...
Definition: node_type.hpp:177

Function Documentation

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.

Referenced by c4::yml::location_format_with_context().

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 }
a null string position
Definition: common.hpp:138