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

Class ParsedMessageValue

common/values/parsed_message_value.h:55–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53class Value;
54
55class ParsedMessageValue final
56 : private common_internal::StructValueMixin<ParsedMessageValue> {
57 public:
58 static constexpr ValueKind kKind = ValueKind::kStruct;
59
60 using element_type = const google::protobuf::Message;
61
62 ParsedMessageValue(
63 const google::protobuf::Message* absl_nonnull value ABSL_ATTRIBUTE_LIFETIME_BOUND,
64 google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND)
65 : value_(value), arena_(arena) {
66 ABSL_DCHECK(value != nullptr);
67 ABSL_DCHECK(arena != nullptr);
68 ABSL_DCHECK(!value_ || !IsWellKnownMessageType(value_->GetDescriptor()))
69 << value_->GetTypeName() << " is a well known type";
70 ABSL_DCHECK(!value_ || value_->GetReflection() != nullptr)
71 << value_->GetTypeName() << " is missing reflection";
72 ABSL_DCHECK_OK(CheckArena(value_, arena_));
73 }
74
75 // Places the `ParsedMessageValue` into a special state where it is logically
76 // equivalent to the default instance of `google.protobuf.Empty`, however
77 // dereferencing via `operator*` or `operator->` is not allowed.
78 ParsedMessageValue();
79 ParsedMessageValue(const ParsedMessageValue&) = default;
80 ParsedMessageValue(ParsedMessageValue&&) = default;
81 ParsedMessageValue& operator=(const ParsedMessageValue&) = default;
82 ParsedMessageValue& operator=(ParsedMessageValue&&) = default;
83
84 static constexpr ValueKind kind() { return kKind; }
85
86 absl::string_view GetTypeName() const { return GetDescriptor()->full_name(); }
87
88 MessageType GetRuntimeType() const { return MessageType(GetDescriptor()); }
89
90 const google::protobuf::Descriptor* absl_nonnull GetDescriptor() const {
91 return (*this)->GetDescriptor();
92 }
93
94 const google::protobuf::Reflection* absl_nonnull GetReflection() const {
95 return (*this)->GetReflection();
96 }
97
98 const google::protobuf::Message& operator*() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
99 return *value_;
100 }
101
102 const google::protobuf::Message* absl_nonnull operator->() const
103 ABSL_ATTRIBUTE_LIFETIME_BOUND {
104 return value_;
105 }
106
107 bool IsZeroValue() const;
108
109 std::string DebugString() const;
110
111 // See Value::SerializeTo().
112 absl::Status SerializeTo(

Callers 1

UnsafeParsedMessageValueFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected