Added support of String class (issue #55, #56, #70, #77)

This commit is contained in:
Benoit Blanchon
2015-05-25 15:38:58 +02:00
parent 756c279cdc
commit 1b5be892b9
22 changed files with 351 additions and 119 deletions

View File

@ -11,25 +11,32 @@
namespace ArduinoJson {
class JsonArraySubscript : public JsonVariantBase<JsonArraySubscript> {
public:
JSON_FORCE_INLINE JsonArraySubscript(JsonArray& array, size_t index)
FORCE_INLINE JsonArraySubscript(JsonArray& array, size_t index)
: _array(array), _index(index) {}
JSON_FORCE_INLINE JsonArraySubscript& operator=(const JsonVariant& value) {
FORCE_INLINE JsonArraySubscript& operator=(const JsonVariant& value) {
_array.set(_index, value);
return *this;
}
JSON_FORCE_INLINE bool success() const { return _index < _array.size(); }
FORCE_INLINE JsonArraySubscript& operator=(const JsonArraySubscript& other) {
// to prevent Visual Studio warning C4512: assignment operator could not be
// generated
_array.set(_index, other._array.get(other._index));
return *this;
}
JSON_FORCE_INLINE operator JsonVariant() const { return _array.get(_index); }
FORCE_INLINE bool success() const { return _index < _array.size(); }
FORCE_INLINE operator JsonVariant() const { return _array.get(_index); }
template <typename T>
JSON_FORCE_INLINE T as() const {
FORCE_INLINE T as() const {
return _array.get<T>(_index);
}
template <typename T>
JSON_FORCE_INLINE T is() const {
FORCE_INLINE T is() const {
return _array.is<T>(_index);
}