cesium-native 0.43.0
|
The base class for objects that have extensions and extras. More...
#include <CesiumUtility/ExtensibleObject.h>
Public Member Functions | |
template<typename T > | |
bool | hasExtension () const noexcept |
Checks if an extension exists given its static type. | |
template<typename T > | |
const T * | getExtension () const noexcept |
Gets an extension given its static type. | |
template<typename T > | |
T * | getExtension () noexcept |
Gets an extension given its static type. | |
const JsonValue * | getGenericExtension (const std::string &extensionName) const noexcept |
Gets a generic extension with the given name as a CesiumUtility::JsonValue . | |
JsonValue * | getGenericExtension (const std::string &extensionName) noexcept |
Gets a generic extension with the given name as a CesiumUtility::JsonValue . | |
template<typename T , typename... ConstructorArgumentTypes> | |
T & | addExtension (ConstructorArgumentTypes &&... constructorArguments) |
Adds a statically-typed extension to this object. | |
template<typename T > | |
void | removeExtension () |
Removes a statically-typed extension from this object. | |
int64_t | getSizeBytes () const |
Calculates the size in bytes of this ExtensibleObject, including all of its extras but NOT including its extensions. Calling this method may be slow as it requires traversing the entire object. | |
Public Attributes | |
std::unordered_map< std::string, std::any > | extensions |
The extensions attached to this object. | |
JsonValue::Object | extras |
Application-specific data. | |
JsonValue::Object | unknownProperties |
Unknown properties that exist on this object but do not have any representation in the statically-typed classes. | |
The base class for objects that have extensions and extras.
Definition at line 15 of file ExtensibleObject.h.
|
inline |
Adds a statically-typed extension to this object.
If the extension already exists, the existing one is returned.
T | The type of the extension to add. |
Definition at line 74 of file ExtensibleObject.h.
|
inlinenoexcept |
Gets an extension given its static type.
T | The type of the extension. |
Definition at line 34 of file ExtensibleObject.h.
|
inlinenoexcept |
Gets an extension given its static type.
T | The type of the extension. |
Definition at line 44 of file ExtensibleObject.h.
|
noexcept |
Gets a generic extension with the given name as a CesiumUtility::JsonValue
.
If the extension exists but has a static type, this method will return nullptr. Use getExtension
to retrieve a statically-typed extension.
extensionName | The name of the extension. |
|
noexcept |
Gets a generic extension with the given name as a CesiumUtility::JsonValue
.
If the extension exists but has a static type, this method will return nullptr. Use getExtension
to retrieve a statically-typed extension.
extensionName | The name of the extension. |
|
inline |
Calculates the size in bytes of this ExtensibleObject, including all of its extras but NOT including its extensions. Calling this method may be slow as it requires traversing the entire object.
Definition at line 127 of file ExtensibleObject.h.
|
inlinenoexcept |
Checks if an extension exists given its static type.
T | The type of the extension. |
Definition at line 22 of file ExtensibleObject.h.
|
inline |
Removes a statically-typed extension from this object.
T | The type of the extension to remove. |
Definition at line 90 of file ExtensibleObject.h.
std::unordered_map<std::string, std::any> CesiumUtility::ExtensibleObject::extensions |
The extensions attached to this object.
Use getExtension
to get the extension with a particular static type. Use getGenericExtension
to get unknown extensions as a generic CesiumUtility::JsonValue
.
Definition at line 101 of file ExtensibleObject.h.
JsonValue::Object CesiumUtility::ExtensibleObject::extras |
Application-specific data.
Implementation Note: Although extras may have any type, it is common for applications to store and access custom data as key/value pairs. As best practice, extras should be an Object rather than a primitive value for best portability.
Definition at line 111 of file ExtensibleObject.h.
JsonValue::Object CesiumUtility::ExtensibleObject::unknownProperties |
Unknown properties that exist on this object but do not have any representation in the statically-typed classes.
These properties may be invalid, or they may represent deprecated, experimental, or next-version properties.
Definition at line 120 of file ExtensibleObject.h.