Go to the documentation of this file.
15 #ifndef GRPC_CORE_LIB_TRANSPORT_PARSED_METADATA_H
16 #define GRPC_CORE_LIB_TRANSPORT_PARSED_METADATA_H
24 #include <type_traits>
27 #include "absl/functional/function_ref.h"
28 #include "absl/meta/type_traits.h"
29 #include "absl/strings/match.h"
30 #include "absl/strings/str_cat.h"
31 #include "absl/strings/string_view.h"
43 namespace metadata_detail {
47 template <
typename Which>
51 sizeof(
typename Which::MementoType) <=
sizeof(
grpc_slice)) ||
72 template <
typename Field,
typename CompatibleWithField,
typename Display>
76 Display (*display_from_field)(CompatibleWithField)) {
82 template <
typename Field>
90 template <
typename Field>
92 return *
static_cast<const Field*
>(
value.pointer);
105 template <Slice (*MementoToValue)(Slice)>
116 template <
typename MetadataContainer>
122 template <
typename Which>
126 typename Which::MementoType>
133 template <
typename Which>
139 typename Which::MementoType>
147 template <
typename Which>
208 return key_size + value_size + 32;
230 template <
typename Which>
232 template <
typename Which>
234 template <
typename Which>
237 template <Slice (*ParseMemento)(Slice, MetadataParseErrorFn)>
244 template <
typename T, T (*ParseMemento)(Slice, MetadataParseErrorFn)>
248 memcpy(
result->value_.trivial, &memento,
sizeof(memento));
256 namespace metadata_detail {}
258 template <
typename MetadataContainer>
259 const typename ParsedMetadata<MetadataContainer>::VTable*
261 static const VTable
vtable = {
266 [](
const Buffer&, MetadataContainer*) {},
278 template <
typename MetadataContainer>
279 template <
typename Which>
282 static const VTable
vtable = {
290 Which::MementoToValue(
291 metadata_detail::FieldFromTrivial<typename Which::MementoType>(
295 WithNewValueSetTrivial<typename Which::MementoType, Which::ParseMemento>,
300 metadata_detail::FieldFromTrivial<typename Which::MementoType>,
301 Which::DisplayValue);
310 template <
typename MetadataContainer>
311 template <
typename Which>
314 static const VTable
vtable = {
318 delete static_cast<typename Which::MementoType*
>(
value.pointer);
322 auto* p =
static_cast<typename Which::MementoType*
>(
value.pointer);
323 map->Set(Which(), Which::MementoToValue(*p));
327 result->value_.pointer =
new typename Which::MementoType(
334 metadata_detail::FieldFromPointer<typename Which::MementoType>,
335 Which::DisplayValue);
344 template <
typename MetadataContainer>
345 template <
typename Which>
348 static const VTable
vtable = {
354 metadata_detail::SetSliceValue<Which::MementoToValue>(
355 map->GetOrCreatePointer(Which()),
value);
358 WithNewValueSetSlice<Which::ParseMemento>,
363 Which::DisplayValue);
372 template <
typename MetadataContainer>
375 using KV = std::pair<Slice, Slice>;
377 delete static_cast<KV*
>(
value.pointer);
380 auto* p =
static_cast<KV*
>(
value.pointer);
381 map->unknown_.Append(p->first.as_string_view(), p->second.Ref());
386 static_cast<KV*
>(
result->value_.pointer)->
first.Ref(),
389 result->value_.pointer = p;
391 static const auto debug_string = [](
const Buffer&
value) {
392 auto* p =
static_cast<KV*
>(
value.pointer);
394 p->second.as_string_view());
396 static const auto key_fn = [](
const Buffer&
value) {
397 return static_cast<KV*
>(
value.pointer)->
first.as_string_view();
399 static const VTable
vtable[2] = {
400 {
false,
destroy,
set, with_new_value, debug_string,
"", key_fn},
401 {
true,
destroy,
set, with_new_value, debug_string,
"", key_fn},
408 #endif // GRPC_CORE_LIB_TRANSPORT_PARSED_METADATA_H
static const grpc_transport_vtable vtable
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
typename std::enable_if< B, T >::type enable_if_t
#define T(upbtypeconst, upbtype, ctype, default_value)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
struct grpc_slice grpc_slice
const FieldDescriptor * field
absl::FunctionRef< void(absl::string_view error, const Slice &value)> MetadataParseErrorFn
absl::string_view string_view
bool EndsWith(absl::string_view text, absl::string_view suffix) noexcept
static std::function< void(void *, Slot *)> destroy
static struct async_container * container
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:49