MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / _serialize

Method _serialize

externals/picojson/picojson.h:581–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581template <typename Iter> void value::_serialize(Iter oi, int indent) const {
582 switch (type_) {
583 case string_type:
584 serialize_str(*u_.string_, oi);
585 break;
586 case array_type: {
587 *oi++ = '[';
588 if (indent != -1) {
589 ++indent;
590 }
591 for (array::const_iterator i = u_.array_->begin(); i != u_.array_->end(); ++i) {
592 if (i != u_.array_->begin()) {
593 *oi++ = ',';
594 }
595 if (indent != -1) {
596 _indent(oi, indent);
597 }
598 i->_serialize(oi, indent);
599 }
600 if (indent != -1) {
601 --indent;
602 if (!u_.array_->empty()) {
603 _indent(oi, indent);
604 }
605 }
606 *oi++ = ']';
607 break;
608 }
609 case object_type: {
610 *oi++ = '{';
611 if (indent != -1) {
612 ++indent;
613 }
614 for (object::const_iterator i = u_.object_->begin(); i != u_.object_->end(); ++i) {
615 if (i != u_.object_->begin()) {
616 *oi++ = ',';
617 }
618 if (indent != -1) {
619 _indent(oi, indent);
620 }
621 serialize_str(i->first, oi);
622 *oi++ = ':';
623 if (indent != -1) {
624 *oi++ = ' ';
625 }
626 i->second._serialize(oi, indent);
627 }
628 if (indent != -1) {
629 --indent;
630 if (!u_.object_->empty()) {
631 _indent(oi, indent);
632 }
633 }
634 *oi++ = '}';
635 break;
636 }
637 default:
638 copy(to_str(), oi);

Callers

nothing calls this directly

Calls 5

serialize_strFunction · 0.85
copyFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected