2022-03-09 07:10:46 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
# pragma once
# include "Containers/Map.h"
# include "Containers/StringFwd.h"
# include "Containers/UnrealString.h"
2022-07-20 12:03:45 -04:00
class FString ;
2022-03-09 07:10:46 -05:00
class SOURCECONTROL_API FSourceControlInitSettings
{
public :
enum class EBehavior
{
/** All existing settings will be overridden via the contents of FSourceControlInitSettings. Settings that are not found will be reset to default states */
OverrideAll ,
2022-09-23 20:05:59 -04:00
/** Only the settings found in FSourceControlInitSettings will be overridden. Settings not found will be left with their current values. */
2022-03-09 07:10:46 -05:00
OverrideExisting ,
} ;
2024-04-16 11:05:04 -04:00
enum class ECmdLineFlags : uint8
{
/** Do not read any settings from the commandline */
None ,
/** Read all available settings from the commandline */
ReadAll
} ;
enum class EConfigBehavior : uint8
2022-09-23 20:05:59 -04:00
{
/** Can both read from, and save to the ini file*/
ReadWrite ,
/** Will only read settings from the ini file, settings determined at runtime will not be saved to the ini file */
ReadOnly ,
/** The settings will not be saved to the ini file, nor will they be read from the ini file */
None
} ;
2022-03-09 07:10:46 -05:00
FSourceControlInitSettings ( EBehavior Behavior ) ;
2024-04-16 11:05:04 -04:00
FSourceControlInitSettings ( EBehavior Behavior , ECmdLineFlags CmdLineFlags ) ;
2022-03-09 07:10:46 -05:00
~ FSourceControlInitSettings ( ) = default ;
2022-09-23 20:05:59 -04:00
void SetConfigBehavior ( EConfigBehavior Behavior ) ;
bool CanWriteToConfigFile ( ) const ;
bool CanReadFromConfigFile ( ) const ;
2022-03-09 07:10:46 -05:00
void AddSetting ( FStringView SettingName , FStringView SettingValue ) ;
void OverrideSetting ( FStringView SettingName , FString & InOutSettingValue ) ;
bool HasOverrides ( ) const ;
bool IsOverridden ( FStringView SettingName ) const ;
2022-09-23 20:05:59 -04:00
2024-04-16 11:05:04 -04:00
void SetCmdLineFlags ( ECmdLineFlags Flags ) ;
bool ShouldReadFromCmdLine ( ) const ;
2022-03-09 07:10:46 -05:00
private :
2022-09-23 20:05:59 -04:00
2024-04-16 11:05:04 -04:00
EBehavior OverrideBehavior = EBehavior : : OverrideAll ;
ECmdLineFlags CmdLineFlags = ECmdLineFlags : : None ;
EConfigBehavior ConfigBehavior = EConfigBehavior : : ReadWrite ;
2022-03-09 07:10:46 -05:00
TMap < FString , FString > Settings ;
} ;