MCPcopy Create free account
hub / github.com/HumbleNet/HumbleNet / write

Method write

3rdparty/Amalgamate/juce_core_amalgam.cpp:3646–3679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3644{
3645public:
3646 static void write (OutputStream& out, const var& v,
3647 const int indentLevel, const bool allOnOneLine)
3648 {
3649 if (v.isString())
3650 {
3651 writeString (out, v.toString().getCharPointer());
3652 }
3653 else if (v.isVoid())
3654 {
3655 out << "null";
3656 }
3657 else if (v.isBool())
3658 {
3659 out << (static_cast<bool> (v) ? "true" : "false");
3660 }
3661 else if (v.isArray())
3662 {
3663 writeArray (out, *v.getArray(), indentLevel, allOnOneLine);
3664 }
3665 else if (v.isObject())
3666 {
3667 DynamicObject* const object = v.getDynamicObject();
3668
3669 jassert (object != nullptr); // Only DynamicObjects can be converted to JSON!
3670
3671 writeObject (out, *object, indentLevel, allOnOneLine);
3672 }
3673 else
3674 {
3675 jassert (! v.isMethod()); // Can't convert an object with methods to JSON!
3676
3677 out << v.toString();
3678 }
3679 }
3680
3681private:
3682 enum { indentSize = 2 };

Callers

nothing calls this directly

Calls 9

getArrayMethod · 0.80
getDynamicObjectMethod · 0.80
isStringMethod · 0.45
toStringMethod · 0.45
isVoidMethod · 0.45
isBoolMethod · 0.45
isArrayMethod · 0.45
isObjectMethod · 0.45
isMethodMethod · 0.45

Tested by

no test coverage detected