MCPcopy Create free account
hub / github.com/Illation/ETEngine / WriteValue

Method WriteValue

Engine/source/EtCore/FileSystem/Json/JsonWriter.cpp:128–159  ·  view source on GitHub ↗

--------------------------------- Writer::WriteValue Write a value, whatever it may be

Source from the content-addressed store, hash-verified

126// Write a value, whatever it may be
127//
128bool Writer::WriteValue(Value const* const jVal)
129{
130 if (jVal == nullptr)
131 {
132 LOG("JSON::Writer::WriteObject > Failed to write value to string, value was null", LogLevel::Warning);
133 return false;
134 }
135
136 // do something depending on the type
137 switch (jVal->GetType())
138 {
139 case ValueType::JSON_Null:
140 m_JsonString += s_Null;
141 break;
142 case ValueType::JSON_Bool:
143 m_JsonString += static_cast<Bool const*>(jVal)->value ? s_True : s_False;
144 break;
145
146 case ValueType::JSON_Number:
147 return WriteNumber(static_cast<Number const*>(jVal));
148 case ValueType::JSON_String:
149 WriteString(static_cast<String const*>(jVal)->value);
150 break;
151
152 case ValueType::JSON_Array:
153 return WriteArray(static_cast<Array const*>(jVal));
154 case ValueType::JSON_Object:
155 return WriteObject(static_cast<Object const*>(jVal));
156 }
157
158 return true;
159}
160
161//---------------------------------
162// Writer::WriteNumber

Callers

nothing calls this directly

Calls 1

GetTypeMethod · 0.45

Tested by

no test coverage detected