2014-10-23 23:39:22 +02:00
|
|
|
// Copyright Benoit Blanchon 2014
|
|
|
|
// MIT License
|
|
|
|
//
|
|
|
|
// Arduino JSON library
|
|
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
|
2014-10-16 00:11:23 +02:00
|
|
|
#pragma once
|
|
|
|
|
2014-10-24 16:29:51 +02:00
|
|
|
#include "ForwardDeclarations.hpp"
|
2014-10-19 15:46:36 +02:00
|
|
|
#include "Internals/JsonNodeWrapper.hpp"
|
2014-10-16 00:11:23 +02:00
|
|
|
|
2014-10-23 19:54:00 +02:00
|
|
|
namespace ArduinoJson {
|
|
|
|
|
|
|
|
class JsonValue : public Internals::JsonNodeWrapper {
|
2014-10-23 23:13:13 +02:00
|
|
|
public:
|
2014-10-23 19:54:00 +02:00
|
|
|
JsonValue() {}
|
|
|
|
|
2014-10-24 00:08:25 +02:00
|
|
|
void operator=(bool value);
|
|
|
|
void operator=(const char *value);
|
|
|
|
void operator=(double value) { set(value, 2); }
|
|
|
|
void operator=(int value);
|
2014-10-23 19:54:00 +02:00
|
|
|
void operator=(const JsonValue &value) { duplicate(value); }
|
|
|
|
void operator=(const Internals::JsonNodeWrapper &object) {
|
|
|
|
duplicate(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
operator bool() const;
|
|
|
|
operator const char *() const;
|
|
|
|
operator double() const;
|
|
|
|
operator long() const;
|
|
|
|
operator int() const { return operator long(); }
|
|
|
|
operator JsonArray() const;
|
|
|
|
operator JsonObject() const;
|
|
|
|
|
|
|
|
void set(double value, int decimals);
|
|
|
|
|
2014-10-23 23:13:13 +02:00
|
|
|
template <typename T>
|
|
|
|
T as() {
|
|
|
|
return static_cast<T>(*this);
|
|
|
|
}
|
2014-10-24 16:12:05 +02:00
|
|
|
|
2014-10-25 15:55:58 +02:00
|
|
|
protected:
|
|
|
|
JsonValue(Internals::JsonNode *node) : Internals::JsonNodeWrapper(node) {}
|
2014-10-23 19:54:00 +02:00
|
|
|
};
|
2014-10-23 23:45:36 +02:00
|
|
|
}
|