Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::JsonBaseContext Class Reference

Inherited by AZ::JsonDeserializerContext, and AZ::JsonSerializerContext.

Public Member Functions

 JsonBaseContext (JsonSerializationMetadata &metadata, JsonSerializationResult::JsonIssueCallback reporting, StackedString::Format pathFormat, SerializeContext *serializeContext, JsonRegistrationContext *registrationContext)
 
JsonSerializationResult::Result Report (JsonSerializationResult::ResultCode result, AZStd::string_view message) const
 
JsonSerializationResult::Result Report (JsonSerializationResult::Tasks task, JsonSerializationResult::Outcomes outcome, AZStd::string_view message) const
 
void PushReporter (JsonSerializationResult::JsonIssueCallback callback)
 Push a (temporary) new callback to the reporter stack. The top reporter will always be used.
 
void PopReporter ()
 
const JsonSerializationResult::JsonIssueCallbackGetReporter () const
 Get the currently active reporter.
 
JsonSerializationResult::JsonIssueCallbackGetReporter ()
 Get the currently active reporter.
 
void PushPath (AZStd::string_view child)
 Add a child name to the path.
 
void PushPath (size_t index)
 Add an index to the path.
 
void PopPath ()
 Remove a previously added entry to the path.
 
const StackedStringGetPath () const
 Gets the path to the element that's currently being operated on.
 
JsonSerializationMetadataGetMetadata ()
 
const JsonSerializationMetadataGetMetadata () const
 
SerializeContextGetSerializeContext ()
 
const SerializeContextGetSerializeContext () const
 
JsonRegistrationContextGetRegistrationContext ()
 
const JsonRegistrationContextGetRegistrationContext () const
 

Protected Attributes

AZStd::stack< JsonSerializationResult::JsonIssueCallbackm_reporters
 
StackedString m_path
 Path to the element that's currently being operated on.
 
JsonSerializationMetadatam_metadata
 
SerializeContextm_serializeContext = nullptr
 The Serialize Context that can be used to retrieve meta data during processing.
 
JsonRegistrationContextm_registrationContext = nullptr
 The registration context for the json serialization. This can be used to retrieve the handlers for specific types.
 

Member Function Documentation

◆ PopReporter()

void AZ::JsonBaseContext::PopReporter ( )

Removes a previously pushed reporter. This function will guarantee that there's always one reporter Even if there are too many calls to PopReporter.

◆ Report() [1/2]

JsonSerializationResult::Result AZ::JsonBaseContext::Report ( JsonSerializationResult::ResultCode  result,
AZStd::string_view  message 
) const

Report progress and issues. Users can change the return code to change the behavior of the (de)serializer.

Returns
The result code of the operation that's being reported on. @message The message to report to the caller of the (de)serializer.
The result code passed in as an argument or an updated version if the caller desires a different behavior.

◆ Report() [2/2]

JsonSerializationResult::Result AZ::JsonBaseContext::Report ( JsonSerializationResult::Tasks  task,
JsonSerializationResult::Outcomes  outcome,
AZStd::string_view  message 
) const

Report progress and issues. Users can change the return code to change the behavior of the (de)serializer. @task The task that was being performed. @outcome The result of the task. @message The message to report to the caller of the (de)serializer.

Returns
The result code passed in as an argument or an updated version if the caller desires a different behavior.

Member Data Documentation

◆ m_metadata

JsonSerializationMetadata& AZ::JsonBaseContext::m_metadata
protected

Metadata that's passed in by the settings as additional configuration options or metadata that's collected during processing for later use.

◆ m_reporters

AZStd::stack<JsonSerializationResult::JsonIssueCallback> AZ::JsonBaseContext::m_reporters
protected

Callback used to report progress and issues. Users of the serialization can update the return code to change the behavior of the serializer.


The documentation for this class was generated from the following file: