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, "mode") == 0) {
18 return EOption::Mode;
19 }
20
21 if (strcmp(verbose_arg, "suite") == 0) {
22 return EOption::Suite;
23 }
24
25 if (strcmp(verbose_arg, "ghost") == 0) {
26 return EOption::Ghost;
27 }
28
29 return EOption::Invalid;
30 } else {
31 switch (arg[1]) {
32 case 'M':
33 case 'm':
34 return EOption::Mode;
35 case 'S':
36 case 's':
37 return EOption::Suite;
38 case 'G':
39 case 'g':
40 return EOption::Ghost;
41 default:
42 return EOption::Invalid;
43 }
44 }
45
46 // This is unreachable
47 return std::nullopt;
48}
49
50} // namespace Host::Option