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

Function write_string_value

include/jsoncons_ext/csv/csv_encoder.hpp:1310–1328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1308 }
1309
1310 void write_string_value(const string_view_type& value, string_type& str)
1311 {
1312 const char* s = value.data();
1313 const std::size_t length = value.length();
1314
1315 bool quote = false;
1316 if (quote_style_ == quote_style_kind::all || quote_style_ == quote_style_kind::nonnumeric ||
1317 (quote_style_ == quote_style_kind::minimal &&
1318 (std::char_traits<CharT>::find(s, length, field_delimiter_) != nullptr || std::char_traits<CharT>::find(s, length, quote_char_) != nullptr)))
1319 {
1320 quote = true;
1321 str.push_back(quote_char_);
1322 }
1323 escape_string(s, length, quote_char_, quote_escape_char_, str);
1324 if (quote)
1325 {
1326 str.push_back(quote_char_);
1327 }
1328 }
1329
1330 void write_double_value(double val, const ser_context& context, string_type& str, std::error_code& ec)
1331 {

Callers 2

visit_stringFunction · 0.85
visit_stringMethod · 0.85

Calls 5

findFunction · 0.85
escape_stringFunction · 0.50
dataMethod · 0.45
lengthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected