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; 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;
}; };