Files
ArduinoJson/include/ArduinoJson/JsonValue.hpp

46 lines
1.0 KiB
C++
Raw Normal View History

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
#include "ForwardDeclarations.hpp"
#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 {
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);
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
}