A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Option.cc
1#include "Option.hh"
2
3#include <cstring>
4
5namespace Host::Option {
6
7std::optional<EOption> CheckFlag(const char *arg) {
8 ASSERT(arg);
9 if (arg[0] != '-') {
10 return std::nullopt;
11 }
12
13 // Verbose flag
14 if (arg[1] == '-') {
15 const char *verbose_arg = &arg[2];
16
17 if (strcmp(verbose_arg, "suite") == 0) {
18 return EOption::Suite;
19 }
20
21 if (strcmp(verbose_arg, "ghost") == 0) {
22 return EOption::Ghost;
23 }
24
25 return EOption::Invalid;
26 } else {
27 switch (arg[1]) {
28 case 'S':
29 case 's':
30 return EOption::Suite;
31 case 'G':
32 case 'g':
33 return EOption::Ghost;
34 default:
35 return EOption::Invalid;
36 }
37 }
38
39 // This is unreachable
40 return std::nullopt;
41}
42
43} // namespace Host::Option