#ifndef SHELL_H #define SHELL_H #include #include #include #include #include #include #include #include #include #include "command.h" using std::string; using std::cin; using std::cout; using std::cerr; using std::string; using std::vector; using std::istringstream; using std::nullptr_t; class Shell { class Commands { vector commands; static bool created; Commands(Commands&); public: Commands(); void add(Command*); size_t howMany(); int launch(const vector* args); }; static bool undoingLine; Commands cmds; string ps; string name; void (*shellSetup)(Shell *); bool notLoop; int launch(vector* args); int execute(vector* args); static void EofHandler(int); string* read_line(); vector* split_line(string* line); class IsUndoingLineException {}; public: Shell( string n="msh", string ps="MSH$",void (*s)(Shell*)=0); string getPs() const; void setPs(const string &value); string getName() const; void setName(const string &value); void launch(); //for in-shell commands void addCmd(Command *cmd); size_t howManyCmds(); //exceptions class CommandsAlreadyCreatedException{}; class CommandNotFoundException{}; class ShellLaunchInSetupException{}; }; #endif // SHELL_H