mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 03:52:16 +02:00
Epic refactoring in progress...
This commit is contained in:
35
src/Internals/JsonValueImpl.cpp
Normal file
35
src/Internals/JsonValueImpl.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright Benoit Blanchon 2014
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include "ArduinoJson/Internals/JsonValueImpl.hpp"
|
||||
|
||||
void JsonValueImpl::writeTo(JsonWriter &writer) const {
|
||||
switch (_type) {
|
||||
case JSON_ARRAY:
|
||||
_content.asArray->writeTo(writer);
|
||||
break;
|
||||
|
||||
case JSON_OBJECT:
|
||||
_content.asObject->writeTo(writer);
|
||||
break;
|
||||
|
||||
case JSON_STRING:
|
||||
writer.writeString(content.asString);
|
||||
break;
|
||||
|
||||
case JSON_LONG:
|
||||
writer.writeInteger(content.asInteger);
|
||||
break;
|
||||
|
||||
case JSON_BOOLEAN:
|
||||
writer.writeBoolean(content.asBoolean);
|
||||
break;
|
||||
|
||||
default: // >= JSON_DOUBLE_0_DECIMALS
|
||||
writer.writeDouble(content.asDouble, type - JSON_DOUBLE_0_DECIMALS);
|
||||
break;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user