Blamite Game Engine - Blam (Core)
help.hpp
Go to the documentation of this file.
1 #include "../console.h"
3 #include <set>
4 
5 namespace Blam::Console
6 {
14  class HelpCommand : public ConsoleCommand
15  {
16  public:
18  {
19  name = "help";
20  description = "Shows a list of commands.";
21 
23  }
24 
26  {
27  delete this;
28  }
29 
30  CommandStatus onCommand(std::vector<std::string> arguments)
31  {
32  using namespace Blam::Logger;
33 
34  // blank line
36 
37  std::set<std::string> command_list;
38 
39  std::map<std::string, Blam::Console::ConsoleCommand*> map = Blam::Console::GetCommandList();
40  std::map<std::string, Blam::Console::ConsoleCommand*>::iterator it;
41 
42  for (it = map.begin(); it != map.end(); it++)
43  {
44  command_list.insert(it->second->name);
45  }
46 
47  std::set<std::string>::iterator list_it;
48 
49  for (list_it = command_list.begin(); list_it != command_list.end(); list_it++)
50  {
51  std::string cmd_name = *list_it;
52 
54  }
55 
56  return CMD_OK;
57  }
58  };
59 }
Blam::Console::GetCommandList
BLAM std::map< std::string, ConsoleCommand * > GetCommandList()
Retrieves the list of all loaded console commands.
Definition: console.cpp:149
Blam::Console::ConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:73
Blam::Console::ConsoleCommand::type
CommandType type
The type of command this is. See Blam::Console::CommandType for more information.
Definition: console.h:77
command_list
std::map< std::string, ConsoleCommand * > command_list
The list of all loaded console commands.
Definition: console.cpp:34
Blam::Console::CommandStatus
CommandStatus
Indicates the return state of a console command.
Definition: console.h:28
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::HelpCommand::~HelpCommand
~HelpCommand()
Definition: help.hpp:25
Blam::Console::HelpCommand::onCommand
CommandStatus onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: help.hpp:30
Blam::Console::HelpCommand::HelpCommand
HelpCommand()
Definition: help.hpp:17
Blam::Console::HelpCommand
Class for the help command.
Definition: help.hpp:14
WSV_NONE
#define WSV_NONE
Macro for 'None' log seveirty. Original pre-enum value was 0.
Definition: logger.h:15
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::Logger
Namespace containing things related to the Blamite Logger.
Definition: logger.h:44