2016-03-16 20:15:24 +00:00
|
|
|
#ifndef COMMANDEXECUTOR_H
|
|
|
|
#define COMMANDEXECUTOR_H
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
2016-03-18 17:48:16 +00:00
|
|
|
namespace mshconsole{
|
|
|
|
class CommandExecutor
|
|
|
|
{
|
|
|
|
protected:
|
2016-04-02 14:28:03 +00:00
|
|
|
class ExitException {
|
|
|
|
int code;
|
|
|
|
public:
|
|
|
|
int getCode(){
|
|
|
|
return code;
|
|
|
|
}
|
|
|
|
ExitException(int c=0) : code(c){}
|
|
|
|
};
|
2016-03-18 17:48:16 +00:00
|
|
|
public:
|
|
|
|
virtual int executeCmd(std::vector<std::string>* args) = 0;
|
|
|
|
virtual int executeCmd(const std::string& args) = 0;
|
|
|
|
virtual size_t howManyCmds() const = 0;
|
2016-04-02 14:28:03 +00:00
|
|
|
void exit(int code=0);
|
2016-03-18 17:48:16 +00:00
|
|
|
CommandExecutor();
|
|
|
|
};
|
|
|
|
}
|
2016-03-16 20:15:24 +00:00
|
|
|
|
|
|
|
#endif // COMMANDEXECUTOR_H
|