Files
ArduinoJson/JsonParser/JsonPair.h

37 lines
725 B
C
Raw Normal View History

2014-07-18 22:40:50 +02:00
/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
*/
#pragma once
#include "JsonValue.h"
namespace ArduinoJson
{
namespace Parser
{
2014-07-21 20:38:08 +02:00
// A JSON key-value pair, as a part of a JSON object
class JsonPair : JsonToken
2014-07-18 22:40:50 +02:00
{
public:
2014-07-21 20:38:08 +02:00
// Convert a JsonToken to a JsonPair
2014-07-19 12:44:27 +02:00
JsonPair(JsonToken token)
: JsonToken(token)
2014-07-18 22:40:50 +02:00
{
}
2014-07-21 20:38:08 +02:00
// Get the key
2014-07-18 22:40:50 +02:00
const char* key()
{
2014-07-19 12:44:27 +02:00
return getText();
2014-07-18 22:40:50 +02:00
}
2014-07-21 20:38:08 +02:00
// Get the value
2014-07-18 22:40:50 +02:00
JsonValue value()
{
return nextSibling();
2014-07-18 22:40:50 +02:00
}
};
}
2014-07-22 20:14:25 +02:00
}