ReXGlue SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
console_command.h
Go to the documentation of this file.
1
11
12
#pragma once
13
14
#include <memory>
15
#include <string>
16
#include <string_view>
17
18
#include <
rex/platform.h
>
19
#include <
rex/result.h
>
20
#include <
rex/setting.h
>
21
#include <
rex/utility.h
>
22
23
namespace
rex
{
24
26
class
REX_API
ConsoleCommand
:
public
NonCopyable {
27
public
:
31
ConsoleCommand
(
SettingOwner
* owner, std::string_view name, std::string_view help,
32
MoveOnlyFunction
<
Result<void>
(std::string_view args)> run);
33
34
~ConsoleCommand
();
35
39
const
std::string&
GetName
()
const
;
40
41
const
std::string& GetHelp()
const
;
42
43
[[nodiscard]]
Result<void>
Run(std::string_view args);
44
45
private
:
46
struct
State;
47
std::unique_ptr<State> state_;
48
};
49
50
}
// namespace rex
51
63
#define REX_COMMAND(name, help, fn) \
64
::rex::ConsoleCommand name { \
65
this, #name, help, fn \
66
}
rex::ConsoleCommand::GetName
const std::string & GetName() const
rex::ConsoleCommand::ConsoleCommand
ConsoleCommand(SettingOwner *owner, std::string_view name, std::string_view help, MoveOnlyFunction< Result< void >(std::string_view args)> run)
rex::SettingOwner
Definition
setting.h:249
rex
Definition
app.h:36
rex::MoveOnlyFunction
typename detail::MoveOnlyFunctionFor< Signature >::type MoveOnlyFunction
Definition
utility.h:254
rex::Result
std::expected< T, Error > Result
Definition
result.h:98
platform.h
Platform flags, packing macros and export markers.
REX_API
#define REX_API
Definition
platform.h:177
result.h
setting.h
Typed settings and the owners that declare them.
utility.h
Move only function, const propagating pointer and scope guard.
rex
console_command.h
Generated by
1.18.0