支持使用main的参数列表来创建Order
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Options.h>
|
||||
#include <unordered_map>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ling {
|
||||
class Options;
|
||||
@@ -71,6 +72,8 @@ namespace ling {
|
||||
public:
|
||||
explicit Order(const std::vector<std::string> &temp);
|
||||
|
||||
Order(int argc, const char *const argv[]);
|
||||
|
||||
Options addOption(const std::vector<std::string> &opt, const std::string &message = "");
|
||||
|
||||
Options addOption(const std::vector<std::string> &opt, Type type, const std::string &message = "");
|
||||
|
||||
@@ -69,6 +69,12 @@ namespace ling {
|
||||
this->cmd = temp;
|
||||
}
|
||||
|
||||
Order::Order(int argc, const char *const *argv) {
|
||||
for (int i = 0; i < argc; i++) {
|
||||
this->cmd.emplace_back(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Options Order::addOption(const std::vector<std::string> &opt, const std::string &message) {
|
||||
return addOption(opt, OPT, message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user