3#include "CesiumUtility/Assert.h"
4#include "JsonHandler.h"
23 JsonHandler::reset(pParent);
24 this->_pInteger = pInteger;
34 CESIUM_ASSERT(this->_pInteger);
35 *this->_pInteger =
static_cast<T
>(i);
36 return this->parent();
40 CESIUM_ASSERT(this->_pInteger);
41 *this->_pInteger =
static_cast<T
>(i);
42 return this->parent();
46 CESIUM_ASSERT(this->_pInteger);
47 *this->_pInteger =
static_cast<T
>(i);
48 return this->parent();
52 CESIUM_ASSERT(this->_pInteger);
53 *this->_pInteger =
static_cast<T
>(i);
54 return this->parent();
58 CESIUM_ASSERT(this->_pInteger);
60 double fractPart = std::modf(d, &intPart);
62 return JsonHandler::readDouble(d);
64 *this->_pInteger =
static_cast<T
>(intPart);
65 return this->parent();
70 const std::string& warning,
71 std::vector<std::string>&& context)
override {
72 context.push_back(
"(expecting an integer)");
73 this->parent()->reportWarning(warning, std::move(context));
77 T* _pInteger =
nullptr;
Base interface for all JSON handlers. Types that need to be deserialized from JSON should implement I...
IJsonHandler for reading integer values.
virtual IJsonHandler * readUint32(uint32_t i) override
Called when the JSON parser encounters a uint32 value.
virtual IJsonHandler * readDouble(double d) override
Called when the JSON parser encounters a double value.
virtual IJsonHandler * readUint64(uint64_t i) override
Called when the JSON parser encounters a uint64 value.
void reset(IJsonHandler *pParent, T *pInteger)
Resets the parent IJsonHandler of this instance and sets the pointer to its destination integer value...
virtual IJsonHandler * readInt32(int32_t i) override
Called when the JSON parser encounters an int32 value.
virtual IJsonHandler * readInt64(int64_t i) override
Called when the JSON parser encounters an int64 value.
virtual void reportWarning(const std::string &warning, std::vector< std::string > &&context) override
Report a warning while reading JSON.
T * getObject()
Obtains the integer pointer set on this handler by reset.
A dummy implementation of IJsonHandler that will report a warning and return its parent when any of i...
Classes for reading JSON.