| 309 | } |
| 310 | |
| 311 | bool cmFileAPI::ReadQuery(std::string const& query, |
| 312 | std::vector<Object>& objects) |
| 313 | { |
| 314 | // Parse the "<kind>-" syntax. |
| 315 | std::string::size_type sep_pos = query.find('-'); |
| 316 | if (sep_pos == std::string::npos) { |
| 317 | return false; |
| 318 | } |
| 319 | std::string kindName = query.substr(0, sep_pos); |
| 320 | std::string verStr = query.substr(sep_pos + 1); |
| 321 | if (kindName == ObjectKindName(ObjectKind::CodeModel)) { |
| 322 | Object o; |
| 323 | o.Kind = ObjectKind::CodeModel; |
| 324 | if (verStr == "v2") { |
| 325 | o.Version = 2; |
| 326 | } else { |
| 327 | return false; |
| 328 | } |
| 329 | objects.push_back(o); |
| 330 | return true; |
| 331 | } |
| 332 | if (kindName == ObjectKindName(ObjectKind::ConfigureLog)) { |
| 333 | Object o; |
| 334 | o.Kind = ObjectKind::ConfigureLog; |
| 335 | if (verStr == "v1") { |
| 336 | o.Version = 1; |
| 337 | } else { |
| 338 | return false; |
| 339 | } |
| 340 | objects.push_back(o); |
| 341 | return true; |
| 342 | } |
| 343 | if (kindName == ObjectKindName(ObjectKind::Cache)) { |
| 344 | Object o; |
| 345 | o.Kind = ObjectKind::Cache; |
| 346 | if (verStr == "v2") { |
| 347 | o.Version = 2; |
| 348 | } else { |
| 349 | return false; |
| 350 | } |
| 351 | objects.push_back(o); |
| 352 | return true; |
| 353 | } |
| 354 | if (kindName == ObjectKindName(ObjectKind::CMakeFiles)) { |
| 355 | Object o; |
| 356 | o.Kind = ObjectKind::CMakeFiles; |
| 357 | if (verStr == "v1") { |
| 358 | o.Version = 1; |
| 359 | } else { |
| 360 | return false; |
| 361 | } |
| 362 | objects.push_back(o); |
| 363 | return true; |
| 364 | } |
| 365 | if (kindName == ObjectKindName(ObjectKind::Toolchains)) { |
| 366 | Object o; |
| 367 | o.Kind = ObjectKind::Toolchains; |
| 368 | if (verStr == "v1") { |
no test coverage detected