Config Forge 1.0.0
Loading...
Searching...
No Matches
UConfigForgeSubsystem Class Reference

Game instance subsystem for managing configuration files and categories in the ConfigForge plugin. More...

#include <ConfigForgeSubsystem.h>

Inheritance diagram for UConfigForgeSubsystem:

Public Member Functions

const UConfigForgeDeveloperSettingsGetSettings () const
 Gets the developer settings for the ConfigForge system.
 
TSoftObjectPtr< UConfigForgeSetupGetSetupAsset () const
 Retrieves the setup asset reference from developer settings.
 
bool GetFile (const FString &InFileName, FConfigForgeFileData &OutFileData) const
 Retrieves a specific configuration file by name.
 
void GetFiles (TArray< FConfigForgeFileData > &OutFiles) const
 Retrieves all valid configuration files from the setup asset.
 
void GetFileNames (TArray< FString > &OutNames) const
 Retrieves the names of all configuration files in the setup asset.
 
void GetFileCategoriesByName (const FString &InFileName, TArray< FName > &OutCategories)
 Retrieves all category names from a file specified by name.
 
void GetFileCategories (const FConfigForgeFileData &InFileData, TArray< FName > &OutCategories)
 Retrieves all category names from a file data structure.
 
void GetCategoryProperties (const FString &InFileName, const FName &InCategoryName, TArray< UConfigValueObject * > &OutProperties)
 Retrieves all property value objects from a specific category within a file.
 
bool GetRuntimeFile (const FGuid &InUniqueFileId, UConfigForgeFileRuntime *&OutRuntimeFile) const
 Retrieves a loaded runtime file instance by its unique ID.
 
void GetAllRuntimeFiles (TArray< UConfigForgeFileRuntime * > &OutRuntimeFiles) const
 Retrieves all runtime configuration files currently loaded in the subsystem.
 
bool GetRuntimeCategories (const UConfigForgeFileRuntime *InConfigFile, TArray< UConfigForgeCategoryRuntime * > &OutCategories) const
 Retrieves all categories from a specific runtime configuration file.
 
bool GetRuntimeCategories_ID (const FGuid &InFileId, TArray< UConfigForgeCategoryRuntime * > &OutCategories) const
 Retrieves all categories from a runtime configuration file identified by its GUID.
 
bool GetRuntimeCategory (const UConfigForgeFileRuntime *InConfigFile, const FName &InCategoryName, UConfigForgeCategoryRuntime *&OutCategory) const
 Retrieves a specific category by name from a runtime configuration file.
 
bool GetRuntimeCategory_ID (const FGuid &InFileId, const FName &InCategoryName, UConfigForgeCategoryRuntime *&OutCategory) const
 Retrieves a specific category by name from a runtime configuration file identified by its GUID.
 
bool GetRuntimeField (const UConfigForgeCategoryRuntime *InRuntimeCategory, const FString &InKey, UConfigValueObjectRuntime *&OutField) const
 Retrieves a specific field by key from a runtime category.
 
bool GetRuntimeField_Full (const FGuid &InFiledId, const FName &InCategoryName, const FString &InFieldName, UConfigForgeFileRuntime *&OutFile, UConfigForgeCategoryRuntime *&OutCategory, UConfigValueObjectRuntime *&OutField) const
 Retrieves a runtime field by providing its file ID, category name, and field name.
 
bool GetRuntimeField_File (const UConfigForgeFileRuntime *InConfigFile, const FName &InCategoryName, const FString &InKey, UConfigValueObjectRuntime *&OutField) const
 Retrieves a specific field by key from a category within a runtime configuration file.
 
bool GetRuntimeField_ID (const FGuid &InFileID, const FName &InCategoryName, const FString &InKey, UConfigValueObjectRuntime *&OutField) const
 Retrieves a specific field by key from a category within a runtime configuration file identified by its GUID.
 
bool GetRuntimeFields (const UConfigForgeCategoryRuntime *InRuntimeCategory, TArray< UConfigValueObjectRuntime * > &OutFields) const
 Retrieves all fields from a runtime category.
 
bool GetRuntimeFields_File (const UConfigForgeFileRuntime *InConfigFile, const FName &InCategoryName, TArray< UConfigValueObjectRuntime * > &OutFields) const
 Retrieves all fields from a category within a runtime configuration file.
 
bool GetRuntimeFields_ID (const FGuid &InFileID, const FName &InCategoryName, TArray< UConfigValueObjectRuntime * > &OutFields) const
 Retrieves all fields from a category within a runtime configuration file identified by its GUID.
 
FORCEINLINE bool IsOperatingFiles () const
 Checks whether a file load/save operation is currently in progress.
 
bool LoadSingleFile (const FConfigForgeFileData &InFileData, UConfigForgeFileRuntime *&OutFile)
 Synchronously loads a single config file from disk.
 
void LoadSingleFileAsync (const FConfigForgeFileData &InFileData, FLoadForgeFileDelegate Callback)
 Asynchronously loads a single config file from disk.
 
bool SaveSingleFile (const FGuid &InFileUniqueID)
 Synchronously saves a single loaded config file to disk.
 
void SaveSingleFileAsync (const FGuid &InFileUniqueID, FSaveForgeFileDelegate Callback)
 Asynchronously saves a single loaded config file to disk.
 
bool LoadAllFiles (TArray< UConfigForgeFileRuntime * > &OutFiles)
 Loads all configuration files synchronously.
 
void LoadAllFilesAsync (FLoadAllForgeFileDelegate Callback)
 Loads all configuration files asynchronously.
 
bool LoadSelectedFiles (const TArray< FConfigForgeFileData > &InFiles, TArray< UConfigForgeFileRuntime * > &OutFiles)
 Synchronously loads a selected subset of config files into runtime objects.
 
void LoadSelectedFilesAsync (const TArray< FConfigForgeFileData > &InFiles, FLoadAllForgeFileDelegate Callback)
 Asynchronously loads a selected subset of config files into runtime objects.
 
bool SaveAllFiles ()
 Saves all currently loaded runtime configuration files synchronously.
 
void SaveAllFilesAsync (FSaveAllForgeFileDelegate Callback)
 Saves all currently loaded runtime configuration files asynchronously.
 
bool SaveSelectedFiles (const TArray< FGuid > &InFiles)
 Synchronously saves the specified files to disk.
 
void SaveSelectedFiles (const TArray< FGuid > &InFiles, FSaveSelectedForgeFileDelegate Callback)
 Asynchronously saves the specified files and calls delegate upon completion.
 

Static Public Member Functions

static void GetFilesStatic (UConfigForgeSetup *InSetupFile, TArray< FConfigForgeFileData > &OutFiles)
 

Public Attributes

FConfigForgeSubsystemFileDelegate OnFileLoaded
 
FConfigForgeSubsystemFileDelegate OnFileSaved
 
FConfigForgeSubsystemDelegate OnAllFilesLoaded
 
FConfigForgeSubsystemDelegate OnAllFilesSaved
 

Protected Member Functions

bool ReadFileInternal (TSubclassOf< UConfigPathProvider > InPathProviderClass, const FGuid &InId, UConfigForgeFile *InTemplate, UConfigForgeFileRuntime *&OutFile)
 Internal function that loads (and creates) a config file from disk.
 
bool WriteFileInternal (UConfigForgeFileRuntime *InFile)
 Internal function that writes a runtime file to disk.
 
bool LoadAllFilesInternal (const TArray< FConfigForgeFileData > &InDataArr, TArray< UConfigForgeFileRuntime * > &OutFiles)
 Internal helper that loads multiple config files from structured data into runtime objects.
 
bool WriteAllFilesInternal (const TArray< UConfigForgeFileRuntime * > &InFiles)
 Internal helper that writes multiple runtime config files to disk.
 

Protected Attributes

TMap< FGuid, TObjectPtr< UConfigForgeFileRuntime > > RuntimeFiles
 
FThreadSafeBool bOperatingFiles
 

Detailed Description

Game instance subsystem for managing configuration files and categories in the ConfigForge plugin.

UConfigForgeSubsystem provides a centralized interface for accessing and querying configuration data organized in a hierarchical structure of Files -> Categories -> Properties. It serves as the main API entry point for the ConfigForge system within a game instance.

The subsystem manages access to:

  • Developer settings and setup assets
  • Configuration file data and metadata
  • Category information within files
  • Property value objects within categories

Data Hierarchy

The ConfigForge system uses a three-level hierarchy:

  1. Files (UConfigForgeFile): Top-level containers identified by file names
  2. Categories (UConfigForgeCategory): Logical groupings within files, identified by FName
  3. Properties (UConfigValueObject): Individual configuration values within categories

Setup Requirements

Before using this subsystem, you must configure the setup asset in: Project Settings -> Config Forge -> 'ConfigSetup'

The setup asset (UConfigForgeSetup) must contain at least one file with valid categories and properties for the subsystem to function properly.

Usage Example

// Get the subsystem
UConfigForgeSubsystem* Subsystem = UGameInstance->GetSubsystem<UConfigForgeSubsystem>();
// Get all file names
TArray<FString> FileNames;
Subsystem->GetFileNames(FileNames);
// Get categories from a specific file
TArray<FName> Categories;
Subsystem->GetFileCategoriesByName("GameSettings", Categories);
// Get properties from a category
TArray<UConfigValueObject*> Properties;
Subsystem->GetCategoryProperties("GameSettings", "Graphics", Properties);
Game instance subsystem for managing configuration files and categories in the ConfigForge plugin.
Definition ConfigForgeSubsystem.h:97
void GetFileNames(TArray< FString > &OutNames) const
Retrieves the names of all configuration files in the setup asset.
Definition ConfigForgeSubsystem.cpp:87
void GetCategoryProperties(const FString &InFileName, const FName &InCategoryName, TArray< UConfigValueObject * > &OutProperties)
Retrieves all property value objects from a specific category within a file.
Definition ConfigForgeSubsystem.cpp:163
void GetFileCategoriesByName(const FString &InFileName, TArray< FName > &OutCategories)
Retrieves all category names from a file specified by name.
Definition ConfigForgeSubsystem.cpp:121

Thread Safety

This subsystem performs synchronous asset loading operations and should be called from the game thread only. All getter methods are const-correct but load assets synchronously, which may cause hitches if called frequently.

Logging

The subsystem uses the LogConfigForge logging category for all error and warning messages:

  • Errors: Invalid setup assets, missing files, missing categories
  • Warnings: Empty file lists, null file entries, empty categories
See also
UGameInstanceSubsystem
UConfigForgeSetup
UConfigForgeFile
UConfigForgeCategory
UConfigValueObject
FConfigForgeFileData
Author
Wellsaik
Date
01.01.2025

Member Function Documentation

◆ GetAllRuntimeFiles()

void UConfigForgeSubsystem::GetAllRuntimeFiles ( TArray< UConfigForgeFileRuntime * > & OutRuntimeFiles) const

Retrieves all runtime configuration files currently loaded in the subsystem.

Parameters
OutRuntimeFiles[out] Array that will be populated with pointers to all runtime files.
Note
The output array is cleared and repopulated with all valid runtime files.

◆ GetCategoryProperties()

void UConfigForgeSubsystem::GetCategoryProperties ( const FString & InFileName,
const FName & InCategoryName,
TArray< UConfigValueObject * > & OutProperties )

Retrieves all property value objects from a specific category within a file.

Looks up a file by name, finds the specified category within that file, and returns all configuration property value objects (Fields) defined in that category.

Parameters
InFileNameThe name of the file containing the category.
InCategoryNameThe name of the category to retrieve properties from.
OutProperties[out] Array to populate with property value objects. Will be emptied before population.
Note
Logs an error if the file is not found in the setup.
Logs an error if the specified category is not found in the file.
Only non-null property objects are added to the output array.
Early returns with empty array if file or category lookups fail.

◆ GetFile()

bool UConfigForgeSubsystem::GetFile ( const FString & InFileName,
FConfigForgeFileData & OutFileData ) const

Retrieves a specific configuration file by name.

Searches through all files in the setup asset and returns the file data matching the specified file name. The search is case-sensitive and performs a linear search through all available files.

Parameters
InFileNameThe name of the file to search for (must match exactly).
OutFileData[out] The file data structure to populate if found. Will be empty if file is not found.
Note
OutFileData will be reset to empty values before searching.
Only files with non-null File pointers are searched.
Returns
bool True if the file was found, false otherwise.

◆ GetFileCategories()

void UConfigForgeSubsystem::GetFileCategories ( const FConfigForgeFileData & InFileData,
TArray< FName > & OutCategories )

Retrieves all category names from a file data structure.

Extracts the names of all valid (non-null) categories from the provided file data. Only categories with valid pointers are included in the result.

Parameters
InFileDataThe file data structure containing categories to extract.
OutCategories[out] Array to populate with category names. Will be emptied before population.
Note
Logs an error if InFileData.File is null.
Logs a warning if the file contains no categories.
Only non-null category entries are added to the output array.

◆ GetFileCategoriesByName()

void UConfigForgeSubsystem::GetFileCategoriesByName ( const FString & InFileName,
TArray< FName > & OutCategories )

Retrieves all category names from a file specified by name.

Convenience function that first looks up the file by name, then extracts all category names from that file. This combines GetFile() and GetFileCategories() operations.

Parameters
InFileNameThe name of the file to retrieve categories from.
OutCategories[out] Array to populate with category names. Will be emptied before population.
Note
Logs an error if the specified file is not found in the setup asset.
OutCategories will be empty if the file is not found or has no categories.

◆ GetFileNames()

void UConfigForgeSubsystem::GetFileNames ( TArray< FString > & OutNames) const

Retrieves the names of all configuration files in the setup asset.

Extracts and returns only the file names from all valid files in the setup asset. This is more efficient than GetFiles() when only names are needed.

Parameters
OutNames[out] Array to populate with file names. Will be emptied before population.
Note
Logs an error if the setup asset is invalid or not configured.
Logs a warning if the setup asset contains no files.
Logs a warning for each null file entry encountered (with index).
Performs synchronous loading of the setup asset.

◆ GetFiles()

void UConfigForgeSubsystem::GetFiles ( TArray< FConfigForgeFileData > & OutFiles) const

Retrieves all valid configuration files from the setup asset.

Loads the setup asset synchronously and populates the output array with all files that have valid (non-null) File pointers. Null entries in the setup asset are automatically filtered out.

Note
Logs an error if the setup asset is invalid or not configured.
Logs a warning if the setup asset contains no files.
Performs synchronous loading of the setup asset.
Parameters
OutFiles[out] Array to populate with valid file data. Will be emptied before population.

◆ GetRuntimeCategories()

bool UConfigForgeSubsystem::GetRuntimeCategories ( const UConfigForgeFileRuntime * InConfigFile,
TArray< UConfigForgeCategoryRuntime * > & OutCategories ) const

Retrieves all categories from a specific runtime configuration file.

Parameters
InConfigFilePointer to the runtime configuration file to query.
OutCategories[out] Array that will be populated with pointers to all categories in the file.
Returns
True if categories were found, false if the file is invalid or contains no categories.

◆ GetRuntimeCategories_ID()

bool UConfigForgeSubsystem::GetRuntimeCategories_ID ( const FGuid & InFileId,
TArray< UConfigForgeCategoryRuntime * > & OutCategories ) const

Retrieves all categories from a runtime configuration file identified by its GUID.

Parameters
InFileIdThe unique identifier of the configuration file.
OutCategories[out] Array that will be populated with pointers to all categories in the file.
Returns
True if the file was found and categories were retrieved, false otherwise.

◆ GetRuntimeCategory()

bool UConfigForgeSubsystem::GetRuntimeCategory ( const UConfigForgeFileRuntime * InConfigFile,
const FName & InCategoryName,
UConfigForgeCategoryRuntime *& OutCategory ) const

Retrieves a specific category by name from a runtime configuration file.

Parameters
InConfigFilePointer to the runtime configuration file to query.
InCategoryNameThe name of the category to retrieve.
OutCategory[out] Pointer to the retrieved category if found.
Returns
True if the category was found, false if the file is invalid or the category doesn't exist.

◆ GetRuntimeCategory_ID()

bool UConfigForgeSubsystem::GetRuntimeCategory_ID ( const FGuid & InFileId,
const FName & InCategoryName,
UConfigForgeCategoryRuntime *& OutCategory ) const

Retrieves a specific category by name from a runtime configuration file identified by its GUID.

Parameters
InFileIdThe unique identifier of the configuration file.
InCategoryNameThe name of the category to retrieve.
OutCategory[out] Pointer to the retrieved category if found.
Returns
True if the file and category were found, false otherwise.

◆ GetRuntimeField()

bool UConfigForgeSubsystem::GetRuntimeField ( const UConfigForgeCategoryRuntime * InRuntimeCategory,
const FString & InKey,
UConfigValueObjectRuntime *& OutField ) const

Retrieves a specific field by key from a runtime category.

Parameters
InRuntimeCategoryPointer to the runtime category to query.
InKeyThe key identifier of the field to retrieve.
OutField[out] Pointer to the retrieved field value object if found.
Returns
True if the field was found, false if the category is invalid or the field doesn't exist.

◆ GetRuntimeField_File()

bool UConfigForgeSubsystem::GetRuntimeField_File ( const UConfigForgeFileRuntime * InConfigFile,
const FName & InCategoryName,
const FString & InKey,
UConfigValueObjectRuntime *& OutField ) const

Retrieves a specific field by key from a category within a runtime configuration file.

Parameters
InConfigFilePointer to the runtime configuration file to query.
InCategoryNameThe name of the category containing the field.
InKeyThe key identifier of the field to retrieve.
OutField[out] Pointer to the retrieved field value object if found.
Returns
True if the file, category, and field were found, false otherwise.

◆ GetRuntimeField_Full()

bool UConfigForgeSubsystem::GetRuntimeField_Full ( const FGuid & InFiledId,
const FName & InCategoryName,
const FString & InFieldName,
UConfigForgeFileRuntime *& OutFile,
UConfigForgeCategoryRuntime *& OutCategory,
UConfigValueObjectRuntime *& OutField ) const

Retrieves a runtime field by providing its file ID, category name, and field name.

This function performs a full lookup: first finding the file by ID, then the category within that file, and finally the specific field within the category. All three output pointers are set if successful.

Parameters
InFiledIdThe unique GUID of the config file containing the field.
InCategoryNameThe name of the category containing the field.
InFieldNameThe name of the field to retrieve.
OutFile[out] Pointer to the runtime file object if found (nullptr otherwise).
OutCategory[out] Pointer to the runtime category object if found (nullptr otherwise).
OutField[out] Pointer to the runtime field value object if found (nullptr otherwise).
Returns
true if the file, category, and field were all successfully found and are valid; false otherwise.
Note
This is a Blueprint-callable function (exposed as "Get Runtime Field").

◆ GetRuntimeField_ID()

bool UConfigForgeSubsystem::GetRuntimeField_ID ( const FGuid & InFileID,
const FName & InCategoryName,
const FString & InKey,
UConfigValueObjectRuntime *& OutField ) const

Retrieves a specific field by key from a category within a runtime configuration file identified by its GUID.

Parameters
InFileIDThe unique identifier of the configuration file.
InCategoryNameThe name of the category containing the field.
InKeyThe key identifier of the field to retrieve.
OutField[out] Pointer to the retrieved field value object if found.
Returns
True if the file, category, and field were found, false otherwise.

◆ GetRuntimeFields()

bool UConfigForgeSubsystem::GetRuntimeFields ( const UConfigForgeCategoryRuntime * InRuntimeCategory,
TArray< UConfigValueObjectRuntime * > & OutFields ) const

Retrieves all fields from a runtime category.

Parameters
InRuntimeCategoryPointer to the runtime category to query.
OutFields[out] Array that will be populated with pointers to all field value objects in the category.
Returns
True if the category is valid, false if the category pointer is null.
Note
Returns true even if the category contains no fields.

◆ GetRuntimeFields_File()

bool UConfigForgeSubsystem::GetRuntimeFields_File ( const UConfigForgeFileRuntime * InConfigFile,
const FName & InCategoryName,
TArray< UConfigValueObjectRuntime * > & OutFields ) const

Retrieves all fields from a category within a runtime configuration file.

Parameters
InConfigFilePointer to the runtime configuration file to query.
InCategoryNameThe name of the category containing the fields.
OutFields[out] Array that will be populated with pointers to all field value objects in the category.
Returns
True if the file and category were found, false otherwise.

◆ GetRuntimeFields_ID()

bool UConfigForgeSubsystem::GetRuntimeFields_ID ( const FGuid & InFileID,
const FName & InCategoryName,
TArray< UConfigValueObjectRuntime * > & OutFields ) const

Retrieves all fields from a category within a runtime configuration file identified by its GUID.

Parameters
InFileIDThe unique identifier of the configuration file.
InCategoryNameThe name of the category containing the fields.
OutFields[out] Array that will be populated with pointers to all field value objects in the category.
Returns
True if the file and category were found, false otherwise.

◆ GetRuntimeFile()

bool UConfigForgeSubsystem::GetRuntimeFile ( const FGuid & InUniqueFileId,
UConfigForgeFileRuntime *& OutRuntimeFile ) const

Retrieves a loaded runtime file instance by its unique ID.

Searches the internal RuntimeFiles map for a valid UConfigForgeFileRuntime object associated with the given InUniqueFileId.

Parameters
InUniqueFileIdThe unique GUID of the file to retrieve.
OutRuntimeFile[out] Pointer to the runtime file object if found and valid.
Returns
true if a valid runtime file was found and returned; false otherwise (file not loaded, invalid pointer, or data not valid via IsValidData()).

◆ GetSettings()

const UConfigForgeDeveloperSettings * UConfigForgeSubsystem::GetSettings ( ) const

Gets the developer settings for the ConfigForge system.

Retrieves the default instance of UConfigForgeDeveloperSettings from the project settings. This provides access to the plugin's configuration options.

Note
Never returns null as it always returns the default object.
Returns
const UConfigForgeDeveloperSettings* Pointer to the default developer settings instance.

◆ GetSetupAsset()

TSoftObjectPtr< UConfigForgeSetup > UConfigForgeSubsystem::GetSetupAsset ( ) const

Retrieves the setup asset reference from developer settings.

Returns a soft object pointer to the UConfigForgeSetup asset that is configured in Project Settings -> Config Forge -> 'ConfigSetup'. This asset contains all file and category configurations for the system.

Note
May be invalid if not configured in project settings.
Returns
TSoftObjectPtr<UConfigForgeSetup> Soft reference to the setup asset.

◆ IsOperatingFiles()

FORCEINLINE bool UConfigForgeSubsystem::IsOperatingFiles ( ) const
inline

Checks whether a file load/save operation is currently in progress.

Used to prevent concurrent operations on the subsystem (reentrancy protection).

Returns
true if a file operation is active.

◆ LoadAllFiles()

bool UConfigForgeSubsystem::LoadAllFiles ( TArray< UConfigForgeFileRuntime * > & OutFiles)

Loads all configuration files synchronously.

Clears the output array and attempts to load every file defined in the ConfigForge setup asset. The files are loaded into runtime objects (UConfigForgeFileRuntime*) that hold the parsed data.

Parameters
OutFiles[out] Array that will be populated with pointers to the loaded runtime file objects. The caller is responsible for managing the lifetime of these objects (they are owned by the subsystem).
Returns
true if all files were successfully loaded, false otherwise (e.g., setup missing or already operating).
Note
This is a BlueprintCallable function.
This function blocks the calling thread until completion.
If another load/save operation is already in progress (bOperatingFiles == true), the function returns false immediately.

◆ LoadAllFilesAsync()

void UConfigForgeSubsystem::LoadAllFilesAsync ( FLoadAllForgeFileDelegate Callback)

Loads all configuration files asynchronously.

Starts an asynchronous task on the task graph to load all files. When complete, the provided delegate is executed on the game thread with the results.

Parameters
CallbackDelegate called when the operation finishes. Signature: void(bool bSuccess, const TArray<UConfigForgeFileRuntime*>& LoadedFiles)
Note
If another load/save operation is already in progress or the setup is invalid, the callback is invoked immediately with failure.
The runtime file objects in the result array are owned by the subsystem.

◆ LoadAllFilesInternal()

bool UConfigForgeSubsystem::LoadAllFilesInternal ( const TArray< FConfigForgeFileData > & InDataArr,
TArray< UConfigForgeFileRuntime * > & OutFiles )
protected

Internal helper that loads multiple config files from structured data into runtime objects.

Iterates over the provided array of file data and attempts to read each file using ReadFileInternal. Successfully loaded runtime files are added to OutFiles.

Parameters
InDataArrArray of file metadata and content to load.
OutFiles[out] Array of successfully created runtime file objects.
Returns
true if all files were loaded successfully; false if any failed (partial success still populates OutFiles).

◆ LoadSelectedFiles()

bool UConfigForgeSubsystem::LoadSelectedFiles ( const TArray< FConfigForgeFileData > & InFiles,
TArray< UConfigForgeFileRuntime * > & OutFiles )

Synchronously loads a selected subset of config files into runtime objects.

This is a thread-safe wrapper around LoadAllFilesInternal that prevents concurrent file operations via the bOperatingFiles flag.

Parameters
InFilesArray of file data describing which files to load.
OutFiles[out] Array of loaded runtime file objects (empty on failure).
Returns
true if loading completed successfully; false if already operating on files or if loading failed.
Note
Blueprint callable.

◆ LoadSelectedFilesAsync()

void UConfigForgeSubsystem::LoadSelectedFilesAsync ( const TArray< FConfigForgeFileData > & InFiles,
FLoadAllForgeFileDelegate Callback )

Asynchronously loads a selected subset of config files into runtime objects.

Runs the loading process on the task graph thread and executes the provided callback on the game thread when complete. Prevents concurrent operations using bOperatingFiles.

If a file operation is already in progress, the callback is immediately invoked with failure.

Parameters
InFilesArray of file data describing which files to load.
CallbackDelegate called on the game thread when loading finishes. Parameters: (bool bSuccess, TArray<UConfigForgeFileRuntime*> LoadedFiles).

◆ LoadSingleFile()

bool UConfigForgeSubsystem::LoadSingleFile ( const FConfigForgeFileData & InFileData,
UConfigForgeFileRuntime *& OutFile )

Synchronously loads a single config file from disk.

Blocks the calling thread and uses ReadFileInternal(). Fails immediately if another operation is already in progress (bOperatingFiles == true).

Parameters
InFileDataStructure containing the path provider class, file ID, and template asset.
OutFile[out] The loaded runtime file object on success.
Returns
true if the file was successfully loaded/created.

◆ LoadSingleFileAsync()

void UConfigForgeSubsystem::LoadSingleFileAsync ( const FConfigForgeFileData & InFileData,
FLoadForgeFileDelegate Callback )

Asynchronously loads a single config file from disk.

Runs the heavy I/O on the task graph thread and delivers the result back on the game thread. If another operation is in progress, the callback is called immediately with failure.

Parameters
InFileDataStructure containing the path provider class, file ID, and template asset.
CallbackDelegate called on the game thread with success flag and runtime file (or nullptr).

◆ ReadFileInternal()

bool UConfigForgeSubsystem::ReadFileInternal ( TSubclassOf< UConfigPathProvider > InPathProviderClass,
const FGuid & InId,
UConfigForgeFile * InTemplate,
UConfigForgeFileRuntime *& OutFile )
protected

Internal function that loads (and creates) a config file from disk.

This is the core implementation used by both synchronous and asynchronous load functions. It:

  • Creates the directory tree if it doesn't exist
  • Creates a new UConfigForgeFileRuntime instance
  • Initializes it with default values from the template asset
  • Replaces any previously loaded file with the same ID
  • Attempts to read data from disk; if that fails or file doesn't exist, saves defaults
Parameters
InPathProviderClassClass of the path provider determining where to read/write.
InIdUnique ID of the file to assign map key.
InTemplateTemplate asset containing metadata (e.g., FileName) and default values.
OutFile[out] The created/loaded runtime file object on success.
Returns
true if the file was successfully set up and OutFile is valid.

◆ SaveAllFiles()

bool UConfigForgeSubsystem::SaveAllFiles ( )

Saves all currently loaded runtime configuration files synchronously.

Retrieves all runtime file objects currently managed by the subsystem and writes them to disk.

Returns
true if all files were successfully saved, false otherwise (e.g., no files loaded, or another operation already in progress).
Note
This is a BlueprintCallable function.
This function blocks the calling thread until completion.

◆ SaveAllFilesAsync()

void UConfigForgeSubsystem::SaveAllFilesAsync ( FSaveAllForgeFileDelegate Callback)

Saves all currently loaded runtime configuration files asynchronously.

Starts an asynchronous task on the task graph to save all managed runtime files. When complete, the provided delegate is executed on the game thread.

Parameters
CallbackDelegate called when the operation finishes. Signature: void(bool bSuccess)
Note
If no files are loaded or another operation is already in progress, the callback is invoked immediately with failure.

◆ SaveSelectedFiles() [1/2]

bool UConfigForgeSubsystem::SaveSelectedFiles ( const TArray< FGuid > & InFiles)

Synchronously saves the specified files to disk.

Saves all valid files from the provided GUID array. Operation is performed immediately on the calling thread (usually game thread).

Note
This function blocks until all file operations are complete
If any file operation fails, function still tries to save remaining files
Parameters
InFilesArray of file GUIDs to save
Returns
true if all file write operations were successful, false otherwise (or if no files were valid / operation was already in progress)
See also
SaveSelectedFiles(const TArray<FGuid>&, FSaveSelectedForgeFileDelegate)
OnFileSaved

◆ SaveSelectedFiles() [2/2]

void UConfigForgeSubsystem::SaveSelectedFiles ( const TArray< FGuid > & InFiles,
FSaveSelectedForgeFileDelegate Callback )

Asynchronously saves the specified files and calls delegate upon completion.

Performs file saving on a background thread. After all operations are finished, broadcasts OnFileSaved for each file and executes the provided callback on the game thread.

Note
If operation is already in progress (bOperatingFiles == true), callback is immediately executed with success = false
If input array is empty or contains no valid files, callback is immediately executed with success = false
Parameters
InFilesArray of file GUIDs to save
CallbackDelegate that will be called on game thread when operation completes Signature: void(bool bSuccess, const TArray<UConfigForgeFileRuntime*>& SavedFiles)
See also
SaveSelectedFiles(const TArray<FGuid>&)
OnFileSaved
FSaveSelectedForgeFileDelegate

◆ SaveSingleFile()

bool UConfigForgeSubsystem::SaveSingleFile ( const FGuid & InFileUniqueID)

Synchronously saves a single loaded config file to disk.

Looks up the runtime file by ID, then calls WriteFileInternal(). Fails immediately if another operation is in progress or the file is not loaded.

Parameters
InFileUniqueIDThe unique ID of the file to save.
Returns
true if the file was successfully written to disk.

◆ SaveSingleFileAsync()

void UConfigForgeSubsystem::SaveSingleFileAsync ( const FGuid & InFileUniqueID,
FSaveForgeFileDelegate Callback )

Asynchronously saves a single loaded config file to disk.

Runs the save operation on the task graph thread and reports back on the game thread. If another operation is in progress or the file is not loaded, the callback is called immediately with failure.

Parameters
InFileUniqueIDThe unique ID of the file to save.
CallbackDelegate called on the game thread with success flag.

◆ WriteAllFilesInternal()

bool UConfigForgeSubsystem::WriteAllFilesInternal ( const TArray< UConfigForgeFileRuntime * > & InFiles)
protected

Internal helper that writes multiple runtime config files to disk.

Iterates over the provided runtime files and calls WriteFileInternal on each valid one.

Parameters
InFilesArray of runtime file objects to write.
Returns
true if all valid files were written successfully; false if any write operation failed.

◆ WriteFileInternal()

bool UConfigForgeSubsystem::WriteFileInternal ( UConfigForgeFileRuntime * InFile)
protected

Internal function that writes a runtime file to disk.

Ensures the directory and file exist, then calls SaveTo() on the runtime file. Note: The current implementation has a bug — it calls ReadFrom() instead of SaveTo(). This function is intended to save the in-memory data to disk.

Parameters
InFileThe runtime file to write.
Returns
true if all preconditions passed and the save operation succeeded.

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