Skip to content

UOperatingSystemTerminalHistory

#include <OperatingSystemSimulator/Public/Programs/Terminal/OperatingSystemTerminalHistory.h>
class UOperatingSystemTerminalHistory

Defined in OperatingSystemTerminalHistory.h:18

Inherits: UOperatingSystemProgramData

---
config:
  class:
    hideEmptyMembersBox: true
---
classDiagram
  class UOperatingSystemTerminalHistory["UOperatingSystemTerminalHistory"]
  class UOperatingSystemProgramData["UOperatingSystemProgramData"]
  UOperatingSystemProgramData <|-- UOperatingSystemTerminalHistory
---
config:
  class:
    hideEmptyMembersBox: true
---
classDiagram
  class UOperatingSystemTerminalHistory["UOperatingSystemTerminalHistory"]
  class UOperatingSystemTerminal["UOperatingSystemTerminal"]
  UOperatingSystemTerminalHistory *-- UOperatingSystemTerminal
---
config:
  class:
    hideEmptyMembersBox: true
---
classDiagram
  class UOperatingSystemTerminalHistory {
    +UOperatingSystemTerminalHistory()
    +AddToHistory(const FString &NewCommand)
    +ClearHistory()
    +GetNextCommand(FString &OutCommand) bool
    +GetPreviousCommand(FString &OutCommand) bool
    +ShouldCreate() const override bool
    +OnCreate() override
    +MaxSupportedHistoryCommands : uint8
    +CommandHistory : TArray< FString >
    +CommandHistoryIndex : int32
    +ParentTerminal : TWeakObjectPtr< UOperatingSystemTerminal
  }

This class represents the history of commands entered in an operating system terminal. It stores the command history and provides methods to add to the history, clear the history, and retrieve previous and next commands.

ReturnNameDescription
UOperatingSystemTerminalHistory
voidAddToHistoryAdds a new command to the command history. The command is specified as a FString parameter named NewCommand. The index of the command history is reset to INDEX_NONE, indicating that there is no current command selected.
voidClearHistoryClears the command history by resetting the command history index to INDEX_NONE and emptying the command history array.
boolGetNextCommandRetrieves the next command from the command history by incrementing the command history index and retrieving the command at the new index. If the command history is empty or the index exceeds the command history size, the method returns false and does not modify the OutCommand parameter. Otherwise, it returns true and assigns the retrieved command to the OutCommand parameter.
boolGetPreviousCommandRetrieves the command that was entered before the current command in the command history. It decrements the CommandHistoryIndex to move to the previous command. If the CommandHistoryIndex becomes invalid (i.e., less than zero or greater than or equal to the size of the command history array), it is set to zero, which represents the first command in the history.

UOperatingSystemTerminalHistory()

Defined in OperatingSystemTerminalHistory.h:54

Section titled “Defined in OperatingSystemTerminalHistory.h:54”
void AddToHistory(const FString & NewCommand)

Defined in OperatingSystemTerminalHistory.h:87 Adds a new command to the command history. The command is specified as a FString parameter named NewCommand. The index of the command history is reset to INDEX_NONE, indicating that there is no current command selected.

  • NewCommand The new command to be added to the history.

See also: CommandHistoryIndex

See also: CommandHistory


void ClearHistory()

Defined in OperatingSystemTerminalHistory.h:95 Clears the command history by resetting the command history index to INDEX_NONE and emptying the command history array.

See also: CommandHistoryIndex

See also: CommandHistory


bool GetNextCommand(FString & OutCommand)

Defined in OperatingSystemTerminalHistory.h:109 Retrieves the next command from the command history by incrementing the command history index and retrieving the command at the new index. If the command history is empty or the index exceeds the command history size, the method returns false and does not modify the OutCommand parameter. Otherwise, it returns true and assigns the retrieved command to the OutCommand parameter.

  • OutCommand The variable where the next command will be stored if it exists.

True if the next command was retrieved successfully, false otherwise.

See also: CommandHistory

See also: CommandHistoryIndex


bool GetPreviousCommand(FString & OutCommand)

Defined in OperatingSystemTerminalHistory.h:126 Retrieves the command that was entered before the current command in the command history. It decrements the CommandHistoryIndex to move to the previous command. If the CommandHistoryIndex becomes invalid (i.e., less than zero or greater than or equal to the size of the command history array), it is set to zero, which represents the first command in the history.

If the command history is empty, the method returns false, indicating that there is no previous command. Otherwise, it returns true and assigns the retrieved command to the OutCommand parameter.

  • OutCommand The variable where the previous command will be stored if it exists.

True if the previous command was retrieved successfully, false otherwise.

See also: CommandHistory

See also: CommandHistoryIndex

ReturnNameDescription
boolShouldCreate virtual const overrideDetermines whether the operating system terminal history should be created.
voidOnCreate virtual overrideDetermines whether the operating system terminal history should be created.

virtual const override

virtual bool ShouldCreate() const override

Defined in OperatingSystemTerminalHistory.h:63 Determines whether the operating system terminal history should be created.

Whether the operating system terminal history should be created.


virtual override

virtual void OnCreate() override

Defined in OperatingSystemTerminalHistory.h:73 Determines whether the operating system terminal history should be created.

The OnCreate method is invoked when the [UOperatingSystemTerminalHistory](#uoperatingsystemterminalhistory) instance is created. It is responsible for initializing the command history, setting the parent terminal, and performing any other necessary setup.

ReturnNameDescription
uint8MaxSupportedHistoryCommandsHow many commands should be supported <br/>
TArray< FString >CommandHistoryCommandHistory array stores the history of commands entered in the Operating System Terminal. It is marked as Transient, which means it will not be saved when the game state is serialized.
int32CommandHistoryIndexProperty for storing the index of the command history in the operating system terminal.
TWeakObjectPtr< UOperatingSystemTerminal >ParentTerminalRepresents a weak reference to the parent operating system terminal.

uint8 MaxSupportedHistoryCommands

Defined in OperatingSystemTerminalHistory.h:24 How many commands should be supported <br/>


TArray< FString > CommandHistory

Defined in OperatingSystemTerminalHistory.h:31 CommandHistory array stores the history of commands entered in the Operating System Terminal. It is marked as Transient, which means it will not be saved when the game state is serialized.


int32 CommandHistoryIndex

Defined in OperatingSystemTerminalHistory.h:39 Property for storing the index of the command history in the operating system terminal.

This property is marked as transient, meaning it will not be saved or serialized when the instance is saved or serialized.


TWeakObjectPtr< UOperatingSystemTerminal > ParentTerminal

Defined in OperatingSystemTerminalHistory.h:50 Represents a weak reference to the parent operating system terminal.

A weak reference is a non-owning reference to an object that does not keep the object alive. If the parent terminal object is deleted, the weak reference will automatically become null. It is important to check if the weak reference is valid before using it to avoid any errors.

See also: UOperatingSystemTerminal