-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2_5.cpp
54 lines (46 loc) · 1.3 KB
/
2_5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "PluginController.h"
//#include "PluginEnumerator.h"
#include <iostream>
#include <string.h>
#include <vector>
void printCommandsError(void); // 用于打印调用指令错误的内容
int main(int argc, char *argv[])
{
//输入参数检查
if (argc != 2)
{
printCommandsError();
return 0;
}
//输入命令为help
if (strcmp(argv[1], "help") == 0)
{
//实例化插件控制类
PluginController pluginControl;
pluginControl.ProcessHelp(); //调用插件的help函数
return 0;
}
int functionID = atoi(argv[1]); // Convert string to number
PluginController pluginControl; //实例化插件控制类
if (functionID >= 0) // cheak input number in bounds
{
pluginControl.InitializeController(); // 初始化插件控制类
pluginControl.ProcessRequest(functionID); // 请求调用对应ID的函数
pluginControl.UninitializeController(); // 释放插件控制类占用
}
else //the input is not allow
{
printCommandsError();
}
return 0;
}
/**
* @brief 打印调用指令错误的内容
*
*/
void printCommandsError(void)
{
std::cout << "Most used commands:" << std::endl;
std::cout << "\thelp" << std::endl;
std::cout << "\t[FunctionID]" << std::endl;
}