MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / PrettyPrint

Method PrettyPrint

Source/Engine/Debug/DebugCommands.cpp:30–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 void* Field = nullptr;
29
30 static void PrettyPrint(StringBuilder& sb, const Variant& value)
31 {
32 if (value.Type.Type == VariantType::Array)
33 {
34 // Prettify array printing
35 auto& resultArray = value.AsArray();
36 sb.Append('[');
37 for (int32 i = 0; i < resultArray.Count(); i++)
38 {
39 if (i > 0)
40 sb.Append(',').Append(' ');
41 PrettyPrint(sb, resultArray[i]);
42 if (i > 30) // Limit on too large values
43 {
44 sb.Append(TEXT("..."));
45 break;
46 }
47 }
48 sb.Append(']');
49 }
50 else if (value.Type.Type == VariantType::Structure)
51 {
52 // Prettify structure printing
53 ScriptingTypeHandle resultType = Scripting::FindScriptingType(value.Type.GetTypeName());
54 if (resultType)
55 {
56 Array<void*> fields;
57 resultType.Module->GetFields(resultType, fields);
58 sb.Append('{');
59 Variant fieldValue;
60 ScriptingTypeFieldSignature fieldSig;
61 bool first = true;
62 for (void* field : fields)
63 {
64 resultType.Module->GetFieldSignature(field, fieldSig);
65 if (fieldSig.IsStatic)
66 continue;
67 if (!resultType.Module->GetFieldValue(field, value, fieldValue))
68 {
69 if (!first)
70 sb.Append(',');
71 first = false;
72 sb.Append(' ').Append(String(fieldSig.Name)).Append(':').Append(' ');
73 PrettyPrint(sb, fieldValue);
74 }
75 }
76 sb.Append(' ').Append('}');
77 }
78 }
79 else
80 {
81 sb.Append(value.ToString());
82 }
83 }
84
85 void Invoke(StringView args) const
86 {

Callers

nothing calls this directly

Calls 9

FindScriptingTypeFunction · 0.85
StringClass · 0.50
AppendMethod · 0.45
CountMethod · 0.45
GetTypeNameMethod · 0.45
GetFieldsMethod · 0.45
GetFieldSignatureMethod · 0.45
GetFieldValueMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected