Blamite Game Engine - Blam (Core)
h2help.hpp
Go to the documentation of this file.
1 #include "../console.h"
3 #include <set>
4 
5 namespace Blam::Console
6 {
15  {
16  public:
18  {
19  name = "h2help";
20  description = "prints a description of the named function.";
21  syntax = "help <string>";
22  aliases = { "chelp" };
23 
25  }
26 
28  {
29  delete this;
30  }
31 
32  CommandStatus onCommand(std::vector<std::string> arguments)
33  {
34  if (arguments.size() == 0)
35  {
37  }
38  else
39  {
40  ConsoleCommand* cmd = Blam::Console::GetCommand(arguments[0]);
41 
42  if (cmd)
43  {
44  std::string title = "";
45 
46  if (cmd->syntax == "")
47  {
48  title = cmd->name;
49  }
50  else
51  {
52  title = cmd->syntax;
53  }
54 
55  Blam::Logger::LogEventForce("(" + title + ")", WSV_NONE);
57  }
58  else
59  {
60  return CMD_OK;
61  }
62  }
63 
64  return CMD_OK;
65  }
66  };
67 }
Blam::Console::ConsoleCommand::aliases
std::vector< std::string > aliases
A list of aliases for the command. Executing any of these instead of the command name will behave the...
Definition: console.h:75
Blam::Console::ConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:73
CMD_ERR_WRONG_ARGS_COUNT
#define CMD_ERR_WRONG_ARGS_COUNT
Macro for Wrong Arg Count command status. See Blam::Console::WrongArgumentCount for more details.
Definition: console.h:11
Blam::Console::ConsoleCommand::type
CommandType type
The type of command this is. See Blam::Console::CommandType for more information.
Definition: console.h:77
Blam::Console::CommandStatus
CommandStatus
Indicates the return state of a console command.
Definition: console.h:28
Blam::Console::Halo2HelpCommand::Halo2HelpCommand
Halo2HelpCommand()
Definition: h2help.hpp:17
logger.h
Blam::Console::Builtin
@ Builtin
A command that is hard-coded into the engine.
Definition: console.h:41
Blam::Console::ConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:70
Blam::Console::GetCommand
BLAM ConsoleCommand * GetCommand(std::string name)
Retrieves a command with the specified name.
Definition: console.cpp:155
WSV_NONE
#define WSV_NONE
Macro for 'None' log seveirty. Original pre-enum value was 0.
Definition: logger.h:15
Blam::Console::Halo2HelpCommand::~Halo2HelpCommand
~Halo2HelpCommand()
Definition: h2help.hpp:27
Blam::Console::Halo2HelpCommand::onCommand
CommandStatus onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: h2help.hpp:32
Blam::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Console::ConsoleCommand
Class used to represent a console command.
Definition: console.h:50
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message, LogSeverity severity)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:137
CMD_OK
#define CMD_OK
Macro for OK command status. See Blam::Console::Ok for more details.
Definition: console.h:9
Blam::Console::Halo2HelpCommand
Class for the h2help command.
Definition: h2help.hpp:14
Blam::Console::ConsoleCommand::syntax
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:74