mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-11-01 08:48:30 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| // Copyright Benoit Blanchon 2014
 | |
| // MIT License
 | |
| //
 | |
| // Arduino JSON library
 | |
| // https://github.com/bblanchon/ArduinoJson
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "ForwardDeclarations.hpp"
 | |
| #include "Internals/JsonNodeWrapper.hpp"
 | |
| 
 | |
| namespace ArduinoJson {
 | |
| 
 | |
| class JsonValue : public Internals::JsonNodeWrapper {
 | |
|   friend class JsonArray;
 | |
|   friend class JsonArrayIterator;
 | |
|   friend class JsonArrayConstIterator;
 | |
|   friend class JsonBuffer;
 | |
|   friend class JsonObject;
 | |
|   friend class JsonObjectKeyValue;
 | |
| 
 | |
|  public:
 | |
|   JsonValue() {}
 | |
| 
 | |
|   void operator=(bool value);
 | |
|   void operator=(const char *value);
 | |
|   void operator=(double value) { set(value, 2); }
 | |
|   void operator=(int value);
 | |
|   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);
 | |
|   }
 | |
| 
 | |
|  private:
 | |
|   explicit JsonValue(Internals::JsonNode *node) : JsonNodeWrapper(node) {}
 | |
| };
 | |
| }
 |