MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / GetBinary

Function GetBinary

env/env_yaml.cc:108–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108absl::StatusOr<std::string> GetBinary(absl::string_view yaml,
109 const YAML::Node& node) {
110 if (!node.IsDefined() || !node.IsScalar() || !IsBinary(node)) {
111 return "";
112 }
113 std::string binary;
114 // Instead of using the YAML::Binary type, we use absl::Base64Unescape
115 // because YAML::Binary is lenient to Base64 decoding errors.
116 if (absl::Base64Unescape(GetString(yaml, node), &binary)) {
117 return binary;
118 } else {
119 return YamlError(yaml, node,
120 "Node '" + GetString(yaml, node) +
121 "' is not a valid Base64 encoded binary");
122 }
123}
124
125absl::StatusOr<bool> GetBool(absl::string_view yaml, absl::string_view key,
126 const YAML::Node& node) {

Callers 1

ParseVariableConfigsFunction · 0.85

Calls 3

IsBinaryFunction · 0.85
GetStringFunction · 0.85
YamlErrorFunction · 0.85

Tested by

no test coverage detected