Return a JsonValue& instead of a KeyValuePair* (+40 bytes)

This commit is contained in:
Benoit Blanchon
2014-07-31 19:42:09 +02:00
parent 85ffb83aa6
commit 2c29327ebd
4 changed files with 19 additions and 15 deletions

View File

@ -19,19 +19,13 @@ namespace ArduinoJson
template<typename T>
void add(const char* key, T value)
{
KeyValuePair* pair = getMatchingPair(key);
if (!pair) return;
pair->value.set(value);
getValue(key).set(value);
}
template<int DIGITS>
void add(const char* key, double value)
{
KeyValuePair* pair = getMatchingPair(key);
if (!pair) return;
pair->value.set<DIGITS>(value);
getValue(key).set<DIGITS>(value);
}
using JsonPrintable::printTo;
@ -51,7 +45,7 @@ namespace ArduinoJson
{
}
KeyValuePair* getMatchingPair(const char* key);
Internals::JsonValue& getValue(const char* key);
private:
KeyValuePair* items;