MCPcopy Create free account
hub / github.com/SOUI2/soui / writeValue

Method writeValue

third-part/jsoncpp/src/lib_json/json_writer.cpp:354–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354void FastWriter::writeValue(const Value& value) {
355 switch (value.type()) {
356 case nullValue:
357 if (!dropNullPlaceholders_)
358 document_ += "null";
359 break;
360 case intValue:
361 document_ += valueToString(value.asLargestInt());
362 break;
363 case uintValue:
364 document_ += valueToString(value.asLargestUInt());
365 break;
366 case realValue:
367 document_ += valueToString(value.asDouble());
368 break;
369 case stringValue:
370 {
371 // Is NULL possible for value.string_? No.
372 char const* str;
373 char const* end;
374 bool ok = value.getString(&str, &end);
375 if (ok) document_ += valueToQuotedStringN(str, static_cast<unsigned>(end-str));
376 break;
377 }
378 case booleanValue:
379 document_ += valueToString(value.asBool());
380 break;
381 case arrayValue: {
382 document_ += '[';
383 ArrayIndex size = value.size();
384 for (ArrayIndex index = 0; index < size; ++index) {
385 if (index > 0)
386 document_ += ',';
387 writeValue(value[index]);
388 }
389 document_ += ']';
390 } break;
391 case objectValue: {
392 Value::Members members(value.getMemberNames());
393 document_ += '{';
394 for (Value::Members::iterator it = members.begin(); it != members.end();
395 ++it) {
396 const JSONCPP_STRING& name = *it;
397 if (it != members.begin())
398 document_ += ',';
399 document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
400 document_ += yamlCompatibilityEnabled_ ? ": " : ":";
401 writeValue(value[name]);
402 }
403 document_ += '}';
404 } break;
405 }
406}
407
408// Class StyledWriter
409// //////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 15

valueToStringFunction · 0.85
valueToQuotedStringNFunction · 0.85
valueToQuotedStringFunction · 0.85
asLargestIntMethod · 0.80
asLargestUIntMethod · 0.80
asDoubleMethod · 0.80
asBoolMethod · 0.80
getMemberNamesMethod · 0.80
typeMethod · 0.45
getStringMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected