MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / ToBool

Method ToBool

externals/tinyxml2/tinyxml2.cpp:628–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628bool 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
654bool XMLUtil::ToFloat( const char* str, float* value )

Callers

nothing calls this directly

Calls 1

StringEqualFunction · 0.85

Tested by

no test coverage detected