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