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

Function parseAddress

codelab/network_functions.cc:307–319  ·  view source on GitHub ↗

============================================================================= Extension function implementations. =============================================================================

Source from the content-addressed store, hash-verified

305// Extension function implementations.
306// =============================================================================
307cel::Value parseAddress(
308 const cel::StringValue& str,
309 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
310 google::protobuf::MessageFactory* absl_nonnull message_factory,
311 google::protobuf::Arena* absl_nonnull arena) {
312 std::string buf;
313 absl::string_view addr = str.ToStringView(&buf);
314 absl::optional<NetworkAddressRep> rep = NetworkAddressRep::Parse(addr);
315 if (!rep.has_value()) {
316 return cel::ErrorValue(absl::InvalidArgumentError("invalid address"));
317 }
318 return NetworkAddressRep::MakeValue(*rep);
319}
320
321cel::Value parseAddressOrZero(const cel::StringValue& str) {
322 std::string buf;

Callers

nothing calls this directly

Calls 5

ErrorValueFunction · 0.85
MakeValueFunction · 0.85
ToStringViewMethod · 0.80
ParseFunction · 0.50
has_valueMethod · 0.45

Tested by

no test coverage detected