hkstreamer/include/cmdlineparser.h

29 lines
523 B
C
Raw Normal View History

2023-03-30 23:44:03 +08:00
#ifndef CMDLINEPARSER_H
#define CMDLINEPARSER_H
#include <map>
#include <string>
#include <getopt.h>
using namespace std;
typedef struct {
string name;
int shortName;
int needParam;
string desc;
} OptDefine;
class CmdLineParser
{
public:
CmdLineParser();
void regOpt(OptDefine optdef);
string getOpt(string key);
void parseArgs(int argc, char *argv[]);
private:
map<int, OptDefine> optMap;
map<string, string> paraMap;
bool hasOptSet(string key);
};
#endif // CMDLINEPARSER_H