Operating System Simulator Plugin  3.5.1
Unreal Engine plugin that simulates an Operating System Environment
Loading...
Searching...
No Matches
UOperatingSystemJsonStatics Class Reference

This class provides static utility functions for operating system related JSON operations. More...

#include "OperatingSystemJsonStatics.h"

Inheritance diagram for UOperatingSystemJsonStatics:
[legend]
Collaboration diagram for UOperatingSystemJsonStatics:
[legend]

Static Public Member Functions

static bool DoesFileExists (const FString &BaseFileNameWithoutExtension)
 Checks if a file with the given base file name without extension exists.
 
static bool DeleteFile (const FString &BaseFileNameWithoutExtension)
 Deletes a file with the given base file name without extension.
 
static TSharedPtr< FJsonObject > ReadJson (const FString &BaseFileNameWithoutExtension)
 Reads the JSON contents of a file with the given base file name without extension.
 
static bool WriteJson (const FString &BaseFileNameWithoutExtension, TSharedRef< FJsonObject > JsonObject)
 Writes the JSON contents of the given JsonObject to a file with the specified base file name without extension.
 
template<typename T >
static bool ReadStructFromJson (const FString &BaseFileNameWithoutExtension, T &OutStruct)
 Reads the JSON contents of a file with the given base file name without extension and converts it to a struct.
 
template<typename T >
static bool WriteStructToJson (const FString BaseFileNameWithoutExtension, const T &InStruct)
 Writes the contents of a struct to a JSON file.
 

Detailed Description

This class provides static utility functions for operating system related JSON operations.

Member Function Documentation

◆ DeleteFile()

bool UOperatingSystemJsonStatics::DeleteFile ( const FString & BaseFileNameWithoutExtension)
static

Deletes a file with the given base file name without extension.

Parameters
BaseFileNameWithoutExtensionThe base file name without extension of the file to delete.
Returns
True if the file was successfully deleted, false otherwise.
Here is the caller graph for this function:

◆ DoesFileExists()

bool UOperatingSystemJsonStatics::DoesFileExists ( const FString & BaseFileNameWithoutExtension)
static

Checks if a file with the given base file name without extension exists.

Parameters
BaseFileNameWithoutExtensionThe base file name without extension.
Returns
True if the file exists, false otherwise.

◆ ReadJson()

TSharedPtr< FJsonObject > UOperatingSystemJsonStatics::ReadJson ( const FString & BaseFileNameWithoutExtension)
static

Reads the JSON contents of a file with the given base file name without extension.

Parameters
BaseFileNameWithoutExtensionThe base file name without extension of the file to read.
Returns
A shared pointer to the deserialized JSON object if reading and deserialization is successful, otherwise nullptr.

◆ ReadStructFromJson()

template<typename T >
static bool UOperatingSystemJsonStatics::ReadStructFromJson ( const FString & BaseFileNameWithoutExtension,
T & OutStruct )
inlinestatic

Reads the JSON contents of a file with the given base file name without extension and converts it to a struct.

Parameters
BaseFileNameWithoutExtensionThe base file name without extension of the file to read.
OutStructThe output parameter that will receive the converted struct data.
Returns
True if the file exists, the JSON object is successfully read, and the struct is successfully converted, false otherwise.
Here is the caller graph for this function:

◆ WriteJson()

bool UOperatingSystemJsonStatics::WriteJson ( const FString & BaseFileNameWithoutExtension,
TSharedRef< FJsonObject > JsonObject )
static

Writes the JSON contents of the given JsonObject to a file with the specified base file name without extension.

Parameters
BaseFileNameWithoutExtensionThe base file name without extension of the file to write.
JsonObjectThe JSON object to write to the file.
Returns
True if the JSON object was successfully written to the file, false otherwise.

◆ WriteStructToJson()

template<typename T >
static bool UOperatingSystemJsonStatics::WriteStructToJson ( const FString BaseFileNameWithoutExtension,
const T & InStruct )
inlinestatic

Writes the contents of a struct to a JSON file.

This function takes a struct and converts it to a JSON object using the FJsonObjectConverter::UStructToJsonObject function. It then writes the JSON contents of the converted object to a file with the given base file name without extension using the WriteJson function.

Template Parameters
TThe type of the struct.
Parameters
BaseFileNameWithoutExtensionThe base file name without extension of the file to write.
InStructThe struct to write to the JSON file.
Returns
True if the struct was successfully converted to JSON and written to the file, false otherwise.
Here is the caller graph for this function:

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