MCPcopy Create free account
hub / github.com/Kitware/VTK / PrintJSONValue

Function PrintJSONValue

ThirdParty/fides/vtkfides/fides/Array.cxx:1476–1533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1474}
1475
1476static void PrintJSONValue(const rapidjson::Value& value, int indent = 0)
1477{
1478 // Add indentation for nested structures
1479 std::string indentStr(indent, ' ');
1480
1481 if (value.IsObject())
1482 {
1483 std::cout << indentStr << "{\n";
1484 for (rapidjson::Value::ConstMemberIterator itr = value.MemberBegin(); itr != value.MemberEnd();
1485 ++itr)
1486 {
1487 std::cout << indentStr << " \"" << itr->name.GetString() << "\": ";
1488 PrintJSONValue(itr->value, indent + 4);
1489 }
1490 std::cout << indentStr << "}\n";
1491 }
1492 else if (value.IsArray())
1493 {
1494 std::cout << indentStr << "[\n";
1495 for (rapidjson::SizeType i = 0; i < value.Size(); i++)
1496 {
1497 PrintJSONValue(value[i], indent + 4);
1498 }
1499 std::cout << indentStr << "]\n";
1500 }
1501 else if (value.IsString())
1502 {
1503 std::cout << "\"" << value.GetString() << "\"\n";
1504 }
1505 else if (value.IsBool())
1506 {
1507 std::cout << (value.GetBool() ? "true" : "false") << "\n";
1508 }
1509 else if (value.IsInt())
1510 {
1511 std::cout << value.GetInt() << "\n";
1512 }
1513 else if (value.IsUint())
1514 {
1515 std::cout << value.GetUint() << "\n";
1516 }
1517 else if (value.IsInt64())
1518 {
1519 std::cout << value.GetInt64() << "\n";
1520 }
1521 else if (value.IsUint64())
1522 {
1523 std::cout << value.GetUint64() << "\n";
1524 }
1525 else if (value.IsDouble())
1526 {
1527 std::cout << value.GetDouble() << "\n";
1528 }
1529 else if (value.IsNull())
1530 {
1531 std::cout << "null\n";
1532 }
1533}

Callers

nothing calls this directly

Calls 9

IsArrayMethod · 0.80
IsBoolMethod · 0.80
IsIntMethod · 0.80
GetStringMethod · 0.45
SizeMethod · 0.45
IsStringMethod · 0.45
GetIntMethod · 0.45
IsDoubleMethod · 0.45
GetDoubleMethod · 0.45

Tested by

no test coverage detected