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

Function RegisterStringFormattingFunctions

extensions/formatting.cc:543–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541} // namespace
542
543absl::Status RegisterStringFormattingFunctions(
544 FunctionRegistry& registry, const RuntimeOptions& options,
545 StringsExtensionFormatOptions format_options) {
546 const int max_precision =
547 std::clamp(format_options.max_precision, 0, kMaxPrecision);
548 CEL_RETURN_IF_ERROR(registry.Register(
549 BinaryFunctionAdapter<absl::StatusOr<Value>, StringValue, ListValue>::
550 CreateDescriptor("format", /*receiver_style=*/true),
551 BinaryFunctionAdapter<absl::StatusOr<Value>, StringValue, ListValue>::
552 WrapFunction(
553 [max_precision](
554 const StringValue& format, const ListValue& args,
555 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
556 google::protobuf::MessageFactory* absl_nonnull message_factory,
557 google::protobuf::Arena* absl_nonnull arena) {
558 return Format(format, args, max_precision, descriptor_pool,
559 message_factory, arena);
560 })));
561 return absl::OkStatus();
562}
563
564} // namespace cel::extensions

Callers 3

TEST_PFunction · 0.85
TESTFunction · 0.85
RegisterStringsFunctionsFunction · 0.85

Calls 2

FormatFunction · 0.85
RegisterMethod · 0.45

Tested by 2

TEST_PFunction · 0.68
TESTFunction · 0.68