Reduce the size of JsonValue by removing the virtual

This commit is contained in:
Benoit Blanchon
2014-07-06 21:28:39 +02:00
parent 2e97dbdedc
commit 1cec019457

View File

@ -26,7 +26,7 @@ namespace ArduinoJson
content.asBool = value;
}
JsonValue(double value, int digits = 2)
JsonValue(double value, uint8_t digits = 2)
: implementation(&JsonValue::printDoubleTo)
{
content.asDouble.value = value;
@ -57,14 +57,13 @@ namespace ArduinoJson
content.asString = value;
}
virtual size_t printTo(Print& p) const
size_t printTo(Print& p) const
{
// handmade polymorphism
return (this->*implementation)(p);
}
private:
union Content
{
bool asBool;
@ -74,7 +73,7 @@ namespace ArduinoJson
struct {
double value;
int digits;
uint8_t digits;
} asDouble;
};