MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / parse_bool

Method parse_bool

include/chaiscript/utility/json.hpp:627–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625 }
626
627 static JSON parse_bool( const std::string &str, size_t &offset ) {
628 if( str.substr( offset, 4 ) == "true" ) {
629 offset += 4;
630 return JSON(true);
631 } else if( str.substr( offset, 5 ) == "false" ) {
632 offset += 5;
633 return JSON(false);
634 } else {
635 throw std::runtime_error(std::string("JSON ERROR: Bool: Expected 'true' or 'false', found '") + str.substr( offset, 5 ) + "'");
636 }
637 }
638
639 static JSON parse_null( const std::string &str, size_t &offset ) {
640 if( str.substr( offset, 4 ) != "null" ) {

Callers

nothing calls this directly

Calls 3

JSONClass · 0.85
stringClass · 0.85
substrMethod · 0.80

Tested by

no test coverage detected