AuroraRuntime/Include/Aurora/Console/Commands/Commands.hpp
Jamie Reece Wilson 83f34b0c47 [*] I was right. String views are [mostly] pointless (*)
03:28:55:638  17>2 of 53388 functions (<0.1%) were compiled, the rest were copied from previous compilation.
03:28:55:638  17>  0 functions were new in current compilation
03:28:55:638  17>  65 functions had inline decision re-evaluated but remain unchanged
03:28:56:749  17>Finished generating code

the header of const AuString & is the same as std::string_view therefore nothing changes. in fact, we still need to alloc strings a bunch of times for a zero terminated string. worse, <c++20 always allocs each time we want to access a hashmap with o(1) lookup, making small hashmaps kinda pointless when we always have to alloc+copy (thx std)

perhaps this will help some language binders
2024-04-19 05:58:08 +01:00

38 lines
1.1 KiB
C++

/***
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 <Aurora/Parse/Parse.hpp>
#include "ICommandSubscriber.hpp"
namespace Aurora::Async
{
struct WorkerPId_t;
}
namespace Aurora::Console::Commands
{
AUKN_SYM void AddCommand(const AuROString &tag, const Parse::ParseObject &commandStructure, const AuSPtr<ICommandSubscriber> &subscriber);
AUKN_SYM void RemoveCommand(const AuROString &tag);
/**
* Dispatch a command to the main thread or aurora async overloaded command dispatcher thread worker id
*/
AUKN_SYM bool DispatchCommand(const AuROString &string);
/**
* Parses `string` and dispatches the parsed command on the current thread instantly
*/
AUKN_SYM bool DispatchCommandThisThread(const AuROString &string);
/**
* Parses `string` on the current thread and then schedules the ICommandSubscriber callback on the specified thread
*/
AUKN_SYM bool DispatchCommandToAsyncRunner(const AuROString &string, Async::WorkerPId_t id);
}