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

Function Int32FromValue

eval/public/structs/cel_proto_wrap_util.cc:811–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

809}
810
811google::protobuf::Message* Int32FromValue(const google::protobuf::Message* prototype,
812 const CelValue& value, google::protobuf::Arena* arena) {
813 int64_t val;
814 if (!value.GetValue(&val)) {
815 return nullptr;
816 }
817 if (!cel::internal::CheckedInt64ToInt32(val).ok()) {
818 return nullptr;
819 }
820 int32_t ival = static_cast<int32_t>(val);
821 auto* message = prototype->New(arena);
822 CEL_ASSIGN_OR_RETURN(
823 auto reflection,
824 cel::well_known_types::GetInt32ValueReflection(message->GetDescriptor()),
825 _.With(IgnoreErrorAndReturnNullptr()));
826 reflection.SetValue(message, ival);
827 return message;
828}
829
830google::protobuf::Message* Int64FromValue(const google::protobuf::Message* prototype,
831 const CelValue& value, google::protobuf::Arena* arena) {

Callers 1

MaybeWrapMessageMethod · 0.85

Calls 5

CheckedInt64ToInt32Function · 0.85
GetValueMethod · 0.45
okMethod · 0.45
NewMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected