Skip to content

Utility interface

Stanislav Vasilev edited this page May 18, 2023 · 8 revisions

The Utility interface provides utility functions. It looks like this:

class UIMGUI_PUBLIC_API Utility
{
public:
    static void sanitiseFilepath(FString& str) noexcept;

    static void keyToText(FString& text, const uint16_t& key, bool bLong) noexcept;
    static FString keyToText(const uint16_t& key, bool bLong) noexcept;
    static void keyToText(FString& text, const InputAction& action, bool bLong) noexcept;
    static FString keyToText(const InputAction& action, bool bLong) noexcept;

    // DO NOT USE THIS, THIS IS ONLY HERE FOR INTERNAL REASONS!!! REALLY KNOW WHAT YOU'RE DOING WHEN USING THIS
    static Global& getGlobal() 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;

    static void sleep(uint64_t milliseconds) noexcept;
};

Reference for the functions:

  1. toUpper - Converts a string to all uppercase characters
  2. toLower - Converts a string to all lowercase characters
  3. removeConsole - Removes the console window on Windows
  4. getGlobal - Returns a reference to the internal global class, DO NOT TOUCH!!!
  5. keyToText - Converts a key code to text in short or long form for usage in UI
  6. sanitizeFilepath - Sanitizes file paths, such as replacing \ with / on Windows
  7. sleep - Puts the current thread to sleep for X milliseconds

Event safety

The whole interface is flagged as event safe at Any time.

Clone this wiki locally