UOperatingSystemJsonStatics
#include <OperatingSystemJSON/Public/OperatingSystemJsonStatics.h>class UOperatingSystemJsonStaticsDefined in OperatingSystemJsonStatics.h:14
Inherits:
UBlueprintFunctionLibrary
Inheritance diagram
Section titled “Inheritance diagram”---
config:
class:
hideEmptyMembersBox: true
---
classDiagram
class UOperatingSystemJsonStatics["UOperatingSystemJsonStatics"]
class UBlueprintFunctionLibrary["UBlueprintFunctionLibrary"]
UBlueprintFunctionLibrary <|-- UOperatingSystemJsonStatics
Class detail
Section titled “Class detail”---
config:
class:
hideEmptyMembersBox: true
---
classDiagram
class UOperatingSystemJsonStatics {
+DoesFileExists(const FString &BaseFileNameWithoutExtension bool
+DeleteFile(const FString &BaseFileNameWithoutExtension bool
+ReadJson(const FString &BaseFileNameWithoutExtension TSharedPtr< FJsonObject >
+WriteJson(const FString &BaseFileNameWithoutExtension bool
+ReadStructFromJson(const FString &BaseFileNameWithoutExtension bool
+WriteStructToJson(const FString BaseFileNameWithoutExtension, bool
+Internal_ReadFromFile(const FString &BaseFileNameWithoutExtension bool
+Internal_WriteToFile(const FString &BaseFileNameWithoutExtension bool
+Internal_GetSaveSlotName(const FString &BaseFileName) FString
}
Caller impact — Internal_GetSaveSlotName
Section titled “Caller impact — Internal_GetSaveSlotName”Documented call sites inside the plugin (4):
flowchart LR UOperatingSystemJsonStatics__Internal_GetSaveSlotName["UOperatingSystemJsonStatics::Internal_GetSaveSlotName"] UOperatingSystemJsonStatics__DeleteFile["UOperatingSystemJsonStatics::DeleteFile"] UOperatingSystemJsonStatics__DeleteFile --> UOperatingSystemJsonStatics__Internal_GetSaveSlotName UOperatingSystemJsonStatics__DoesFileExists["UOperatingSystemJsonStatics::DoesFileExists"] UOperatingSystemJsonStatics__DoesFileExists --> UOperatingSystemJsonStatics__Internal_GetSaveSlotName UOperatingSystemJsonStatics__Internal_ReadFromFile["UOperatingSystemJsonStatics::Internal_ReadFromFile"] UOperatingSystemJsonStatics__Internal_ReadFromFile --> UOperatingSystemJsonStatics__Internal_GetSaveSlotName UOperatingSystemJsonStatics__Internal_WriteToFile["UOperatingSystemJsonStatics::Internal_WriteToFile"] UOperatingSystemJsonStatics__Internal_WriteToFile --> UOperatingSystemJsonStatics__Internal_GetSaveSlotName
Caller impact — WriteStructToJson
Section titled “Caller impact — WriteStructToJson”Documented call sites inside the plugin (3):
flowchart LR UOperatingSystemJsonStatics__WriteStructToJson["UOperatingSystemJsonStatics::WriteStructToJson"] UOperatingSystemStore__Internal_TryCreateSaveFile["UOperatingSystemStore::Internal_TryCreateSaveFile"] UOperatingSystemStore__Internal_TryCreateSaveFile --> UOperatingSystemJsonStatics__WriteStructToJson UOperatingSystemGameSubsystem__RequestFundsFromBank["UOperatingSystemGameSubsystem::RequestFundsFromBank"] UOperatingSystemGameSubsystem__RequestFundsFromBank --> UOperatingSystemJsonStatics__WriteStructToJson UOperatingSystemStore__SubmitRating["UOperatingSystemStore::SubmitRating"] UOperatingSystemStore__SubmitRating --> UOperatingSystemJsonStatics__WriteStructToJson
This class provides static utility functions for operating system related JSON operations.
Public Static Methods
Section titled “Public Static Methods”| Return | Name | Description |
|---|---|---|
bool | DoesFileExists static | Checks if a file with the given base file name without extension exists. |
bool | DeleteFile static | Deletes a file with the given base file name without extension. |
TSharedPtr< FJsonObject > | ReadJson static | Reads the JSON contents of a file with the given base file name without extension. |
bool | WriteJson static | Writes the JSON contents of the given JsonObject to a file with the specified base file name without extension. |
bool | ReadStructFromJson static inline | Reads the JSON contents of a file with the given base file name without extension and converts it to a struct. |
bool | WriteStructToJson static inline | Writes the contents of a struct to a JSON file. |
DoesFileExists
Section titled “DoesFileExists”static
static bool DoesFileExists(const FString & BaseFileNameWithoutExtension)Defined in OperatingSystemJsonStatics.h:26 Checks if a file with the given base file name without extension exists.
Parameters
Section titled “Parameters”BaseFileNameWithoutExtensionThe base file name without extension.
Returns
Section titled “Returns”True if the file exists, false otherwise.
Referenced by
Section titled “Referenced by”References
Section titled “References”DeleteFile
Section titled “DeleteFile”static
static bool DeleteFile(const FString & BaseFileNameWithoutExtension)Defined in OperatingSystemJsonStatics.h:34 Deletes a file with the given base file name without extension.
Parameters
Section titled “Parameters”BaseFileNameWithoutExtensionThe base file name without extension of the file to delete.
Returns
Section titled “Returns”True if the file was successfully deleted, false otherwise.
Referenced by
Section titled “Referenced by”References
Section titled “References”ReadJson
Section titled “ReadJson”static
static TSharedPtr< FJsonObject > ReadJson(const FString & BaseFileNameWithoutExtension)Defined in OperatingSystemJsonStatics.h:42 Reads the JSON contents of a file with the given base file name without extension.
Parameters
Section titled “Parameters”BaseFileNameWithoutExtensionThe base file name without extension of the file to read.
Returns
Section titled “Returns”A shared pointer to the deserialized JSON object if reading and deserialization is successful, otherwise nullptr.
References
Section titled “References”WriteJson
Section titled “WriteJson”static
static bool WriteJson(const FString & BaseFileNameWithoutExtension, TSharedRef< FJsonObject > JsonObject)Defined in OperatingSystemJsonStatics.h:51 Writes the JSON contents of the given JsonObject to a file with the specified base file name without extension.
Parameters
Section titled “Parameters”-
BaseFileNameWithoutExtensionThe base file name without extension of the file to write. -
JsonObjectThe JSON object to write to the file.
Returns
Section titled “Returns”True if the JSON object was successfully written to the file, false otherwise.
References
Section titled “References”ReadStructFromJson
Section titled “ReadStructFromJson”static inline
template<typename T> static inline bool ReadStructFromJson(const FString & BaseFileNameWithoutExtension, T & OutStruct)Defined in OperatingSystemJsonStatics.h:61 Reads the JSON contents of a file with the given base file name without extension and converts it to a struct.
Parameters
Section titled “Parameters”-
BaseFileNameWithoutExtensionThe base file name without extension of the file to read. -
OutStructThe output parameter that will receive the converted struct data.
Returns
Section titled “Returns”True if the file exists, the JSON object is successfully read, and the struct is successfully converted, false otherwise.
Referenced by
Section titled “Referenced by”WriteStructToJson
Section titled “WriteStructToJson”static inline
template<typename T> static inline bool WriteStructToJson(const FString BaseFileNameWithoutExtension, const T & InStruct)Defined in OperatingSystemJsonStatics.h:89 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.
Parameters
Section titled “Parameters”TThe type of the struct.
Parameters
Section titled “Parameters”-
BaseFileNameWithoutExtensionThe base file name without extension of the file to write. -
InStructThe struct to write to the JSON file.
Returns
Section titled “Returns”True if the struct was successfully converted to JSON and written to the file, false otherwise.
Referenced by
Section titled “Referenced by”Private Static Methods
Section titled “Private Static Methods”| Return | Name | Description |
|---|---|---|
bool | Internal_ReadFromFile static | Reads the contents of a file with the given base file name without extension and stores it in the OutContent parameter. |
bool | Internal_WriteToFile static | Writes the content to a file with the given base file name without extension. |
FString | Internal_GetSaveSlotName static | Generates the save slot name for the given base file name. |
Internal_ReadFromFile
Section titled “Internal_ReadFromFile”static
static bool Internal_ReadFromFile(const FString & BaseFileNameWithoutExtension, FString & OutContent)Defined in OperatingSystemJsonStatics.h:109 Reads the contents of a file with the given base file name without extension and stores it in the OutContent parameter.
Parameters
Section titled “Parameters”-
BaseFileNameWithoutExtensionThe base file name without extension of the file to read. -
OutContentThe output parameter that will receive the contents of the file.
Returns
Section titled “Returns”True if the file exists and the contents are successfully read, false otherwise.
Referenced by
Section titled “Referenced by”References
Section titled “References”Internal_WriteToFile
Section titled “Internal_WriteToFile”static
static bool Internal_WriteToFile(const FString & BaseFileNameWithoutExtension, const FString & ContentToWrite)Defined in OperatingSystemJsonStatics.h:121 Writes the content to a file with the given base file name without extension.
This function is internally used by the WriteJson function to write the JSON content to a file. It saves the content to a file using the FFileHelper::SaveStringToFile function.
Parameters
Section titled “Parameters”-
BaseFileNameWithoutExtensionThe base file name without extension of the file to write. -
ContentToWriteThe content to write to the file.
Returns
Section titled “Returns”True if the content was successfully written to the file, false otherwise.
Referenced by
Section titled “Referenced by”References
Section titled “References”Internal_GetSaveSlotName
Section titled “Internal_GetSaveSlotName”static
static FString Internal_GetSaveSlotName(const FString & BaseFileName)Defined in OperatingSystemJsonStatics.h:131 Generates the save slot name for the given base file name.
This function appends the save file extension to the base file name and combines it with the project’s saved directory and the “SaveGames” subdirectory.
Parameters
Section titled “Parameters”BaseFileNameThe base file name.
Returns
Section titled “Returns”The generated save slot name.