3#include "JsonHandler.h"
6#include <CesiumUtility/IntrusivePointer.h>
46 template <typename TAccessor, typename TProperty>
48 property(const
char* currentKey, TAccessor& accessor, TProperty& value) {
49 this->_currentKey = currentKey;
51 if constexpr (isOptional<TProperty>::value) {
53 accessor.reset(
this, &value.value());
54 }
else if constexpr (isIntrusivePointer<TProperty>::value) {
56 accessor.reset(
this, value.get());
58 accessor.reset(
this, &value);
70 virtual
void reportWarning(
71 const
std::
string& warning,
72 std::vector<
std::
string>&& context =
std::vector<
std::
string>()) override;
78 void setCurrentKey(const
char* key) noexcept;
81 template <typename T> struct isOptional {
82 static constexpr bool value =
false;
85 template <
typename T>
struct isOptional<
std::optional<T>> {
86 static constexpr bool value =
true;
89 template <
typename T>
struct isIntrusivePointer {
90 static constexpr bool value =
false;
94 struct isIntrusivePointer<
CesiumUtility::IntrusivePointer<T>> {
95 static constexpr bool value =
true;
99 const char* _currentKey =
nullptr;
Base interface for all JSON handlers. Types that need to be deserialized from JSON should implement I...
A dummy implementation of IJsonHandler that will report a warning and return its parent when any of i...
IJsonHandler for handling JSON objects.
virtual IJsonHandler * readObjectStart() override
Called when the JSON parser encounters the beginning of an object.
const char * getCurrentKey() const noexcept
Obtains the most recent key handled by this JsonHandler.
Classes for reading JSON.
Utility classes for Cesium.