Skip to content

UOperatingSystemJsonStatics

#include <OperatingSystemJSON/Public/OperatingSystemJsonStatics.h>
class UOperatingSystemJsonStatics

Defined in OperatingSystemJsonStatics.h:14

Inherits: UBlueprintFunctionLibrary

---
config:
  class:
    hideEmptyMembersBox: true
---
classDiagram
  class UOperatingSystemJsonStatics["UOperatingSystemJsonStatics"]
  class UBlueprintFunctionLibrary["UBlueprintFunctionLibrary"]
  UBlueprintFunctionLibrary <|-- UOperatingSystemJsonStatics
---
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

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.

ReturnNameDescription
boolDoesFileExists staticChecks if a file with the given base file name without extension exists.
boolDeleteFile staticDeletes a file with the given base file name without extension.
TSharedPtr< FJsonObject >ReadJson staticReads the JSON contents of a file with the given base file name without extension.
boolWriteJson staticWrites the JSON contents of the given JsonObject to a file with the specified base file name without extension.
boolReadStructFromJson static inlineReads the JSON contents of a file with the given base file name without extension and converts it to a struct.
boolWriteStructToJson static inlineWrites the contents of a struct to a JSON file.

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.

  • BaseFileNameWithoutExtension The base file name without extension.

True if the file exists, false otherwise.


static

static bool DeleteFile(const FString & BaseFileNameWithoutExtension)

Defined in OperatingSystemJsonStatics.h:34 Deletes a file with the given base file name without extension.

  • BaseFileNameWithoutExtension The base file name without extension of the file to delete.

True if the file was successfully deleted, false otherwise.


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.

  • BaseFileNameWithoutExtension The base file name without extension of the file to read.

A shared pointer to the deserialized JSON object if reading and deserialization is successful, otherwise nullptr.


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.

  • BaseFileNameWithoutExtension The base file name without extension of the file to write.

  • JsonObject The JSON object to write to the file.

True if the JSON object was successfully written to the file, false otherwise.


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.

  • BaseFileNameWithoutExtension The base file name without extension of the file to read.

  • OutStruct The output parameter that will receive the converted struct data.

True if the file exists, the JSON object is successfully read, and the struct is successfully converted, false otherwise.


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.

  • T The type of the struct.
  • BaseFileNameWithoutExtension The base file name without extension of the file to write.

  • InStruct The struct to write to the JSON file.

True if the struct was successfully converted to JSON and written to the file, false otherwise.

ReturnNameDescription
boolInternal_ReadFromFile staticReads the contents of a file with the given base file name without extension and stores it in the OutContent parameter.
boolInternal_WriteToFile staticWrites the content to a file with the given base file name without extension.
FStringInternal_GetSaveSlotName staticGenerates the save slot name for the given base file name.

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.

  • BaseFileNameWithoutExtension The base file name without extension of the file to read.

  • OutContent The output parameter that will receive the contents of the file.

True if the file exists and the contents are successfully read, false otherwise.


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.

  • BaseFileNameWithoutExtension The base file name without extension of the file to write.

  • ContentToWrite The content to write to the file.

True if the content was successfully written to the file, false otherwise.


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.

  • BaseFileName The base file name.

The generated save slot name.