#ifndef ARC_CONSOLE_SHELL_H_ #define ARC_CONSOLE_SHELL_H_ #ifdef __cplusplus extern "C" { #endif //TODO: fix up this file #include "view.h" //#include "buffer.h" #include "arc/std/string.h" #include "arc/std/vector.h" #include /** * @brief */ typedef struct ARC_ConsoleShell ARC_ConsoleShell; /** * @brief */ typedef void (* ARC_ConsoleShell_UpdateFn)(ARC_ConsoleShell *shell); /** * @brief */ struct ARC_ConsoleShell { ARC_ConsoleView *view; // ARC_ConsoleBuffer *buffer; uint32_t bufferLineIndex; ARC_Vector *history; uint32_t historyIndex; ARC_ConsoleShell_UpdateFn updateFn; ARC_String *currentLine; ARC_String *userInput; }; /** * @brief creates ARC_ConsoleShell type * * @param shell ARC_ConsoleShell to create * @param view ARC_ConsoleView to attach the shell to * @param updateFn ARC_ConsoleShell_UpdateFn provided that will run the console */ void ARC_ConsoleShell_Create(ARC_ConsoleShell **shell, ARC_ConsoleView *view, ARC_ConsoleShell_UpdateFn updateFn); /** * @brief destroys ARC_ConsoleShell type * * @param shell ARC_ConsoleShell to destroy */ void ARC_ConsoleShell_Destroy(ARC_ConsoleShell *shell); /** * @brief updates the ARC_ConsoleShell type * * @param shell the ARC_ConsoleShell to update */ void ARC_ConsoleShell_Update(ARC_ConsoleShell *shell); /** * @brief renders the ARC_ConsoleShell type * * @param shell the ARC_ConsoleShell to render */ void ARC_ConsoleShell_Render(ARC_ConsoleShell *shell); /** * @brief adds history ARC_String to ARC_ConsoleShell * * @param shell the ARC_ConsoleShell to add history to * @param string the history string to add to ARC_ConsoleShell */ void ARC_ConsoleShell_AddHistory(ARC_ConsoleShell *shell, ARC_String *string); /** * @brief gets history from ARC_ConsoleShell * * @note the index 0 will start from the last added history * * @param shell the ARC_ConsoleShell to get history from * @param index the location to get history at * * @return the history as an ARC_String */ ARC_String *ARC_ConsoleShell_GetHistoryAt(ARC_ConsoleShell *shell, uint32_t index); #ifdef __cplusplus } #endif #endif //!ARC_CONSOLE_SHELL_H_