| 178 | bool Options::has(const std::string &key) const { return !!vm.count(key); } |
| 179 | |
| 180 | bool Options::outputFile(std::string &out) const { |
| 181 | using std::string; |
| 182 | if (vm.count("output")) { |
| 183 | out = vm["output"].as<string>(); |
| 184 | return true; |
| 185 | } |
| 186 | #ifdef FIRST_FILE_IS_OUT |
| 187 | if (vm.count("files")) { |
| 188 | #else |
| 189 | if (vm.count("disassemble") && vm.count("files")) { |
| 190 | #endif |
| 191 | if (vm["files"].as<std::vector<string>>().size() == 1) { |
| 192 | out = vm["files"].as<std::vector<string>>()[0]; |
| 193 | return true; |
| 194 | } |
| 195 | } |
| 196 | return false; |
| 197 | } |
| 198 | |
| 199 | bool Options::disassembleFile(std::string &out) const { |
| 200 | if (!vm.count("disassemble")) { |
| 201 | return false; |
| 202 | } |
| 203 | out = vm["disassemble"].as<std::string>(); |
| 204 | return true; |
| 205 | } |
| 206 | |
| 207 | bool Options::specFile(std::string &out) const { |
| 208 | if (!vm.count("file")) { |
| 209 | return false; |
| 210 | } |
| 211 | out = vm["file"].as<std::string>(); |
| 212 | return true; |
| 213 | } |
| 214 | |
| 215 | bool Options::outputJSONFile(std::string &out) const { |
| 216 | if (!vm.count("json")) { |
| 217 | return false; |
| 218 | } |
| 219 | out = vm["json"].as<std::string>(); |
| 220 | return true; |
| 221 | } |
| 222 | |
| 223 | bool Options::outputXMLFile(std::string &out) const { |
| 224 | if (!vm.count("xml")) { |
| 225 | return false; |
| 226 | } |
| 227 | out = vm["xml"].as<std::string>(); |
| 228 | return true; |
| 229 | } |
| 230 | |
| 231 | const std::vector<std::string>::const_iterator |
| 232 | Options::inputFilesBegin(void) const { |
| 233 | using std::string; |
| 234 | using std::vector; |
| 235 | if (!vm.count("files")) { |
| 236 | return inputFilesEnd(); |
| 237 | } |
no test coverage detected