#pragma once #include #include #include typedef int (*FUNCTION)(const std::string &s); static std::vector Verbs{"Quit", "Exit", "Go", "Move", "Look"}; static std::vector Nouns{"Object", "Door", "North", "South", "East", "West", "Up", "Down", "Left", "Right", "To", "At"}; class CommandParser { private: std::map commands; public: CommandParser(); bool AddCommand(std::string c, FUNCTION f); void RemoveCommand(std::string c); std::vector Verb(std::stringstream &sentences); std::vector Noun(std::stringstream &sentences); static inline void CommandUnrecognized() { printf("I don't know how to do that.\n"); } int Parse(); };