| 626 | } |
| 627 | |
| 628 | bool XMLUtil::ToBool( const char* str, bool* value ) |
| 629 | { |
| 630 | int ival = 0; |
| 631 | if ( ToInt( str, &ival )) { |
| 632 | *value = (ival==0) ? false : true; |
| 633 | return true; |
| 634 | } |
| 635 | static const char* TRUE_VALS[] = { "true", "True", "TRUE", 0 }; |
| 636 | static const char* FALSE_VALS[] = { "false", "False", "FALSE", 0 }; |
| 637 | |
| 638 | for (int i = 0; TRUE_VALS[i]; ++i) { |
| 639 | if (StringEqual(str, TRUE_VALS[i])) { |
| 640 | *value = true; |
| 641 | return true; |
| 642 | } |
| 643 | } |
| 644 | for (int i = 0; FALSE_VALS[i]; ++i) { |
| 645 | if (StringEqual(str, FALSE_VALS[i])) { |
| 646 | *value = false; |
| 647 | return true; |
| 648 | } |
| 649 | } |
| 650 | return false; |
| 651 | } |
| 652 | |
| 653 | |
| 654 | bool XMLUtil::ToFloat( const char* str, float* value ) |
nothing calls this directly
no test coverage detected