#include <BaseJsonSerializer.h>
Inherited by AZ::BaseJsonIntegerSerializer, AZ::BaseJsonMatrixSerializer, AZ::BaseJsonVectorSerializer, AZ::Data::AssetJsonSerializer, AZ::EnumConstantJsonSerializer, AZ::JsonAnySerializer, AZ::JsonArraySerializer, AZ::JsonBasicContainerSerializer, AZ::JsonBoolSerializer, AZ::JsonByteStreamSerializer, AZ::JsonColorSerializer, AZ::JsonConfigurableStackSerializer, AZ::JsonDoubleSerializer, AZ::JsonEntityIdSerializer, AZ::JsonEntitySerializer, AZ::JsonFloatSerializer, AZ::JsonMapSerializer, AZ::JsonOSStringSerializer, AZ::JsonPathSerializer, AZ::JsonSmartPointerSerializer, AZ::JsonStringSerializer, AZ::JsonTransformSerializer, AZ::JsonTupleSerializer, AZ::JsonUnorderedSetContainerSerializer, AZ::JsonUnsupportedTypesSerializer, AZ::JsonUuidSerializer, AZ::NameJsonSerializer, and AZ::ScriptPropertySerializer.
|
JsonSerializationResult::ResultCode | ContinueLoading (void *object, const Uuid &typeId, const rapidjson::Value &value, JsonDeserializerContext &context, ContinuationFlags flags=ContinuationFlags::None) |
|
JsonSerializationResult::ResultCode | ContinueStoring (rapidjson::Value &output, const void *object, const void *defaultObject, const Uuid &typeId, JsonSerializerContext &context, ContinuationFlags flags=ContinuationFlags::None) |
|
JsonSerializationResult::ResultCode | LoadTypeId (Uuid &typeId, const rapidjson::Value &input, JsonDeserializerContext &context, const Uuid *baseTypeId=nullptr, bool *isExplicit=nullptr) |
|
JsonSerializationResult::ResultCode | StoreTypeId (rapidjson::Value &output, const Uuid &typeId, JsonSerializerContext &context) |
|
JsonSerializationResult::ResultCode | ContinueLoadingFromJsonObjectField (void *object, const Uuid &typeId, const rapidjson::Value &value, rapidjson::Value::StringRefType memberName, JsonDeserializerContext &context, ContinuationFlags flags=ContinuationFlags::None) |
| Helper function similar to ContinueLoading, but loads the data as a member of 'value' rather than 'value' itself, if it exists.
|
|
JsonSerializationResult::ResultCode | ContinueStoringToJsonObjectField (rapidjson::Value &output, rapidjson::Value::StringRefType newMemberName, const void *object, const void *defaultObject, const Uuid &typeId, JsonSerializerContext &context, ContinuationFlags flags=ContinuationFlags::None) |
| Helper function similar to ContinueStoring, but stores the data as a member of 'output' rather than overwriting 'output'.
|
|
bool | IsExplicitDefault (const rapidjson::Value &value) |
|
rapidjson::Value | GetExplicitDefault () |
|
The abstract class for primitive Json Serializers. It is intentionally not templated, and uses void* for output value parameters.
◆ ContinuationFlags
Enumerator |
---|
ResolvePointer | No extra flags.
|
ReplaceDefault | The pointer passed in contains a pointer. The (de)serializer will attempt to resolve to an instance.
|
LoadAsNewInstance | The default value provided for storing will be replaced with a newly created one.
|
IgnoreTypeSerializer | Treats the value as if it's a newly created instance. This may trigger serializers marked with OperationFlags::InitializeNewInstance. Used for instance by pointers or new instances added to an array.
|
◆ OperationFlags
Enumerator |
---|
ManualDefault | No flags that control how the custom json serializer is used.
|
InitializeNewInstance | Even if an (explicit) default is found the custom json serializer will still be called.
|
◆ ContinueLoading()
Continues loading of a (sub)value. Use this function to load member variables for instance. This is more optimal than directly calling the json serialization.
- Parameters
-
object | Pointer to the object where the data will be loaded into. |
typeId | Type id of the object passed in. |
value | The value in the JSON document where the deserializer will start reading data from. |
context | The context used during deserialization. Use the value passed in from Load. |
◆ ContinueStoring()
Continues storing of a (sub)value. Use this function to store member variables for instance. This is more optimal than directly calling the json serialization.
- Parameters
-
output | The value in the json document where the converted data will start writing to. |
allocator | The memory allocator used by RapidJSON to create the json document. |
object | Pointer to the object that will be read from for values to convert. |
defaultObject | Pointer to a default object used to compare the object to in order to determine if values are defaulted or not. This argument can be null, in which case a temporary default may be created if required by the settings. |
typeId | The type id of the object and default object. |
context | The context used during serialization. Use the value passed in from Store. |
◆ GetExplicitDefault()
rapidjson::Value AZ::BaseJsonSerializer::GetExplicitDefault |
( |
| ) |
|
|
protected |
Gets a value to represent an explicit default. This useful for containers where not storing anything as a default would mean a slot wouldn't be used so something has to be added to represent the fully default target.
◆ GetOperationsFlags()
virtual OperationFlags AZ::BaseJsonSerializer::GetOperationsFlags |
( |
| ) |
const |
|
virtual |
Returns the operation flags which tells the Json Serialization how this custom json serializer can be used.
Reimplemented in AZ::JsonColorSerializer, AZ::BaseJsonMatrixSerializer, AZ::BaseJsonVectorSerializer, AZ::JsonTransformSerializer, AZ::JsonUuidSerializer, AZ::JsonArraySerializer, AZ::JsonBoolSerializer, AZ::JsonDoubleSerializer, AZ::JsonFloatSerializer, AZ::BaseJsonIntegerSerializer, AZ::JsonSmartPointerSerializer, and AZ::JsonTupleSerializer.
◆ IsExplicitDefault()
bool AZ::BaseJsonSerializer::IsExplicitDefault |
( |
const rapidjson::Value & |
value | ) |
|
|
protected |
Checks if a value is an explicit default. This useful for containers where not storing anything as a default would mean a slot wouldn't be used so something has to be added to represent the fully default target.
◆ Load()
Transforms the data from the rapidjson Value to outputValue, if the conversion is possible and supported. The serializer is responsible for casting to the proper type and safely writing to the outputValue memory.
- Note
- The default implementation is to load the object ignoring a custom serializers for the type, which allows for custom serializers to modify the object after all default loading has occurred.
Reimplemented in AZ::Data::AssetJsonSerializer, AZ::JsonEntityIdSerializer, AZ::JsonEntitySerializer, AZ::JsonColorSerializer, AZ::JsonMatrix3x3Serializer, AZ::JsonMatrix3x4Serializer, AZ::JsonMatrix4x4Serializer, AZ::JsonVector2Serializer, AZ::JsonVector3Serializer, AZ::JsonVector4Serializer, AZ::JsonQuaternionSerializer, AZ::JsonTransformSerializer, AZ::JsonUuidSerializer, AZ::NameJsonSerializer, AZ::EnumConstantJsonSerializer, AZ::JsonAnySerializer, AZ::JsonArraySerializer, AZ::JsonBasicContainerSerializer, AZ::JsonBoolSerializer, AZ::JsonByteStreamSerializer, AZ::JsonDoubleSerializer, AZ::JsonFloatSerializer, AZ::JsonCharSerializer, AZ::JsonShortSerializer, AZ::JsonIntSerializer, AZ::JsonLongSerializer, AZ::JsonLongLongSerializer, AZ::JsonUnsignedCharSerializer, AZ::JsonUnsignedShortSerializer, AZ::JsonUnsignedIntSerializer, AZ::JsonUnsignedLongSerializer, AZ::JsonUnsignedLongLongSerializer, AZ::JsonMapSerializer, AZ::JsonPathSerializer, AZ::JsonSmartPointerSerializer, AZ::JsonStringSerializer, AZ::JsonOSStringSerializer, AZ::JsonTupleSerializer, AZ::JsonUnorderedSetContainerSerializer, AZ::JsonUnsupportedTypesSerializer, and AZ::JsonConfigurableStackSerializer.
◆ LoadTypeId()
Retrieves the type id from a json object or json string.
- Parameters
-
typeId | The retrieved type id. |
input | The json object to read type information from. This call will fail if input is not an object. |
context | The context used during serialization. Use the value passed in from Store. |
baseTypeId | An optional base type that the target type id is expected to inherit from. If two or more types share the same then the baseTypeId is used to disambiguate between candidates. |
isExplicit | An optional boolean to indicate if the type id was explicitly (true) declared in the json file or that it was derived from the provided information (false). |
◆ Store()
Write the input value to a rapidjson value if the default value is not null and doesn't match the input value, otherwise an error is returned and sets the rapidjson value to a null value.
- Note
- The default implementation is to store the object ignoring custom serializers.
Reimplemented in AZ::Data::AssetJsonSerializer, AZ::JsonEntityIdSerializer, AZ::JsonEntitySerializer, AZ::JsonColorSerializer, AZ::JsonMatrix3x3Serializer, AZ::JsonMatrix3x4Serializer, AZ::JsonMatrix4x4Serializer, AZ::JsonVector2Serializer, AZ::JsonVector3Serializer, AZ::JsonVector4Serializer, AZ::JsonQuaternionSerializer, AZ::JsonTransformSerializer, AZ::JsonUuidSerializer, AZ::NameJsonSerializer, AZ::EnumConstantJsonSerializer, AZ::JsonAnySerializer, AZ::JsonArraySerializer, AZ::JsonBasicContainerSerializer, AZ::JsonBoolSerializer, AZ::JsonByteStreamSerializer, AZ::JsonDoubleSerializer, AZ::JsonFloatSerializer, AZ::JsonCharSerializer, AZ::JsonShortSerializer, AZ::JsonIntSerializer, AZ::JsonLongSerializer, AZ::JsonLongLongSerializer, AZ::JsonUnsignedCharSerializer, AZ::JsonUnsignedShortSerializer, AZ::JsonUnsignedIntSerializer, AZ::JsonUnsignedLongSerializer, AZ::JsonUnsignedLongLongSerializer, AZ::JsonMapSerializer, AZ::JsonUnorderedMapSerializer, AZ::JsonUnorderedMapSerializer, AZ::JsonUnorderedMultiMapSerializer, AZ::JsonUnorderedMultiMapSerializer, AZ::JsonPathSerializer, AZ::JsonSmartPointerSerializer, AZ::JsonStringSerializer, AZ::JsonOSStringSerializer, AZ::JsonTupleSerializer, AZ::JsonUnorderedSetContainerSerializer, AZ::JsonUnsupportedTypesSerializer, and AZ::JsonConfigurableStackSerializer.
◆ StoreTypeId()
Stores the name of the type id or if there are conflicts the type's uuid.
- Parameters
-
output | The json value that will receive the converted type id. |
typId | The Type id to store. |
context | The context used during serialization. Use the value passed in from Store. |
The documentation for this class was generated from the following file:
- Code/Framework/AzCore/AzCore/Serialization/Json/BaseJsonSerializer.h