/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: Commands.hpp Date: 2021-6-10 Author: Reece ***/ #pragma once #include namespace Aurora::Async { struct WorkerId_t; } namespace Aurora::Console::Commands { AUKN_INTERFACE(ICommandSubscriber, AUI_METHOD(void, onCommand, (const Parse::ParsedObject &, parseList)) ); AUKN_INTERFACE(ITextLineSubscriber, AUI_METHOD(void, onProcessedLineUTF8, (const AuString &, line)) ); AUKN_SYM void AddCommand(const AuString &tag, const Parse::ParseObject &commandStructure, const AuSPtr &subscriber); /** * Dispatch a command to the main thread or aurora async overloaded command dispatcher thread worker id */ AUKN_SYM bool DispatchCommand(const AuString &string); /** * Parses `string` and dispatches the parsed command on the current thread instantly */ AUKN_SYM bool DispatchCommandThisThread(const AuString &string); /** * Parses `string` on the current thread and then schedules the ICommandSubscriber callback on the specified thread */ AUKN_SYM bool DispatchCommandToAsyncRunner(const AuString &string, Async::WorkerId_t id); /** * Simulates a processed stdin line given `string` */ AUKN_SYM bool DispatchRawLine(const AuString &string); /** * Hijacks the UTF-8 input line processor coming from the consoles. DispatchCommand remains unaffected * Call with an empty interface pointer to reenable command processing */ AUKN_SYM void SetCallbackAndDisableCmdProcessing(const AuSPtr &subscriber); }