forked from bblanchon/ArduinoJson
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user