-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandLineParser.cpp
More file actions
54 lines (41 loc) · 1.02 KB
/
CommandLineParser.cpp
File metadata and controls
54 lines (41 loc) · 1.02 KB
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 "CommandLineParser.h"
CommandLineParser::CommandLineParser()
{
}
void CommandLineParser::process(const QStringList &arguments)
{
// オプション解析
for (const QString &arg : arguments) {
if (arg == "--help" || arg == "-h") {
m_HelpSet = true;
}
else if (arg == "--version" || arg == "-v") {
m_VersionSet = true;
}
else if (arg.startsWith("--sysconf=")) {
m_SysConfSet = true;
}
else if (arg.startsWith("-")) {
// 未知のオプションとして扱う
m_unknownOptionNames.append(arg);
}
}
// 標準の解析を実行
QCommandLineParser::process(arguments);
}
QStringList CommandLineParser::unknownOptionNames() const
{
return m_unknownOptionNames;
}
bool CommandLineParser::isHelpSet() const
{
return m_HelpSet;
}
bool CommandLineParser::isVersionSet() const
{
return m_VersionSet;
}
bool CommandLineParser::isSysConfSet() const
{
return m_SysConfSet;
}