MCPcopy Create free account
hub / github.com/apache/trafficserver / decode

Method decode

lib/yamlcpp/src/convert.cpp:41–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40namespace YAML {
41bool convert<bool>::decode(const Node& node, bool& rhs) {
42 if (!node.IsScalar())
43 return false;
44
45 // we can't use iostream bool extraction operators as they don't
46 // recognize all possible values in the table below (taken from
47 // http://yaml.org/type/bool.html)
48 static const struct {
49 std::string truename, falsename;
50 } names[] = {
51 {"y", "n"},
52 {"yes", "no"},
53 {"true", "false"},
54 {"on", "off"},
55 };
56
57 if (!IsFlexibleCase(node.Scalar()))
58 return false;
59
60 for (const auto& name : names) {
61 if (name.truename == tolower(node.Scalar())) {
62 rhs = true;
63 return true;
64 }
65
66 if (name.falsename == tolower(node.Scalar())) {
67 rhs = false;
68 return true;
69 }
70 }
71
72 return false;
73}
74} // namespace YAML

Callers

nothing calls this directly

Calls 3

IsFlexibleCaseFunction · 0.85
tolowerFunction · 0.85
ScalarMethod · 0.80

Tested by

no test coverage detected