handmade/include/Commands.h

37 lines
692 B
C
Raw Normal View History

#pragma once
#include <string>
#include <map>
class
Command
{
std::string m_name;
Command (const std::string& name)
: m_name (name)
{
}
};
/*
* Function pointer type that returns true if we should stop processing input,
* false otherwise.
*/
#define COMMANDHELPERFUNC(x) bool x (const std::string&)
typedef COMMANDHELPERFUNC((*CommandHelperFunc));
COMMANDHELPERFUNC(command_Quit);
COMMANDHELPERFUNC(command_Help);
COMMANDHELPERFUNC(command_Echo);
COMMANDHELPERFUNC(command_Shell);
const std::map <const std::string, CommandHelperFunc> CommandFunctionList =
{
{ "quit", command_Quit, },
{ "help", command_Help, },
{ "echo", command_Echo, },
{ "shell", command_Shell, },
};