/proc/self/cwd/common/values/map_value.cc
Line | Count | Source |
1 | | // Copyright 2023 Google LLC |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #include <cstddef> |
16 | | #include <string> |
17 | | #include <utility> |
18 | | |
19 | | #include "absl/base/attributes.h" |
20 | | #include "absl/base/nullability.h" |
21 | | #include "absl/log/absl_check.h" |
22 | | #include "absl/status/status.h" |
23 | | #include "absl/status/statusor.h" |
24 | | #include "absl/strings/str_cat.h" |
25 | | #include "absl/types/optional.h" |
26 | | #include "common/native_type.h" |
27 | | #include "common/optional_ref.h" |
28 | | #include "common/value.h" |
29 | | #include "common/value_kind.h" |
30 | | #include "common/values/value_variant.h" |
31 | | #include "internal/status_macros.h" |
32 | | #include "google/protobuf/arena.h" |
33 | | #include "google/protobuf/descriptor.h" |
34 | | #include "google/protobuf/io/zero_copy_stream.h" |
35 | | #include "google/protobuf/message.h" |
36 | | |
37 | | namespace cel { |
38 | | |
39 | | namespace { |
40 | | |
41 | 136 | absl::Status InvalidMapKeyTypeError(ValueKind kind) { |
42 | 136 | return absl::InvalidArgumentError( |
43 | 136 | absl::StrCat("Invalid map key type: '", ValueKindToString(kind), "'")); |
44 | 136 | } |
45 | | |
46 | | } // namespace |
47 | | |
48 | 0 | NativeTypeId MapValue::GetTypeId() const { |
49 | 0 | return variant_.Visit([](const auto& alternative) -> NativeTypeId { |
50 | 0 | return NativeTypeId::Of(alternative); |
51 | 0 | }); Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:cel::TypeInfo cel::MapValue::GetTypeId() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
52 | 0 | } |
53 | | |
54 | 0 | std::string MapValue::DebugString() const { |
55 | 0 | return variant_.Visit([](const auto& alternative) -> std::string { |
56 | 0 | return alternative.DebugString(); |
57 | 0 | }); Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::MapValue::DebugString() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
58 | 0 | } |
59 | | |
60 | | absl::Status MapValue::SerializeTo( |
61 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
62 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
63 | 0 | google::protobuf::io::ZeroCopyOutputStream* absl_nonnull output) const { |
64 | 0 | ABSL_DCHECK(descriptor_pool != nullptr); |
65 | 0 | ABSL_DCHECK(message_factory != nullptr); |
66 | 0 | ABSL_DCHECK(output != nullptr); |
67 | |
|
68 | 0 | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
69 | 0 | return alternative.SerializeTo(descriptor_pool, message_factory, output); |
70 | 0 | }); Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
71 | 0 | } |
72 | | |
73 | | absl::Status MapValue::ConvertToJson( |
74 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
75 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
76 | 0 | google::protobuf::Message* absl_nonnull json) const { |
77 | 0 | ABSL_DCHECK(descriptor_pool != nullptr); |
78 | 0 | ABSL_DCHECK(message_factory != nullptr); |
79 | 0 | ABSL_DCHECK(json != nullptr); |
80 | 0 | ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(), |
81 | 0 | google::protobuf::Descriptor::WELLKNOWNTYPE_VALUE); |
82 | |
|
83 | 0 | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
84 | 0 | return alternative.ConvertToJson(descriptor_pool, message_factory, json); |
85 | 0 | }); Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
86 | 0 | } |
87 | | |
88 | | absl::Status MapValue::ConvertToJsonObject( |
89 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
90 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
91 | 0 | google::protobuf::Message* absl_nonnull json) const { |
92 | 0 | ABSL_DCHECK(descriptor_pool != nullptr); |
93 | 0 | ABSL_DCHECK(message_factory != nullptr); |
94 | 0 | ABSL_DCHECK(json != nullptr); |
95 | 0 | ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(), |
96 | 0 | google::protobuf::Descriptor::WELLKNOWNTYPE_STRUCT); |
97 | |
|
98 | 0 | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
99 | 0 | return alternative.ConvertToJsonObject(descriptor_pool, message_factory, |
100 | 0 | json); |
101 | 0 | }); Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
102 | 0 | } |
103 | | |
104 | | absl::Status MapValue::Equal( |
105 | | const Value& other, |
106 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
107 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
108 | 0 | google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const { |
109 | 0 | ABSL_DCHECK(descriptor_pool != nullptr); |
110 | 0 | ABSL_DCHECK(message_factory != nullptr); |
111 | 0 | ABSL_DCHECK(arena != nullptr); |
112 | 0 | ABSL_DCHECK(result != nullptr); |
113 | |
|
114 | 0 | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
115 | 0 | return alternative.Equal(other, descriptor_pool, message_factory, arena, |
116 | 0 | result); |
117 | 0 | }); Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
118 | 0 | } |
119 | | |
120 | 0 | bool MapValue::IsZeroValue() const { |
121 | 0 | return variant_.Visit([](const auto& alternative) -> bool { |
122 | 0 | return alternative.IsZeroValue(); |
123 | 0 | }); Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:bool cel::MapValue::IsZeroValue() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
124 | 0 | } |
125 | | |
126 | 0 | absl::StatusOr<bool> MapValue::IsEmpty() const { |
127 | 0 | return variant_.Visit([](const auto& alternative) -> absl::StatusOr<bool> { |
128 | 0 | return alternative.IsEmpty(); |
129 | 0 | }); Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::IsEmpty() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
130 | 0 | } |
131 | | |
132 | 111 | absl::StatusOr<size_t> MapValue::Size() const { |
133 | 111 | return variant_.Visit([](const auto& alternative) -> absl::StatusOr<size_t> { |
134 | 111 | return alternative.Size(); |
135 | 111 | }); map_value.cc:absl::lts_20260107::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Line | Count | Source | 133 | 110 | return variant_.Visit([](const auto& alternative) -> absl::StatusOr<size_t> { | 134 | 110 | return alternative.Size(); | 135 | 110 | }); |
Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const map_value.cc:absl::lts_20260107::StatusOr<unsigned long> cel::MapValue::Size() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const Line | Count | Source | 133 | 1 | return variant_.Visit([](const auto& alternative) -> absl::StatusOr<size_t> { | 134 | 1 | return alternative.Size(); | 135 | 1 | }); |
|
136 | 111 | } |
137 | | |
138 | | absl::Status MapValue::Get( |
139 | | const Value& key, |
140 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
141 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
142 | 2.41k | google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const { |
143 | 2.41k | ABSL_DCHECK(descriptor_pool != nullptr); |
144 | 2.41k | ABSL_DCHECK(message_factory != nullptr); |
145 | 2.41k | ABSL_DCHECK(arena != nullptr); |
146 | 2.41k | ABSL_DCHECK(result != nullptr); |
147 | | |
148 | 2.41k | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
149 | 2.41k | return alternative.Get(key, descriptor_pool, message_factory, arena, |
150 | 2.41k | result); |
151 | 2.41k | }); map_value.cc:absl::lts_20260107::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Line | Count | Source | 148 | 1.98k | return variant_.Visit([&](const auto& alternative) -> absl::Status { | 149 | 1.98k | return alternative.Get(key, descriptor_pool, message_factory, arena, | 150 | 1.98k | result); | 151 | 1.98k | }); |
Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const map_value.cc:absl::lts_20260107::Status cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const Line | Count | Source | 148 | 433 | return variant_.Visit([&](const auto& alternative) -> absl::Status { | 149 | 433 | return alternative.Get(key, descriptor_pool, message_factory, arena, | 150 | 433 | result); | 151 | 433 | }); |
|
152 | 2.41k | } |
153 | | |
154 | | absl::StatusOr<bool> MapValue::Find( |
155 | | const Value& key, |
156 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
157 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
158 | 3.54k | google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const { |
159 | 3.54k | ABSL_DCHECK(descriptor_pool != nullptr); |
160 | 3.54k | ABSL_DCHECK(message_factory != nullptr); |
161 | 3.54k | ABSL_DCHECK(arena != nullptr); |
162 | 3.54k | ABSL_DCHECK(result != nullptr); |
163 | | |
164 | 3.54k | return variant_.Visit([&](const auto& alternative) -> absl::StatusOr<bool> { |
165 | 3.54k | return alternative.Find(key, descriptor_pool, message_factory, arena, |
166 | 3.54k | result); |
167 | 3.54k | }); map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Line | Count | Source | 164 | 3.38k | return variant_.Visit([&](const auto& alternative) -> absl::StatusOr<bool> { | 165 | 3.38k | return alternative.Find(key, descriptor_pool, message_factory, arena, | 166 | 3.38k | result); | 167 | 3.38k | }); |
Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const map_value.cc:absl::lts_20260107::StatusOr<bool> cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const Line | Count | Source | 164 | 158 | return variant_.Visit([&](const auto& alternative) -> absl::StatusOr<bool> { | 165 | 158 | return alternative.Find(key, descriptor_pool, message_factory, arena, | 166 | 158 | result); | 167 | 158 | }); |
|
168 | 3.54k | } |
169 | | |
170 | | absl::Status MapValue::Has( |
171 | | const Value& key, |
172 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
173 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
174 | 583 | google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const { |
175 | 583 | ABSL_DCHECK(descriptor_pool != nullptr); |
176 | 583 | ABSL_DCHECK(message_factory != nullptr); |
177 | 583 | ABSL_DCHECK(arena != nullptr); |
178 | 583 | ABSL_DCHECK(result != nullptr); |
179 | | |
180 | 583 | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
181 | 583 | return alternative.Has(key, descriptor_pool, message_factory, arena, |
182 | 583 | result); |
183 | 583 | }); map_value.cc:absl::lts_20260107::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Line | Count | Source | 180 | 435 | return variant_.Visit([&](const auto& alternative) -> absl::Status { | 181 | 435 | return alternative.Has(key, descriptor_pool, message_factory, arena, | 182 | 435 | result); | 183 | 435 | }); |
Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const map_value.cc:absl::lts_20260107::Status cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const Line | Count | Source | 180 | 148 | return variant_.Visit([&](const auto& alternative) -> absl::Status { | 181 | 148 | return alternative.Has(key, descriptor_pool, message_factory, arena, | 182 | 148 | result); | 183 | 148 | }); |
|
184 | 583 | } |
185 | | |
186 | | absl::Status MapValue::ListKeys( |
187 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
188 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
189 | 0 | google::protobuf::Arena* absl_nonnull arena, ListValue* absl_nonnull result) const { |
190 | 0 | ABSL_DCHECK(descriptor_pool != nullptr); |
191 | 0 | ABSL_DCHECK(message_factory != nullptr); |
192 | 0 | ABSL_DCHECK(arena != nullptr); |
193 | 0 | ABSL_DCHECK(result != nullptr); |
194 | |
|
195 | 0 | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
196 | 0 | return alternative.ListKeys(descriptor_pool, message_factory, arena, |
197 | 0 | result); |
198 | 0 | }); Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
199 | 0 | } |
200 | | |
201 | | absl::Status MapValue::ForEach( |
202 | | ForEachCallback callback, |
203 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
204 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
205 | 0 | google::protobuf::Arena* absl_nonnull arena) const { |
206 | 0 | ABSL_DCHECK(descriptor_pool != nullptr); |
207 | 0 | ABSL_DCHECK(message_factory != nullptr); |
208 | 0 | ABSL_DCHECK(arena != nullptr); |
209 | |
|
210 | 0 | return variant_.Visit([&](const auto& alternative) -> absl::Status { |
211 | 0 | return alternative.ForEach(callback, descriptor_pool, message_factory, |
212 | 0 | arena); |
213 | 0 | }); Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ForEach(absl::lts_20260107::FunctionRef<absl::lts_20260107::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ForEach(absl::lts_20260107::FunctionRef<absl::lts_20260107::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ForEach(absl::lts_20260107::FunctionRef<absl::lts_20260107::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::Status cel::MapValue::ForEach(absl::lts_20260107::FunctionRef<absl::lts_20260107::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
214 | 0 | } |
215 | | |
216 | 45 | absl::StatusOr<absl_nonnull ValueIteratorPtr> MapValue::NewIterator() const { |
217 | 45 | return variant_.Visit([](const auto& alternative) |
218 | 45 | -> absl::StatusOr<absl_nonnull ValueIteratorPtr> { |
219 | 45 | return alternative.NewIterator(); |
220 | 45 | }); map_value.cc:absl::lts_20260107::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Line | Count | Source | 218 | 45 | -> absl::StatusOr<absl_nonnull ValueIteratorPtr> { | 219 | 45 | return alternative.NewIterator(); | 220 | 45 | }); |
Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:absl::lts_20260107::StatusOr<std::__1::unique_ptr<cel::ValueIterator, std::__1::default_delete<cel::ValueIterator> > > cel::MapValue::NewIterator() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
221 | 45 | } |
222 | | |
223 | | namespace common_internal { |
224 | | |
225 | | absl::Status MapValueEqual( |
226 | | const MapValue& lhs, const MapValue& rhs, |
227 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
228 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
229 | 0 | google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) { |
230 | 0 | ABSL_DCHECK(descriptor_pool != nullptr); |
231 | 0 | ABSL_DCHECK(message_factory != nullptr); |
232 | 0 | ABSL_DCHECK(arena != nullptr); |
233 | 0 | ABSL_DCHECK(result != nullptr); |
234 | |
|
235 | 0 | CEL_ASSIGN_OR_RETURN(auto lhs_size, lhs.Size()); |
236 | 0 | CEL_ASSIGN_OR_RETURN(auto rhs_size, rhs.Size()); |
237 | 0 | if (lhs_size != rhs_size) { |
238 | 0 | *result = FalseValue(); |
239 | 0 | return absl::OkStatus(); |
240 | 0 | } |
241 | 0 | CEL_ASSIGN_OR_RETURN(auto lhs_iterator, lhs.NewIterator()); |
242 | 0 | Value lhs_key; |
243 | 0 | Value lhs_value; |
244 | 0 | Value rhs_value; |
245 | 0 | for (size_t index = 0; index < lhs_size; ++index) { |
246 | 0 | ABSL_CHECK(lhs_iterator->HasNext()); // Crash OK |
247 | 0 | CEL_RETURN_IF_ERROR( |
248 | 0 | lhs_iterator->Next(descriptor_pool, message_factory, arena, &lhs_key)); |
249 | 0 | bool rhs_value_found; |
250 | 0 | CEL_ASSIGN_OR_RETURN( |
251 | 0 | rhs_value_found, |
252 | 0 | rhs.Find(lhs_key, descriptor_pool, message_factory, arena, &rhs_value)); |
253 | 0 | if (!rhs_value_found) { |
254 | 0 | *result = FalseValue(); |
255 | 0 | return absl::OkStatus(); |
256 | 0 | } |
257 | 0 | CEL_RETURN_IF_ERROR( |
258 | 0 | lhs.Get(lhs_key, descriptor_pool, message_factory, arena, &lhs_value)); |
259 | 0 | CEL_RETURN_IF_ERROR(lhs_value.Equal(rhs_value, descriptor_pool, |
260 | 0 | message_factory, arena, result)); |
261 | 0 | if (result->IsFalse()) { |
262 | 0 | return absl::OkStatus(); |
263 | 0 | } |
264 | 0 | } |
265 | 0 | ABSL_DCHECK(!lhs_iterator->HasNext()); |
266 | 0 | *result = TrueValue(); |
267 | 0 | return absl::OkStatus(); |
268 | 0 | } |
269 | | |
270 | | absl::Status MapValueEqual( |
271 | | const CustomMapValueInterface& lhs, const MapValue& rhs, |
272 | | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
273 | | google::protobuf::MessageFactory* absl_nonnull message_factory, |
274 | 11 | google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) { |
275 | 11 | ABSL_DCHECK(descriptor_pool != nullptr); |
276 | 11 | ABSL_DCHECK(message_factory != nullptr); |
277 | 11 | ABSL_DCHECK(arena != nullptr); |
278 | 11 | ABSL_DCHECK(result != nullptr); |
279 | | |
280 | 11 | auto lhs_size = lhs.Size(); |
281 | 11 | CEL_ASSIGN_OR_RETURN(auto rhs_size, rhs.Size()); |
282 | 11 | if (lhs_size != rhs_size) { |
283 | 0 | *result = FalseValue(); |
284 | 0 | return absl::OkStatus(); |
285 | 0 | } |
286 | 22 | CEL_ASSIGN_OR_RETURN(auto lhs_iterator, lhs.NewIterator()); |
287 | 22 | Value lhs_key; |
288 | 22 | Value lhs_value; |
289 | 22 | Value rhs_value; |
290 | 22 | for (size_t index = 0; index < lhs_size; ++index) { |
291 | 0 | ABSL_CHECK(lhs_iterator->HasNext()); // Crash OK |
292 | 0 | CEL_RETURN_IF_ERROR( |
293 | 0 | lhs_iterator->Next(descriptor_pool, message_factory, arena, &lhs_key)); |
294 | 0 | bool rhs_value_found; |
295 | 0 | CEL_ASSIGN_OR_RETURN( |
296 | 0 | rhs_value_found, |
297 | 0 | rhs.Find(lhs_key, descriptor_pool, message_factory, arena, &rhs_value)); |
298 | 0 | if (!rhs_value_found) { |
299 | 0 | *result = FalseValue(); |
300 | 0 | return absl::OkStatus(); |
301 | 0 | } |
302 | 0 | CEL_RETURN_IF_ERROR( |
303 | 0 | CustomMapValue(&lhs, arena) |
304 | 0 | .Get(lhs_key, descriptor_pool, message_factory, arena, &lhs_value)); |
305 | 0 | CEL_RETURN_IF_ERROR(lhs_value.Equal(rhs_value, descriptor_pool, |
306 | 0 | message_factory, arena, result)); |
307 | 0 | if (result->IsFalse()) { |
308 | 0 | return absl::OkStatus(); |
309 | 0 | } |
310 | 0 | } |
311 | 11 | ABSL_DCHECK(!lhs_iterator->HasNext()); |
312 | 11 | *result = TrueValue(); |
313 | 11 | return absl::OkStatus(); |
314 | 11 | } |
315 | | |
316 | | } // namespace common_internal |
317 | | |
318 | 6.54k | absl::Status CheckMapKey(const Value& key) { |
319 | 6.54k | switch (key.kind()) { |
320 | 213 | case ValueKind::kBool: |
321 | 213 | ABSL_FALLTHROUGH_INTENDED; |
322 | 4.14k | case ValueKind::kInt: |
323 | 4.14k | ABSL_FALLTHROUGH_INTENDED; |
324 | 4.34k | case ValueKind::kUint: |
325 | 4.34k | ABSL_FALLTHROUGH_INTENDED; |
326 | 6.40k | case ValueKind::kString: |
327 | 6.40k | return absl::OkStatus(); |
328 | 0 | case ValueKind::kError: |
329 | 0 | return key.GetError().NativeValue(); |
330 | 136 | default: |
331 | 136 | return InvalidMapKeyTypeError(key.kind()); |
332 | 6.54k | } |
333 | 6.54k | } |
334 | | |
335 | 0 | optional_ref<const CustomMapValue> MapValue::AsCustom() const& { |
336 | 0 | if (const auto* alternative = variant_.As<CustomMapValue>(); |
337 | 0 | alternative != nullptr) { |
338 | 0 | return *alternative; |
339 | 0 | } |
340 | 0 | return absl::nullopt; |
341 | 0 | } |
342 | | |
343 | 0 | absl::optional<CustomMapValue> MapValue::AsCustom() && { |
344 | 0 | if (auto* alternative = variant_.As<CustomMapValue>(); |
345 | 0 | alternative != nullptr) { |
346 | 0 | return std::move(*alternative); |
347 | 0 | } |
348 | 0 | return absl::nullopt; |
349 | 0 | } |
350 | | |
351 | 0 | const CustomMapValue& MapValue::GetCustom() const& { |
352 | 0 | ABSL_DCHECK(IsCustom()); |
353 | |
|
354 | 0 | return variant_.Get<CustomMapValue>(); |
355 | 0 | } |
356 | | |
357 | 0 | CustomMapValue MapValue::GetCustom() && { |
358 | 0 | ABSL_DCHECK(IsCustom()); |
359 | |
|
360 | 0 | return std::move(variant_).Get<CustomMapValue>(); |
361 | 0 | } |
362 | | |
363 | 0 | common_internal::ValueVariant MapValue::ToValueVariant() const& { |
364 | 0 | return variant_.Visit( |
365 | 0 | [](const auto& alternative) -> common_internal::ValueVariant { |
366 | 0 | return common_internal::ValueVariant(alternative); |
367 | 0 | }); Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() const &::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const |
368 | 0 | } |
369 | | |
370 | 8.80k | common_internal::ValueVariant MapValue::ToValueVariant() && { |
371 | 8.80k | return std::move(variant_).Visit( |
372 | 8.80k | [](auto&& alternative) -> common_internal::ValueVariant { |
373 | | // NOLINTNEXTLINE(bugprone-move-forwarding-reference) |
374 | 8.80k | return common_internal::ValueVariant(std::move(alternative)); |
375 | 8.80k | }); map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::CustomMapValue const&>(cel::CustomMapValue const&) const Line | Count | Source | 372 | 8.13k | [](auto&& alternative) -> common_internal::ValueVariant { | 373 | | // NOLINTNEXTLINE(bugprone-move-forwarding-reference) | 374 | 8.13k | return common_internal::ValueVariant(std::move(alternative)); | 375 | 8.13k | }); |
Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::ParsedMapFieldValue const&>(cel::ParsedMapFieldValue const&) const Unexecuted instantiation: map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::ParsedJsonMapValue const&>(cel::ParsedJsonMapValue const&) const map_value.cc:cel::common_internal::ValueVariant cel::MapValue::ToValueVariant() &&::$_0::operator()<cel::common_internal::LegacyMapValue const&>(cel::common_internal::LegacyMapValue const&) const Line | Count | Source | 372 | 677 | [](auto&& alternative) -> common_internal::ValueVariant { | 373 | | // NOLINTNEXTLINE(bugprone-move-forwarding-reference) | 374 | 677 | return common_internal::ValueVariant(std::move(alternative)); | 375 | 677 | }); |
|
376 | 8.80k | } |
377 | | |
378 | | } // namespace cel |