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

Function visit_double

include/jsoncons_ext/csv/csv_encoder.hpp:1017–1092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015 }
1016
1017 JSONCONS_VISITOR_RETURN_TYPE visit_double(double val,
1018 semantic_tag,
1019 const ser_context& context,
1020 std::error_code& ec) override
1021 {
1022 JSONCONS_ASSERT(!stack_.empty());
1023 switch (stack_.back().item_kind_)
1024 {
1025 case stack_item_kind::flat_object:
1026 case stack_item_kind::object:
1027 {
1028 if (stack_[0].count_ == 0)
1029 {
1030 if (!has_column_mapping_)
1031 {
1032 string_type str = stack_.back().column_path_;
1033 column_paths_.emplace_back(str);
1034 column_path_value_map_.emplace(std::move(str), string_type{alloc_});
1035 }
1036 }
1037 auto it = column_path_value_map_.find(stack_.back().column_path_);
1038 if (it != column_path_value_map_.end())
1039 {
1040 write_double_value(val, context, it->second, ec);
1041 }
1042 break;
1043 }
1044 case stack_item_kind::flat_row:
1045 case stack_item_kind::row:
1046 {
1047 append_array_path_component();
1048 auto it = column_path_value_map_.find(stack_.back().column_path_);
1049 if (it != column_path_value_map_.end())
1050 {
1051 write_double_value(val, context, it->second, ec);
1052 }
1053 break;
1054 }
1055 case stack_item_kind::stream_flat_row:
1056 {
1057 if (stack_.back().count_ > 0)
1058 {
1059 sink_.push_back(field_delimiter_);
1060 }
1061 value_buffer_.clear();
1062 write_double_value(val, context, value_buffer_, ec);
1063 if (JSONCONS_UNLIKELY(ec))
1064 {
1065 JSONCONS_VISITOR_RETURN;
1066 }
1067 sink_.append(value_buffer_.data(), value_buffer_.size());
1068 break;
1069 }
1070 case stack_item_kind::multivalued_field:
1071 case stack_item_kind::column_multivalued_field:
1072 case stack_item_kind::stream_multivalued_field:
1073 {
1074 if (!value_buffer_.empty())

Callers

nothing calls this directly

Calls 12

write_double_valueFunction · 0.85
emplaceMethod · 0.80
emptyMethod · 0.45
backMethod · 0.45
findMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
appendMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected