UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FConfigFile Class Reference

#include <ConfigCacheIni.h>

+ Inheritance diagram for FConfigFile:

Public Types

using SectionType = FConfigSection
 

Public Member Functions

CORE_API FConfigFile ()
 
 FConfigFile (int32)
 
CORE_API ~FConfigFile ()
 
CORE_API FConfigFile (const FConfigFile &Other)
 
CORE_API FConfigFile (FConfigFile &&Other)
 
CORE_API FConfigFileoperator= (const FConfigFile &Other)
 
CORE_API FConfigFileoperator= (FConfigFile &&Other)
 
CORE_API const FConfigSectionFindOrAddConfigSection (const FString &Name)
 
const FConfigSectionFindSection (const FString &SectionName) const
 
int32 Num () const
 
bool IsEmpty () const
 
void Empty (int32 ExpectedNumElements=0)
 
bool Contains (const FString &SectionName) const
 
int32 GetKeys (TArray< FString > &Keys) const
 
int32 GetKeys (TSet< FString > &Keys) const
 
int32 Remove (KeyConstPointerType InKey)
 
ValueType & Add (const KeyType &InKey, const ValueType &InValue)
 
ValueType & Add (const KeyType &InKey, ValueType &&InValue)
 
ValueType & Add (KeyType &&InKey, const ValueType &InValue)
 
ValueType & Add (KeyType &&InKey, ValueType &&InValue)
 
void Append (TMap< FString, FConfigSection > Other)
 
void Reset ()
 
TRangedForConstIterator begin () const
 
TRangedForConstIterator end () const
 
bool operator== (const FConfigFile &Other) const
 
bool operator!= (const FConfigFile &Other) const
 
CORE_API bool Combine (const FString &Filename)
 
CORE_API void CombineFromBuffer (const FString &Buffer, const FString &FileHint)
 
CORE_API void Read (const FString &Filename)
 
CORE_API bool ApplyFile (const FConfigCommandStream *File)
 
CORE_API bool Write (const FString &Filename, bool bDoRemoteWrite=true, const FString &PrefixText=FString())
 
CORE_API void WriteToString (FString &InOutText, const FString &SimulatedFilename=FString(), const FString &PrefixText=FString())
 
CORE_API void Dump (FOutputDevice &Ar)
 
bool GetString (const TCHAR *Section, const TCHAR *Key, FString &Value) const
 
bool GetText (const TCHAR *Section, const TCHAR *Key, FText &Value) const
 
bool GetInt (const TCHAR *Section, const TCHAR *Key, int32 &Value) const
 
bool GetUInt (const TCHAR *Section, const TCHAR *Key, uint32 &Value) const
 
bool GetFloat (const TCHAR *Section, const TCHAR *Key, float &Value) const
 
bool GetDouble (const TCHAR *Section, const TCHAR *Key, double &Value) const
 
bool GetInt64 (const TCHAR *Section, const TCHAR *Key, int64 &Value) const
 
bool GetBool (const TCHAR *Section, const TCHAR *Key, bool &Value) const
 
CORE_API int32 GetArray (const TCHAR *Section, const TCHAR *Key, TArray< FString > &Value) const
 
bool GetValue (const TCHAR *Section, const TCHAR *Key, FString &Value) const
 
bool GetValue (const TCHAR *Section, const TCHAR *Key, FText &Value) const
 
bool GetValue (const TCHAR *Section, const TCHAR *Key, int32 &Value) const
 
bool GetValue (const TCHAR *Section, const TCHAR *Key, float &Value) const
 
bool GetValue (const TCHAR *Section, const TCHAR *Key, double &Value) const
 
bool GetValue (const TCHAR *Section, const TCHAR *Key, int64 &Value) const
 
bool GetValue (const TCHAR *Section, const TCHAR *Key, bool &Value) const
 
int32 GetValue (const TCHAR *Section, const TCHAR *Key, TArray< FString > &Value) const
 
CORE_API bool DoesSectionExist (const TCHAR *Section) const
 
CORE_API void SetString (const TCHAR *Section, const TCHAR *Key, const TCHAR *Value)
 
CORE_API void SetText (const TCHAR *Section, const TCHAR *Key, const FText &Value)
 
CORE_API void SetFloat (const TCHAR *Section, const TCHAR *Key, float Value)
 
CORE_API void SetDouble (const TCHAR *Section, const TCHAR *Key, double Value)
 
CORE_API void SetBool (const TCHAR *Section, const TCHAR *Key, bool Value)
 
CORE_API void SetInt64 (const TCHAR *Section, const TCHAR *Key, const int64 Value)
 
CORE_API void SetArray (const TCHAR *Section, const TCHAR *Key, const TArray< FString > &Value)
 
CORE_API bool SetInSection (const TCHAR *SectionName, FName Key, const FString &Value)
 
CORE_API bool AddToSection (const TCHAR *Section, FName Key, const FString &Value)
 
CORE_API bool AddUniqueToSection (const TCHAR *Section, FName Key, const FString &Value)
 
CORE_API bool RemoveKeyFromSection (const TCHAR *Section, FName Key)
 
CORE_API bool RemoveFromSection (const TCHAR *Section, FName Key, const FString &Value)
 
CORE_API bool ResetKeyInSection (const TCHAR *Section, FName Key)
 
CORE_API void ProcessInputFileContents (FStringView Contents, const FString &FileHint)
 
CORE_API void AddMissingProperties (const FConfigFile &InSourceFile)
 
CORE_API void UpdateSections (const TCHAR *DiskFilename, const TCHAR *IniRootName=nullptr, const TCHAR *OverridePlatform=nullptr)
 
CORE_API bool UpdateSinglePropertyInSection (const TCHAR *DiskFilename, const TCHAR *PropertyName, const TCHAR *SectionName)
 
void ProcessSourceAndCheckAgainstBackup ()
 
CORE_API void AddDynamicLayerToHierarchy (const FString &Filename)
 

Static Public Member Functions

static CORE_API bool WriteTempFileThenMove ()
 
static bool ShouldExportQuotedString (const FString &PropertyValue)
 
static FString GenerateExportedPropertyLine (const FString &PropertyName, const FString &PropertyValue)
 
static void AppendExportedPropertyLine (FString &Out, const FString &PropertyName, const FString &PropertyValue)
 
static CORE_API void OverrideFromCommandline (FConfigFile *File, const FString &Filename)
 
static CORE_API void OverrideFromCommandline (FConfigCommandStream *File, const FString &Filename)
 
static CORE_API bool OverrideFileFromCommandline (FString &Filename)
 

Public Attributes

bool Dirty: 1
 
bool NoSave: 1
 
bool bHasPlatformName: 1
 
bool bPythonConfigParserMode: 1
 
bool bCanSaveAllSections: 1
 
FName Name
 
FString PlatformName
 
FName Tag
 
class FConfigBranchBranch = nullptr
 
TArray< FConfigCommandlineOverrideCommandlineOptions
 

Friends

class FConfigBranch
 
class FConfigCacheIni
 
template<typename FileType >
void FillFileFromBuffer (FileType *File, FStringView Buffer, bool bHandleSymbolCommands, const FString &FileHint)
 
FArchiveoperator<< (FArchive &Ar, FConfigFile &ConfigFile)
 

Member Typedef Documentation

◆ SectionType

Constructor & Destructor Documentation

◆ FConfigFile() [1/4]

FConfigFile::FConfigFile ( )

◆ FConfigFile() [2/4]

FConfigFile::FConfigFile ( int32  )
inline

◆ ~FConfigFile()

FConfigFile::~FConfigFile ( )

◆ FConfigFile() [3/4]

FConfigFile::FConfigFile ( const FConfigFile Other)

◆ FConfigFile() [4/4]

FConfigFile::FConfigFile ( FConfigFile &&  Other)

Member Function Documentation

◆ Add() [1/4]

ValueType & FConfigFile::Add ( const KeyType &  InKey,
const ValueType &  InValue 
)
inline

◆ Add() [2/4]

ValueType & FConfigFile::Add ( const KeyType &  InKey,
ValueType &&  InValue 
)
inline

◆ Add() [3/4]

ValueType & FConfigFile::Add ( KeyType &&  InKey,
const ValueType &  InValue 
)
inline

◆ Add() [4/4]

ValueType & FConfigFile::Add ( KeyType &&  InKey,
ValueType &&  InValue 
)
inline

◆ AddDynamicLayerToHierarchy()

CORE_API void FConfigFile::AddDynamicLayerToHierarchy ( const FString &  Filename)

Appends a new INI file to the SourceIniHierarchy and combines it with the current contents

◆ AddMissingProperties()

void FConfigFile::AddMissingProperties ( const FConfigFile InSourceFile)

Adds any properties that exist in InSourceFile that this config file is missing

◆ AddToSection()

bool FConfigFile::AddToSection ( const TCHAR Section,
FName  Key,
const FString &  Value 
)

Adds the given key/value pair to the Section. This will always add this pair to the section, even if the pair already exists. This is equivalent to the . operator in .ini files

Returns
true if the section was modified

◆ AddUniqueToSection()

bool FConfigFile::AddUniqueToSection ( const TCHAR Section,
FName  Key,
const FString &  Value 
)

Adds the given key/value pair to the Section, if the pair didn't already exist This is equivalent to the + operator in .ini files

Returns
true if the section was modified

◆ Append()

void FConfigFile::Append ( TMap< FString, FConfigSection Other)
inline

◆ AppendExportedPropertyLine()

void FConfigFile::AppendExportedPropertyLine ( FString &  Out,
const FString &  PropertyName,
const FString &  PropertyValue 
)
static

Append a correctly escaped line to add to the config file for the given property

◆ ApplyFile()

bool FConfigFile::ApplyFile ( const FConfigCommandStream File)

Apply the contents of the given file (which must have non-Combined ValueTypes stored in it, it is a logic error otherwise and will assert) The values in this file will be Combined type

◆ begin()

TRangedForConstIterator FConfigFile::begin ( ) const
inline

◆ Combine()

bool FConfigFile::Combine ( const FString &  Filename)

◆ CombineFromBuffer()

void FConfigFile::CombineFromBuffer ( const FString &  Buffer,
const FString &  FileHint 
)

◆ Contains()

bool FConfigFile::Contains ( const FString &  SectionName) const
inline

◆ DoesSectionExist()

bool FConfigFile::DoesSectionExist ( const TCHAR Section) const

◆ Dump()

void FConfigFile::Dump ( FOutputDevice Ar)

◆ Empty()

void FConfigFile::Empty ( int32  ExpectedNumElements = 0)
inline

◆ end()

TRangedForConstIterator FConfigFile::end ( ) const
inline

◆ FindOrAddConfigSection()

const FConfigSection * FConfigFile::FindOrAddConfigSection ( const FString &  Name)

◆ FindSection()

const FConfigSection * FConfigFile::FindSection ( const FString &  SectionName) const
inline

◆ GenerateExportedPropertyLine()

FString FConfigFile::GenerateExportedPropertyLine ( const FString &  PropertyName,
const FString &  PropertyValue 
)
static

Generate a correctly escaped line to add to the config file for the given property

◆ GetArray()

int32 FConfigFile::GetArray ( const TCHAR Section,
const TCHAR Key,
TArray< FString > &  Value 
) const

◆ GetBool()

bool FConfigFile::GetBool ( const TCHAR Section,
const TCHAR Key,
bool Value 
) const
inline

◆ GetDouble()

bool FConfigFile::GetDouble ( const TCHAR Section,
const TCHAR Key,
double Value 
) const
inline

◆ GetFloat()

bool FConfigFile::GetFloat ( const TCHAR Section,
const TCHAR Key,
float Value 
) const
inline

◆ GetInt()

bool FConfigFile::GetInt ( const TCHAR Section,
const TCHAR Key,
int32 Value 
) const
inline

◆ GetInt64()

bool FConfigFile::GetInt64 ( const TCHAR Section,
const TCHAR Key,
int64 Value 
) const
inline

◆ GetKeys() [1/2]

int32 FConfigFile::GetKeys ( TArray< FString > &  Keys) const
inline

◆ GetKeys() [2/2]

int32 FConfigFile::GetKeys ( TSet< FString > &  Keys) const
inline

◆ GetString()

bool FConfigFile::GetString ( const TCHAR Section,
const TCHAR Key,
FString &  Value 
) const
inline

◆ GetText()

bool FConfigFile::GetText ( const TCHAR Section,
const TCHAR Key,
FText Value 
) const
inline

◆ GetUInt()

bool FConfigFile::GetUInt ( const TCHAR Section,
const TCHAR Key,
uint32 Value 
) const
inline

◆ GetValue() [1/8]

bool FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
bool Value 
) const
inline

◆ GetValue() [2/8]

bool FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
double Value 
) const
inline

◆ GetValue() [3/8]

bool FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
float Value 
) const
inline

◆ GetValue() [4/8]

bool FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
FString &  Value 
) const
inline

◆ GetValue() [5/8]

bool FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
FText Value 
) const
inline

◆ GetValue() [6/8]

bool FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
int32 Value 
) const
inline

◆ GetValue() [7/8]

bool FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
int64 Value 
) const
inline

◆ GetValue() [8/8]

int32 FConfigFile::GetValue ( const TCHAR Section,
const TCHAR Key,
TArray< FString > &  Value 
) const
inline

◆ IsEmpty()

bool FConfigFile::IsEmpty ( ) const
inline

◆ Num()

int32 FConfigFile::Num ( ) const
inline

◆ operator!=()

bool FConfigFile::operator!= ( const FConfigFile Other) const

◆ operator=() [1/2]

FConfigFile & FConfigFile::operator= ( const FConfigFile Other)

◆ operator=() [2/2]

FConfigFile & FConfigFile::operator= ( FConfigFile &&  Other)

◆ operator==()

bool FConfigFile::operator== ( const FConfigFile Other) const

◆ OverrideFileFromCommandline()

static CORE_API bool FConfigFile::OverrideFileFromCommandline ( FString &  Filename)
static

Checks the command line for any overridden config file settings

◆ OverrideFromCommandline() [1/2]

void FConfigFile::OverrideFromCommandline ( FConfigCommandStream File,
const FString &  Filename 
)
static

Looks for any overrides on the commandline for this file

Parameters
FileConfig to possibly modify
FilenameName of the .ini file to look for overrides

◆ OverrideFromCommandline() [2/2]

void FConfigFile::OverrideFromCommandline ( FConfigFile File,
const FString &  Filename 
)
static

Checks the command line for any overridden config settings

◆ ProcessInputFileContents()

void FConfigFile::ProcessInputFileContents ( FStringView  Contents,
const FString &  FileHint 
)

Process the contents of an .ini file that has been read into an FString

Parameters
FilenameName of the .ini file the contents came from
ContentsContents of the .ini file

Process the contents of an .ini file that has been read into an FString

Parameters
ContentsContents of the .ini file

◆ ProcessSourceAndCheckAgainstBackup()

void FConfigFile::ProcessSourceAndCheckAgainstBackup ( )

Check the source hierarchy which was loaded without any user changes from the Config/Saved dir. If anything in the default/base options have changed, we need to ensure that these propagate through to the final config so they are not potentially ignored

◆ Read()

void FConfigFile::Read ( const FString &  Filename)

◆ Remove()

int32 FConfigFile::Remove ( KeyConstPointerType  InKey)
inline

◆ RemoveFromSection()

bool FConfigFile::RemoveFromSection ( const TCHAR Section,
FName  Key,
const FString &  Value 
)

Removes every entry in the Section that has the Key/Value pair This is equivalent to the - operator in .ini files (although it will remove all instances of the pair, not just a single one)

Returns
true if the section was modified

◆ RemoveKeyFromSection()

bool FConfigFile::RemoveKeyFromSection ( const TCHAR Section,
FName  Key 
)

Removes every entry in the Section that has Key, no matter what the Value is This is equivalent to the ! operator in .ini files

Returns
true if the section was modified

◆ Reset()

void FConfigFile::Reset ( )
inline

◆ ResetKeyInSection()

bool FConfigFile::ResetKeyInSection ( const TCHAR Section,
FName  Key 
)

Similar to RemvoeKeyFromSection, but if this File's changes are being tracked, then we remove all changes to the the key that have been tracked. This would be used to remove enries in a layer so that the values from previous layers are used, unmodified. "Reset To Defaults" This is equivalent to deleting the keys from a .ini file

Returns
true if the section was modified

◆ SetArray()

void FConfigFile::SetArray ( const TCHAR Section,
const TCHAR Key,
const TArray< FString > &  Value 
)

◆ SetBool()

void FConfigFile::SetBool ( const TCHAR Section,
const TCHAR Key,
bool  Value 
)

◆ SetDouble()

void FConfigFile::SetDouble ( const TCHAR Section,
const TCHAR Key,
double  Value 
)

◆ SetFloat()

void FConfigFile::SetFloat ( const TCHAR Section,
const TCHAR Key,
float  Value 
)

◆ SetInSection()

bool FConfigFile::SetInSection ( const TCHAR SectionName,
FName  Key,
const FString &  Value 
)

Sets the given key/value pair to the Section in the given File. This will replace any existing values (as if ResetKeyInSection had been called)

Returns
true if the section was modified

◆ SetInt64()

void FConfigFile::SetInt64 ( const TCHAR Section,
const TCHAR Key,
const int64  Value 
)

◆ SetString()

void FConfigFile::SetString ( const TCHAR Section,
const TCHAR Key,
const TCHAR Value 
)

◆ SetText()

void FConfigFile::SetText ( const TCHAR Section,
const TCHAR Key,
const FText Value 
)

◆ ShouldExportQuotedString()

bool FConfigFile::ShouldExportQuotedString ( const FString &  PropertyValue)
static

Checks if the PropertyValue should be exported in quotes when writing the ini to disk.

◆ UpdateSections()

void FConfigFile::UpdateSections ( const TCHAR DiskFilename,
const TCHAR IniRootName = nullptr,
const TCHAR OverridePlatform = nullptr 
)

Saves only the sections in this FConfigFile into the given file. All other sections in the file are left alone. The sections in this file are completely replaced. If IniRootName is specified, the current section settings are diffed against the file in the hierarchy up to right before this file (so, if you are saving DefaultEngine.ini, and IniRootName is "Engine", then Base.ini and BaseEngine.ini will be loaded, and only differences against that will be saved into DefaultEngine.ini)


@todo: This currently doesn't work with array properties!! It will output the entire array, and without + notation!!

Parameters
IniRootNamethe name (like "Engine") to use to load a .ini hierarchy to diff against

◆ UpdateSinglePropertyInSection()

bool FConfigFile::UpdateSinglePropertyInSection ( const TCHAR DiskFilename,
const TCHAR PropertyName,
const TCHAR SectionName 
)

Update a single property in the config file, for the section that is specified.

◆ Write()

bool FConfigFile::Write ( const FString &  Filename,
bool  bDoRemoteWrite = true,
const FString &  PrefixText = FString() 
)

Write this ConfigFile to the given Filename, constructed the text from the config sections in *this, prepended by the optional PrefixText

◆ WriteTempFileThenMove()

bool FConfigFile::WriteTempFileThenMove ( )
static

Whether to write a temp file then move it to it's destination when saving.

◆ WriteToString()

void FConfigFile::WriteToString ( FString &  InOutText,
const FString &  SimulatedFilename = FString(),
const FString &  PrefixText = FString() 
)

Write this ConfigFile to the given string, constructed the text from the config sections in *this, prepended by the optional PrefixText

Parameters
SimulatedFilename- If writing a default hierarchal ini, can be used to correctly deduce position in the hierarchy

Friends And Related Symbol Documentation

◆ FConfigBranch

friend class FConfigBranch
friend

◆ FConfigCacheIni

friend class FConfigCacheIni
friend

◆ FillFileFromBuffer

template<typename FileType >
void FillFileFromBuffer ( FileType *  File,
FStringView  Buffer,
bool  bHandleSymbolCommands,
const FString &  FileHint 
)
friend

◆ operator<<

FArchive & operator<< ( FArchive Ar,
FConfigFile ConfigFile 
)
friend

Member Data Documentation

◆ bCanSaveAllSections

bool FConfigFile::bCanSaveAllSections

◆ bHasPlatformName

bool FConfigFile::bHasPlatformName

◆ bPythonConfigParserMode

bool FConfigFile::bPythonConfigParserMode

◆ Branch

class FConfigBranch* FConfigFile::Branch = nullptr

◆ CommandlineOptions

TArray<FConfigCommandlineOverride> FConfigFile::CommandlineOptions

The collection of overrides which stemmed from the commandline

◆ Dirty

bool FConfigFile::Dirty

◆ Name

FName FConfigFile::Name

The name of this config file

◆ NoSave

bool FConfigFile::NoSave

◆ PlatformName

FString FConfigFile::PlatformName

◆ Tag

FName FConfigFile::Tag

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