The Utility interface provides utility functions. It looks like this:
class UIMGUI_PUBLIC_API Utility
{
public:
typedef TArray<std::pair<FString, FString>, Keys_COUNT> KeyStringsArrType;
static FString loadFileToString(const FString& location) noexcept;
static void sanitiseFilepath(FString& str) noexcept;
static void keyToText(FString& text, CKeys key, bool bLong) noexcept;
static FString keyToText(CKeys key, bool bLong) noexcept;
static void keyToText(FString& text, const InputAction& action, bool bLong) noexcept;
static FString keyToText(const InputAction& action, bool bLong) noexcept;
static TVector<FString> splitString(const FString& str, String token) noexcept;
static void removeConsole() noexcept;
static FString toLower(String str) noexcept;
static void toLower(FString& str) noexcept;
static FString toUpper(String str) noexcept;
static void toUpper(FString& str) noexcept;
// Loads a framework context from the plugin's side
static void loadContext(void* context) noexcept;
static void sleep(uint64_t milliseconds) noexcept;
static KeyStringsArrType& getKeyStrings() noexcept;
};
Reference for the functions:
loadFileToString- Loads a file from a given location into an FString. An empty string is an empty file or an errortoUpper- Converts a string to all uppercase characterstoLower- Converts a string to all lowercase characterssplitString- Splits a string using the provided token as a delimiterremoveConsole- Removes the console window on WindowskeyToText- Converts a key code to text in short or long form for usage in UIsanitiseFilepath- Sanitises file paths, such as replacing\with/on WindowsloadContext- Loads the framework context inside a plugin. Should be the first thing called fromUImGui_Plugin_attach. More info on the plugins pagesleep- Puts the current thread to sleep for X millisecondsgetKeyStrings- Returns the internal string table for each keyboard key. Don’t use manually, instead use one of thekeyToTextfunctions
Event safety
The whole interface is flagged as event safe at Any time.
C API
The C API is severely downsized, by removing most string operation functions. It uses the standard C API development rules as defined here. It looks like this:
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_loadFileToString(UImGui_String location);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_sanitiseFilepath(UImGui_String str);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_keyToText(CKeys key, bool bLong);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_keyToTextInputAction(UImGui_CInputAction* action, bool bLong);
// Event Safety - Any time
UIMGUI_PUBLIC_API void UImGui_Utility_removeConsole();
// Event Safety - Any time
// Sleep for X milliseconds
UIMGUI_PUBLIC_API void UImGui_Utility_sleep(uint64_t milliseconds);
// Loads a framework context from the plugin's side
UIMGUI_PUBLIC_API void UImGui_Utility_loadContext(void* context);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_toLower(char* str);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_toUpper(char* str);
Most functions in the C API are available, except for some that are considered internal and are not needed.