| 583 | //------------------------------------------------------------------------------ |
| 584 | |
| 585 | vtkVariant ConvertStringToBoolean(bool, const char* rawData) |
| 586 | { |
| 587 | // Since there are only a few possibilities I'm going to check |
| 588 | // them all by hand. |
| 589 | switch (rawData[0]) |
| 590 | { |
| 591 | case 'T': |
| 592 | case 't': |
| 593 | case 'Y': |
| 594 | case 'y': |
| 595 | case '1': |
| 596 | case 1: |
| 597 | { |
| 598 | return vtkVariant(true); |
| 599 | } |
| 600 | |
| 601 | case 'F': |
| 602 | case 'f': |
| 603 | case 'N': |
| 604 | case 'n': |
| 605 | case '0': |
| 606 | case 0: |
| 607 | { |
| 608 | return vtkVariant(false); |
| 609 | } |
| 610 | |
| 611 | default: |
| 612 | { |
| 613 | vtkGenericWarningMacro(<< "Unable to convert raw data to boolean. Data length is " |
| 614 | << strlen(rawData) << " and string is '" << rawData << "'"); |
| 615 | return vtkVariant(); |
| 616 | } |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | //------------------------------------------------------------------------------ |
| 621 | |