A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
FDlgJsonParser Class Reference

The DlgJsonParser class mostly adapted for Dialogues, copied from FJsonObjectConverter See IDlgParser for properties and METADATA specifiers. More...

#include <DlgJsonParser.h>

Inheritance diagram for FDlgJsonParser:
[legend]

Public Member Functions

 FDlgJsonParser ()
 
 FDlgJsonParser (const FString &FilePath)
 
void InitializeParser (const FString &FilePath) override
 
void InitializeParserFromString (const FString &Text) override
 
bool IsLogVerbose () const
 
bool IsValidFile () const override
 
void ReadAllProperty (const UStruct *ReferenceClass, void *TargetObject, UObject *DefaultObjectOuter=nullptr) override
 
void SetLogVerbose (bool bValue)
 

Protected Member Functions

const UClass * GetChildClassFromName (const UClass *ParentClass, const FString &Name)
 

Static Protected Member Functions

static UObjectCreateNewUObject (const UClass *StructDefinition, UObject *ObjectOuter)
 

Protected Attributes

bool bLogVerbose = false
 
TArray< UClass * > StructCache
 

Private Member Functions

bool ConvertScalarJsonValueToProperty (const TSharedPtr< FJsonValue > &JsonValue, FNYProperty *Property, void *ContainerPtr, void *ValuePtr)
 
bool JsonAttributesToUStruct (const TMap< FString, TSharedPtr< FJsonValue > > &JsonAttributes, const UStruct *StructDefinition, void *ContainerPtr)
 
bool JsonObjectStringToUStruct (const UStruct *StructDefinition, void *ContainerPtr)
 
bool JsonObjectToUStruct (const TSharedRef< const FJsonObject > &JsonObject, const UStruct *StructDefinition, void *ContainerPtr)
 
bool JsonValueToProperty (const TSharedPtr< FJsonValue > &JsonValue, FNYProperty *Property, void *ContainerPtr, void *ValuePtr)
 

Private Attributes

bool bIsValidFile = false
 
UObjectDefaultObjectOuter = nullptr
 
FString FileName
 
FString JsonString
 

Static Private Attributes

static constexpr int64 CheckFlags = ~CPF_ParmFlags
 

Detailed Description

The DlgJsonParser class mostly adapted for Dialogues, copied from FJsonObjectConverter See IDlgParser for properties and METADATA specifiers.

Definition at line 19 of file DlgJsonParser.h.

Constructor & Destructor Documentation

◆ FDlgJsonParser() [1/2]

FDlgJsonParser::FDlgJsonParser ( )
inline

Call Order and possible calls:

  • DlgJsonParser
    • InitializeParser
      • JsonObjectStringToUStruct
        • JsonObjectToUStruct
          • JsonAttributesToUStruct
            • JsonValueToProperty
              • ConvertScalarJsonValueToProperty
                • JsonValueToProperty
                • JsonObjectToUStruct

Definition at line 35 of file DlgJsonParser.h.

◆ FDlgJsonParser() [2/2]

FDlgJsonParser::FDlgJsonParser ( const FString & FilePath)
inline

Definition at line 37 of file DlgJsonParser.h.

Here is the call graph for this function:

Member Function Documentation

◆ ConvertScalarJsonValueToProperty()

bool FDlgJsonParser::ConvertScalarJsonValueToProperty ( const TSharedPtr< FJsonValue > & JsonValue,
FNYProperty * Property,
void * ContainerPtr,
void * ValuePtr )
private

Convert JSON to property, assuming either the property is not an array or the value is an individual array element Used by JsonValueToProperty

Definition at line 109 of file DlgJsonParser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateNewUObject()

static UObject * IDlgParser::CreateNewUObject ( const UClass * StructDefinition,
UObject * ObjectOuter )
inlinestaticprotectedinherited

Default way to create new objects

Definition at line 70 of file IDlgParser.h.

Here is the caller graph for this function:

◆ GetChildClassFromName()

const UClass * IDlgParser::GetChildClassFromName ( const UClass * ParentClass,
const FString & Name )
inlineprotectedinherited

Searches the proper not abstract class

Parameters
ParentClassthe class we are looking for has to inherit from this class
Namethe name of the class we are looking for (without engine pretags, e.g. Actor for AActor)
Returns
the class, or nullptr if it does not exist

Definition at line 45 of file IDlgParser.h.

Here is the caller graph for this function:

◆ InitializeParser()

void FDlgJsonParser::InitializeParser ( const FString & FilePath)
overridevirtual

Initializes the parser with the specified FilePath.

Implements IDlgParser.

Definition at line 71 of file DlgJsonParser.cpp.

Here is the caller graph for this function:

◆ InitializeParserFromString()

void FDlgJsonParser::InitializeParserFromString ( const FString & Text)
overridevirtual

Initializes the parser with the specified input string

Reimplemented from IDlgParser.

Definition at line 88 of file DlgJsonParser.cpp.

◆ IsLogVerbose()

bool IDlgParser::IsLogVerbose ( ) const
inlineinherited

Definition at line 33 of file IDlgParser.h.

◆ IsValidFile()

bool FDlgJsonParser::IsValidFile ( ) const
inlineoverridevirtual

Is the parsed file valid?

Implements IDlgParser.

Definition at line 45 of file DlgJsonParser.h.

Here is the caller graph for this function:

◆ JsonAttributesToUStruct()

bool FDlgJsonParser::JsonAttributesToUStruct ( const TMap< FString, TSharedPtr< FJsonValue > > & JsonAttributes,
const UStruct * StructDefinition,
void * ContainerPtr )
private

Converts a set of json attributes (possibly from within a JsonObject) to a UStruct, using importText

Parameters
JsonAttributesJson Object to copy data out of
StructDefinitionUStruct definition that is looked over for properties
ContainerPtrThe Pointer instance to copy in to
Returns
False if any properties matched but failed to deserialize

Definition at line 726 of file DlgJsonParser.cpp.

Here is the call graph for this function:

◆ JsonObjectStringToUStruct()

bool FDlgJsonParser::JsonObjectStringToUStruct ( const UStruct * StructDefinition,
void * ContainerPtr )
private

Converts from a json string containing an object to a UStruct

Parameters
OutStructThe UStruct instance to copy in to
ContainerPtrThe Pointer instance to copy in to
Returns
False if any properties matched but failed to deserialize

Definition at line 837 of file DlgJsonParser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ JsonObjectToUStruct()

bool FDlgJsonParser::JsonObjectToUStruct ( const TSharedRef< const FJsonObject > & JsonObject,
const UStruct * StructDefinition,
void * ContainerPtr )
inlineprivate

Converts from a Json Object to a UStruct, using importText

Parameters
JsonObjectJson Object to copy data out of
StructDefinitionUStruct definition that is looked over for properties
ContainerPtrThe Pointer instance to copy in to
Returns
False if any properties matched but failed to deserialize

Definition at line 89 of file DlgJsonParser.h.

Here is the caller graph for this function:

◆ JsonValueToProperty()

bool FDlgJsonParser::JsonValueToProperty ( const TSharedPtr< FJsonValue > & JsonValue,
FNYProperty * Property,
void * ContainerPtr,
void * ValuePtr )
private

Converts a single JsonValue to the corresponding Property (this may recurse if the property is a UStruct for instance).

Parameters
JsonValueThe value to assign to this property
PropertyThe Property definition of the property we're setting.
ValuePtrPointer to the property instance to be modified.
Returns
False if the property failed to serialize

Definition at line 649 of file DlgJsonParser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadAllProperty()

void FDlgJsonParser::ReadAllProperty ( const UStruct * ReferenceClass,
void * TargetObject,
UObject * DefaultObjectOuter = nullptr )
overridevirtual

Reads all property from the config file.

Parameters
ReferenceClassUStruct (or UClass) of the TargetObject
TargetObjectpointer to the object instance the function will modify based on the config values
DefaultObjectOuterOuter used for UObject construction if necessary

Implements IDlgParser.

Definition at line 96 of file DlgJsonParser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLogVerbose()

void IDlgParser::SetLogVerbose ( bool bValue)
inlineinherited

Definition at line 34 of file IDlgParser.h.

Member Data Documentation

◆ bIsValidFile

bool FDlgJsonParser::bIsValidFile = false
private

Definition at line 107 of file DlgJsonParser.h.

◆ bLogVerbose

bool IDlgParser::bLogVerbose = false
protectedinherited

Definition at line 81 of file IDlgParser.h.

◆ CheckFlags

constexpr int64 FDlgJsonParser::CheckFlags = ~CPF_ParmFlags
staticconstexprprivate

Only properties that have these flags will be read.

Definition at line 113 of file DlgJsonParser.h.

◆ DefaultObjectOuter

UObject* FDlgJsonParser::DefaultObjectOuter = nullptr
private

The default object outer used when creating new objects when using NewObject.

Definition at line 110 of file DlgJsonParser.h.

◆ FileName

FString FDlgJsonParser::FileName
private

Definition at line 106 of file DlgJsonParser.h.

◆ JsonString

FString FDlgJsonParser::JsonString
private

Definition at line 105 of file DlgJsonParser.h.

◆ StructCache

TArray<UClass*> IDlgParser::StructCache
protectedinherited

each time a class is read it also cached here, so next time when it has to be found based on name it can be found faster

Definition at line 78 of file IDlgParser.h.


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