MCPcopy Create free account
hub / github.com/Persper/code-analytics / GetBool

Method GetBool

test/cpp_test_repo/D/TextFileParsers.cpp:134–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134bool ConfigurationParser::GetBool(const std::string& key, bool defaultValue) const
135{
136 auto v = entries.find(key);
137 if (v == entries.end()) return defaultValue;
138 if (Equal(v->second, "true", StringComparison::IgnoureCase | StringComparison::IgnoreSurroudingWhiteSpaces))
139 return true;
140 else if (Equal(v->second, "false", StringComparison::IgnoureCase | StringComparison::IgnoreSurroudingWhiteSpaces))
141 return false;
142 try
143 {
144 return stod(v->second);
145 } catch (const exception&)
146 {
147 throw_with_nested(Exception("�޷������á�" + key + "��ֵת��Ϊbool��"));
148 }
149}
150
151ConfigurationParser::ConfigurationParser(istream& inputStream) : entries()
152{

Callers

nothing calls this directly

Calls 3

EqualFunction · 0.70
ExceptionClass · 0.70
endMethod · 0.45

Tested by

no test coverage detected