3 #include "IExtensionJsonHandler.h"
57 return this->_captureUnknownProperties;
67 this->_captureUnknownProperties = value;
78 template <
typename TExtended,
typename TExtensionHandler>
81 this->_extensions.emplace(extensionName, ObjectTypeToHandler()).first;
82 it->second.insert_or_assign(
85 return std::make_unique<TExtensionHandler>(context);
98 template <
typename TExtended,
typename TExtensionHandler>
102 .emplace(TExtensionHandler::ExtensionName, ObjectTypeToHandler())
104 it->second.insert_or_assign(
107 return std::make_unique<TExtensionHandler>(context);
141 std::unique_ptr<IExtensionJsonHandler> createExtensionHandler(
142 const std::string_view& extensionName,
143 const std::string& extendedObjectType)
const;
146 using ExtensionHandlerFactory =
147 std::function<std::unique_ptr<IExtensionJsonHandler>(
149 using ObjectTypeToHandler = std::map<std::string, ExtensionHandlerFactory>;
150 using ExtensionNameMap = std::map<std::string, ObjectTypeToHandler>;
152 ExtensionNameMap _extensions;
153 std::unordered_map<std::string, ExtensionState> _extensionStates;
154 bool _captureUnknownProperties =
true;
Holds options for reading statically-typed data structures from JSON.
void setCaptureUnknownProperties(bool value)
Sets a value indicating whether the values of unknown properties are captured in the ExtensibleObject...
ExtensionState getExtensionState(const std::string &extensionName) const
Returns whether an extension is enabled or disabled.
void registerExtension(const std::string &extensionName)
Registers an extension for an object.
void setExtensionState(const std::string &extensionName, ExtensionState newState)
Enables or disables an extension.
void registerExtension()
Registers an extension for an object.
bool getCaptureUnknownProperties() const
Gets a value indicating whether the values of unknown properties are captured in the ExtensibleObject...
Classes for reading JSON.
ExtensionState
The state of an extension.
@ Enabled
The extension is enabled.
@ Disabled
The extension is disabled.
@ JsonOnly
The extension is enabled but will always be deserialized as a CesiumUtility::JsonValue.