#pragma once #include "IExtensionJsonHandler.h" #include "JsonReaderOptions.h" #include "ObjectJsonHandler.h" #include #include namespace CesiumJsonReader { /** * @brief \ref IJsonHandler for reading extensions, such as those listed in an * \ref CesiumUtility::ExtensibleObject "ExtensibleObject". */ class ExtensionsJsonHandler : public CesiumJsonReader::ObjectJsonHandler { public: /** * @brief Creates a new \ref ExtensionsJsonHandler with the specified reader * options. * * @param context Options to configure how the JSON is read. */ explicit ExtensionsJsonHandler(const JsonReaderOptions& context) noexcept : ObjectJsonHandler(), _context(context), _pObject(nullptr), _currentExtensionHandler() {} /** * @brief Resets the \ref IJsonHandler's parent and pointer to destination, as * well as the name of the object type that the extension is attached to. */ void reset( IJsonHandler* pParent, CesiumUtility::ExtensibleObject* pObject, const std::string& objectType); /** @copydoc IJsonHandler::readObjectKey */ virtual IJsonHandler* readObjectKey(const std::string_view& str) override; private: const JsonReaderOptions& _context; CesiumUtility::ExtensibleObject* _pObject = nullptr; std::string _objectType; std::unique_ptr _currentExtensionHandler; }; } // namespace CesiumJsonReader