3 #include "CesiumUtility/Assert.h"
4 #include "IntegerJsonHandler.h"
6 #include "ObjectJsonHandler.h"
9 #include <unordered_map>
12 template <
typename T,
typename THandler>
15 template <
typename... Ts>
21 std::unordered_map<std::string, T>* pDictionary) {
22 ObjectJsonHandler::reset(pParent);
23 this->_pDictionary1 = pDictionary;
26 void reset(
IJsonHandler* pParent, std::map<std::string, T>* pDictionary) {
27 ObjectJsonHandler::reset(pParent);
28 this->_pDictionary2 = pDictionary;
31 virtual IJsonHandler* readObjectKey(
const std::string_view& str)
override {
32 CESIUM_ASSERT(this->_pDictionary1 || this->_pDictionary2);
34 if (this->_pDictionary1) {
35 auto it = this->_pDictionary1->emplace(str, T()).first;
37 return this->property(it->first.c_str(), this->_item, it->second);
40 auto it = this->_pDictionary2->emplace(str, T()).first;
42 return this->property(it->first.c_str(), this->_item, it->second);
46 std::unordered_map<std::string, T>* _pDictionary1 =
nullptr;
47 std::map<std::string, T>* _pDictionary2 =
nullptr;
Classes for reading JSON.