-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathArgumentParser.cpp
More file actions
42 lines (32 loc) · 967 Bytes
/
ArgumentParser.cpp
File metadata and controls
42 lines (32 loc) · 967 Bytes
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
#ifndef SUNWAY
#include "ArgumentParser.hpp"
#include "boost/bind.hpp"
#include<boost/algorithm/string/split.hpp>
#include<boost/algorithm/string.hpp>
void ArgumentParser::set_cmdline(char* cmd){
cmdline = cmd;
}
void ArgumentParser::parse_cmdline(int argc, char** argv){
po::store(po::command_line_parser(argc, argv)
.options(m_ops_desc)
.allow_unregistered().run(), m_vm);
po::notify(m_vm);
}
const po::option_description* ArgumentParser::find(char* key){
return m_ops_desc.find_nothrow(std::string(key), false);
}
void ArgumentParser::parse_cmdline(){
using boost::is_any_of;
std::vector<std::string> vs;
boost::algorithm::split(vs, cmdline, is_any_of("\t "));
po::store(po::command_line_parser(vs)
.options(m_ops_desc)
.allow_unregistered().run(), m_vm);
po::notify(m_vm);
}
void ArgumentParser::parse_file(char* file){
}
void ArgumentParser::show(){
std::cout<<m_ops_desc;
}
#endif