forked from bblanchon/ArduinoJson
Reduce the size of JsonValue by removing the virtual
This commit is contained in:
@ -26,7 +26,7 @@ namespace ArduinoJson
|
|||||||
content.asBool = value;
|
content.asBool = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonValue(double value, int digits = 2)
|
JsonValue(double value, uint8_t digits = 2)
|
||||||
: implementation(&JsonValue::printDoubleTo)
|
: implementation(&JsonValue::printDoubleTo)
|
||||||
{
|
{
|
||||||
content.asDouble.value = value;
|
content.asDouble.value = value;
|
||||||
@ -57,14 +57,13 @@ namespace ArduinoJson
|
|||||||
content.asString = value;
|
content.asString = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t printTo(Print& p) const
|
size_t printTo(Print& p) const
|
||||||
{
|
{
|
||||||
// handmade polymorphism
|
// handmade polymorphism
|
||||||
return (this->*implementation)(p);
|
return (this->*implementation)(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
union Content
|
union Content
|
||||||
{
|
{
|
||||||
bool asBool;
|
bool asBool;
|
||||||
@ -74,7 +73,7 @@ namespace ArduinoJson
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
double value;
|
double value;
|
||||||
int digits;
|
uint8_t digits;
|
||||||
} asDouble;
|
} asDouble;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user