| 499 | } |
| 500 | |
| 501 | EngineOption* UciEngine::parseOption(QStringView line) |
| 502 | { |
| 503 | enum Keyword |
| 504 | { |
| 505 | OptionName, |
| 506 | OptionType, |
| 507 | OptionDefault, |
| 508 | OptionMin, |
| 509 | OptionMax, |
| 510 | OptionVar |
| 511 | }; |
| 512 | static const QString types[] = |
| 513 | { |
| 514 | "name", |
| 515 | "type", |
| 516 | "default", |
| 517 | "min", |
| 518 | "max", |
| 519 | "var" |
| 520 | }; |
| 521 | |
| 522 | QString name; |
| 523 | QString type; |
| 524 | QString value; |
| 525 | QStringList choices; |
| 526 | int min = 0; |
| 527 | int max = 0; |
| 528 | |
| 529 | int keyword = -1; |
| 530 | QStringView remaining(tokenize(line).second); |
| 531 | QVarLengthArray<QStringView> tokens; |
| 532 | |
| 533 | while (!remaining.isEmpty()) |
| 534 | { |
| 535 | remaining = parseUciTokens(remaining, types, 6, tokens, keyword); |
| 536 | if (tokens.isEmpty() || keyword == -1) |
| 537 | continue; |
| 538 | |
| 539 | QString str(joinTokens(tokens).toString()); |
| 540 | |
| 541 | switch (keyword) |
| 542 | { |
| 543 | case OptionName: |
| 544 | name = str; |
| 545 | break; |
| 546 | case OptionType: |
| 547 | type = str; |
| 548 | break; |
| 549 | case OptionDefault: |
| 550 | value = str; |
| 551 | break; |
| 552 | case OptionMin: |
| 553 | min = str.toInt(); |
| 554 | break; |
| 555 | case OptionMax: |
| 556 | max = str.toInt(); |
| 557 | break; |
| 558 | case OptionVar: |
nothing calls this directly
no test coverage detected