MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / visit_key

Function visit_key

include/jsoncons/json_encoder.hpp:482–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480 }
481
482 JSONCONS_VISITOR_RETURN_TYPE visit_key(const string_view_type& name, const ser_context&, std::error_code&) final
483 {
484 JSONCONS_ASSERT(!stack_.empty());
485 if (stack_.back().count() > 0)
486 {
487 sink_.append(comma_str_.data(),comma_str_.length());
488 column_ += comma_str_.length();
489 }
490
491 if (stack_.back().is_multi_line())
492 {
493 stack_.back().new_line_after(true);
494 new_line();
495 }
496 else if (stack_.back().count() > 0 && column_ >= options_.line_length_limit())
497 {
498 //stack_.back().new_line_after(true);
499 new_line(stack_.back().data_pos());
500 }
501
502 if (stack_.back().count() == 0)
503 {
504 stack_.back().set_position(column_);
505 }
506 sink_.push_back('\"');
507 std::size_t length = jsoncons::detail::escape_string(name.data(), name.length(),options_.escape_all_non_ascii(),options_.escape_solidus(),sink_);
508 sink_.push_back('\"');
509 sink_.append(colon_str_.data(),colon_str_.length());
510 column_ += (length+2+colon_str_.length());
511 JSONCONS_VISITOR_RETURN;
512 }
513
514 JSONCONS_VISITOR_RETURN_TYPE visit_null(semantic_tag, const ser_context&, std::error_code&) final
515 {

Callers 1

keyMethod · 0.70

Calls 15

new_lineFunction · 0.85
is_multi_lineMethod · 0.80
new_line_afterMethod · 0.80
line_length_limitMethod · 0.80
data_posMethod · 0.80
set_positionMethod · 0.80
escape_all_non_asciiMethod · 0.80
escape_solidusMethod · 0.80
escape_stringFunction · 0.70
emptyMethod · 0.45
countMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected