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

Function CelValueEquals

common/values/value_builder.cc:736–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734}
735
736bool CelValueEquals(const CelValue& lhs, const Value& rhs) {
737 switch (lhs.type()) {
738 case CelValue::Type::kBool:
739 switch (rhs.kind()) {
740 case ValueKind::kBool:
741 return BoolValue(lhs.BoolOrDie()) == rhs.GetBool();
742 case ValueKind::kInt:
743 return false;
744 case ValueKind::kUint:
745 return false;
746 case ValueKind::kString:
747 return false;
748 default:
749 ABSL_UNREACHABLE();
750 }
751 case CelValue::Type::kInt:
752 switch (rhs.kind()) {
753 case ValueKind::kBool:
754 return false;
755 case ValueKind::kInt:
756 return IntValue(lhs.Int64OrDie()) == rhs.GetInt();
757 case ValueKind::kUint:
758 return false;
759 case ValueKind::kString:
760 return false;
761 default:
762 ABSL_UNREACHABLE();
763 }
764 case CelValue::Type::kUint:
765 switch (rhs.kind()) {
766 case ValueKind::kBool:
767 return false;
768 case ValueKind::kInt:
769 return false;
770 case ValueKind::kUint:
771 return UintValue(lhs.Uint64OrDie()) == rhs.GetUint();
772 case ValueKind::kString:
773 return false;
774 default:
775 ABSL_UNREACHABLE();
776 }
777 case CelValue::Type::kString:
778 switch (rhs.kind()) {
779 case ValueKind::kBool:
780 return false;
781 case ValueKind::kInt:
782 return false;
783 case ValueKind::kUint:
784 return false;
785 case ValueKind::kString:
786 return rhs.GetString().Equals(lhs.StringOrDie().value());
787 default:
788 ABSL_UNREACHABLE();
789 }
790 default:
791 ABSL_UNREACHABLE();
792 }
793}

Callers

nothing calls this directly

Calls 15

typeMethod · 0.80
BoolOrDieMethod · 0.80
Int64OrDieMethod · 0.80
Uint64OrDieMethod · 0.80
StringOrDieMethod · 0.80
BoolValueClass · 0.70
IntValueClass · 0.70
UintValueClass · 0.70
kindMethod · 0.45
GetBoolMethod · 0.45
GetIntMethod · 0.45
GetUintMethod · 0.45

Tested by

no test coverage detected