| 89 | } |
| 90 | |
| 91 | opt_t parse_options(const vector<string> &args) { |
| 92 | opt_t options; |
| 93 | |
| 94 | options["--name"] = ""; |
| 95 | options["--type"] = ""; |
| 96 | options["--file"] = ""; |
| 97 | options["--output"] = ""; |
| 98 | options["--namespace"] = ""; |
| 99 | |
| 100 | // Parse Arguments |
| 101 | string curr_opt; |
| 102 | bool verbose = false; |
| 103 | for (auto arg : args) { |
| 104 | if (arg == "--verbose") { |
| 105 | verbose = true; |
| 106 | } else if (arg == "--binary") { |
| 107 | binary = true; |
| 108 | } else if (arg == "--nullterm") { |
| 109 | nullterm = true; |
| 110 | } else if (arg == "--formatted") { |
| 111 | formatted = true; |
| 112 | } else if (arg == "--version") { |
| 113 | cout << args[0] << " By Umar Arshad" << endl; |
| 114 | } else if (arg == "--help") { |
| 115 | print_usage(); |
| 116 | } else if (options.find(arg) != options.end()) { |
| 117 | curr_opt = arg; |
| 118 | } else if (curr_opt.empty()) { |
| 119 | // cerr << "Invalid Argument: " << arg << endl; |
| 120 | } else { |
| 121 | if (options[curr_opt] != "") { |
| 122 | options[curr_opt] += " " + arg; |
| 123 | } else { |
| 124 | options[curr_opt] += arg; |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | if (verbose) { |
| 130 | for (auto opts : options) { |
| 131 | cout << get<0>(opts) << " " << get<1>(opts) << endl; |
| 132 | } |
| 133 | } |
| 134 | return options; |
| 135 | } |
| 136 | |
| 137 | stringstream removeComments(ifstream &input, string &filename) { |
| 138 | stringstream ss; |
no test coverage detected