msh-console/msh-console-library/commandexecutor.h

33 lines
712 B
C
Raw Normal View History

#ifndef COMMANDEXECUTOR_H
#define COMMANDEXECUTOR_H
#pragma once
#include <vector>
#include <string>
namespace mshconsole{
class CommandExecutor
{
protected:
class ExitException {
int code;
public:
int getCode(){
return code;
}
ExitException(int c=0) : code(c){}
};
public:
virtual int executeCmd(const struct Params& args) = 0;
virtual int executeCmd(const std::string& args) = 0;
virtual size_t howManyCmds() const = 0;
void exit(int code=0);
CommandExecutor();
};
struct Params{
int argc;
char** argv;
};
}
#endif // COMMANDEXECUTOR_H