| 63 | } |
| 64 | |
| 65 | absl::Status RegisterSizeFunctions(FunctionRegistry& registry) { |
| 66 | // String size |
| 67 | auto size_func = [](const StringValue& value) -> int64_t { |
| 68 | return value.Size(); |
| 69 | }; |
| 70 | |
| 71 | // Support global and receiver style size() operations on strings. |
| 72 | using StrSizeFnAdapter = UnaryFunctionAdapter<int64_t, const StringValue&>; |
| 73 | CEL_RETURN_IF_ERROR(StrSizeFnAdapter::RegisterGlobalOverload( |
| 74 | cel::builtin::kSize, size_func, registry)); |
| 75 | |
| 76 | CEL_RETURN_IF_ERROR(StrSizeFnAdapter::RegisterMemberOverload( |
| 77 | cel::builtin::kSize, size_func, registry)); |
| 78 | |
| 79 | // Bytes size |
| 80 | auto bytes_size_func = [](const BytesValue& value) -> int64_t { |
| 81 | return value.Size(); |
| 82 | }; |
| 83 | |
| 84 | // Support global and receiver style size() operations on bytes. |
| 85 | using BytesSizeFnAdapter = UnaryFunctionAdapter<int64_t, const BytesValue&>; |
| 86 | CEL_RETURN_IF_ERROR(BytesSizeFnAdapter::RegisterGlobalOverload( |
| 87 | cel::builtin::kSize, bytes_size_func, registry)); |
| 88 | |
| 89 | return BytesSizeFnAdapter::RegisterMemberOverload(cel::builtin::kSize, |
| 90 | bytes_size_func, registry); |
| 91 | } |
| 92 | |
| 93 | absl::Status RegisterConcatFunctions(FunctionRegistry& registry) { |
| 94 | using StrCatFnAdapter = |
no test coverage detected