Added JsonVariant::operator[](int)

This commit is contained in:
Benoit Blanchon
2014-11-04 10:20:47 +01:00
parent e25eaed75a
commit 97768ec176
3 changed files with 51 additions and 0 deletions

View File

@ -25,6 +25,11 @@ class JsonVariant {
public:
JsonVariant() : _type(Internals::JSON_UNDEFINED) {}
template <typename T>
explicit JsonVariant(T value) {
set(value);
}
void set(bool value);
void set(double value, uint8_t decimals = 2);
void set(signed char value) { set(static_cast<long>(value)); }
@ -91,6 +96,9 @@ class JsonVariant {
template <typename T>
void writeTo(T &writer) const;
size_t size() const;
JsonVariant &operator[](int index);
private:
JsonVariant(Internals::JsonVariantType type) : _type(type) {}