protobuf/src/google/protobuf/extension_set.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 //
35 // This header is logically internal, but is made public because it is used
36 // from protocol-compiler-generated code, which may reside in other components.
37 
38 #ifndef GOOGLE_PROTOBUF_EXTENSION_SET_H__
39 #define GOOGLE_PROTOBUF_EXTENSION_SET_H__
40 
41 #include <algorithm>
42 #include <cassert>
43 #include <map>
44 #include <string>
45 #include <utility>
46 #include <vector>
47 
48 #include <google/protobuf/stubs/common.h>
49 #include <google/protobuf/stubs/logging.h>
50 #include <google/protobuf/parse_context.h>
51 #include <google/protobuf/io/coded_stream.h>
52 #include <google/protobuf/port.h>
53 #include <google/protobuf/repeated_field.h>
54 #include <google/protobuf/wire_format_lite.h>
55 
56 // clang-format off
57 #include <google/protobuf/port_def.inc> // Must be last
58 // clang-format on
59 
60 #ifdef SWIG
61 #error "You cannot SWIG proto headers"
62 #endif
63 
64 namespace google {
65 namespace protobuf {
66 class Arena;
67 class Descriptor; // descriptor.h
68 class FieldDescriptor; // descriptor.h
69 class DescriptorPool; // descriptor.h
70 class MessageLite; // message_lite.h
71 class Message; // message.h
72 class MessageFactory; // message.h
73 class Reflection; // message.h
74 class UnknownFieldSet; // unknown_field_set.h
75 namespace internal {
76 class FieldSkipper; // wire_format_lite.h
77 } // namespace internal
78 } // namespace protobuf
79 } // namespace google
80 
81 namespace google {
82 namespace protobuf {
83 namespace internal {
84 
85 class InternalMetadata;
86 
87 // Used to store values of type WireFormatLite::FieldType without having to
88 // #include wire_format_lite.h. Also, ensures that we use only one byte to
89 // store these values, which is important to keep the layout of
90 // ExtensionSet::Extension small.
91 typedef uint8_t FieldType;
92 
93 // A function which, given an integer value, returns true if the number
94 // matches one of the defined values for the corresponding enum type. This
95 // is used with RegisterEnumExtension, below.
96 typedef bool EnumValidityFunc(int number);
97 
98 // Version of the above which takes an argument. This is needed to deal with
99 // extensions that are not compiled in.
100 typedef bool EnumValidityFuncWithArg(const void* arg, int number);
101 
102 // Information about a registered extension.
103 struct ExtensionInfo {
105  constexpr ExtensionInfo(const MessageLite* extendee, int param_number,
106  FieldType type_param, bool isrepeated, bool ispacked)
107  : message(extendee),
108  number(param_number),
109  type(type_param),
110  is_repeated(isrepeated),
111  is_packed(ispacked),
113 
114  const MessageLite* message = nullptr;
115  int number = 0;
116 
117  FieldType type = 0;
118  bool is_repeated = false;
119  bool is_packed = false;
120 
121  struct EnumValidityCheck {
123  const void* arg;
124  };
125 
126  struct MessageInfo {
127  const MessageLite* prototype;
128  };
129 
130  union {
131  EnumValidityCheck enum_validity_check;
132  MessageInfo message_info;
133  };
134 
135  // The descriptor for this extension, if one exists and is known. May be
136  // nullptr. Must not be nullptr if the descriptor for the extension does not
137  // live in the same pool as the descriptor for the containing type.
138  const FieldDescriptor* descriptor = nullptr;
139 };
140 
141 // Abstract interface for an object which looks up extension definitions. Used
142 // when parsing.
143 class PROTOBUF_EXPORT ExtensionFinder {
144  public:
145  virtual ~ExtensionFinder();
146 
147  // Find the extension with the given containing type and number.
148  virtual bool Find(int number, ExtensionInfo* output) = 0;
149 };
150 
151 // Implementation of ExtensionFinder which finds extensions defined in .proto
152 // files which have been compiled into the binary.
153 class PROTOBUF_EXPORT GeneratedExtensionFinder : public ExtensionFinder {
154  public:
155  explicit GeneratedExtensionFinder(const MessageLite* extendee)
156  : extendee_(extendee) {}
158 
159  // Returns true and fills in *output if found, otherwise returns false.
160  bool Find(int number, ExtensionInfo* output) override;
161 
162  private:
164 };
165 
166 // A FieldSkipper used for parsing MessageSet.
168 
169 // Note: extension_set_heavy.cc defines DescriptorPoolExtensionFinder for
170 // finding extensions from a DescriptorPool.
171 
172 // This is an internal helper class intended for use within the protocol buffer
173 // library and generated classes. Clients should not use it directly. Instead,
174 // use the generated accessors such as GetExtension() of the class being
175 // extended.
176 //
177 // This class manages extensions for a protocol message object. The
178 // message's HasExtension(), GetExtension(), MutableExtension(), and
179 // ClearExtension() methods are just thin wrappers around the embedded
180 // ExtensionSet. When parsing, if a tag number is encountered which is
181 // inside one of the message type's extension ranges, the tag is passed
182 // off to the ExtensionSet for parsing. Etc.
183 class PROTOBUF_EXPORT ExtensionSet {
184  public:
185  constexpr ExtensionSet();
186  explicit ExtensionSet(Arena* arena);
187  ~ExtensionSet();
188 
189  // These are called at startup by protocol-compiler-generated code to
190  // register known extensions. The registrations are used by ParseField()
191  // to look up extensions for parsed field numbers. Note that dynamic parsing
192  // does not use ParseField(); only protocol-compiler-generated parsing
193  // methods do.
194  static void RegisterExtension(const MessageLite* extendee, int number,
195  FieldType type, bool is_repeated,
196  bool is_packed);
197  static void RegisterEnumExtension(const MessageLite* extendee, int number,
198  FieldType type, bool is_repeated,
199  bool is_packed, EnumValidityFunc* is_valid);
200  static void RegisterMessageExtension(const MessageLite* extendee, int number,
201  FieldType type, bool is_repeated,
202  bool is_packed,
203  const MessageLite* prototype);
204 
205  // =================================================================
206 
207  // Add all fields which are currently present to the given vector. This
208  // is useful to implement Reflection::ListFields().
209  void AppendToList(const Descriptor* extendee, const DescriptorPool* pool,
210  std::vector<const FieldDescriptor*>* output) const;
211 
212  // =================================================================
213  // Accessors
214  //
215  // Generated message classes include type-safe templated wrappers around
216  // these methods. Generally you should use those rather than call these
217  // directly, unless you are doing low-level memory management.
218  //
219  // When calling any of these accessors, the extension number requested
220  // MUST exist in the DescriptorPool provided to the constructor. Otherwise,
221  // the method will fail an assert. Normally, though, you would not call
222  // these directly; you would either call the generated accessors of your
223  // message class (e.g. GetExtension()) or you would call the accessors
224  // of the reflection interface. In both cases, it is impossible to
225  // trigger this assert failure: the generated accessors only accept
226  // linked-in extension types as parameters, while the Reflection interface
227  // requires you to provide the FieldDescriptor describing the extension.
228  //
229  // When calling any of these accessors, a protocol-compiler-generated
230  // implementation of the extension corresponding to the number MUST
231  // be linked in, and the FieldDescriptor used to refer to it MUST be
232  // the one generated by that linked-in code. Otherwise, the method will
233  // die on an assert failure. The message objects returned by the message
234  // accessors are guaranteed to be of the correct linked-in type.
235  //
236  // These methods pretty much match Reflection except that:
237  // - They're not virtual.
238  // - They identify fields by number rather than FieldDescriptors.
239  // - They identify enum values using integers rather than descriptors.
240  // - Strings provide Mutable() in addition to Set() accessors.
241 
242  bool Has(int number) const;
243  int ExtensionSize(int number) const; // Size of a repeated extension.
244  int NumExtensions() const; // The number of extensions
245  FieldType ExtensionType(int number) const;
246  void ClearExtension(int number);
247 
248  // singular fields -------------------------------------------------
249 
250  int32_t GetInt32(int number, int32_t default_value) const;
251  int64_t GetInt64(int number, int64_t default_value) const;
252  uint32_t GetUInt32(int number, uint32_t default_value) const;
253  uint64_t GetUInt64(int number, uint64_t default_value) const;
254  float GetFloat(int number, float default_value) const;
255  double GetDouble(int number, double default_value) const;
256  bool GetBool(int number, bool default_value) const;
257  int GetEnum(int number, int default_value) const;
258  const std::string& GetString(int number,
259  const std::string& default_value) const;
260  const MessageLite& GetMessage(int number,
261  const MessageLite& default_value) const;
262  const MessageLite& GetMessage(int number, const Descriptor* message_type,
263  MessageFactory* factory) const;
264 
265  // |descriptor| may be nullptr so long as it is known that the descriptor for
266  // the extension lives in the same pool as the descriptor for the containing
267  // type.
268 #define desc const FieldDescriptor* descriptor // avoid line wrapping
269  void SetInt32(int number, FieldType type, int32_t value, desc);
270  void SetInt64(int number, FieldType type, int64_t value, desc);
271  void SetUInt32(int number, FieldType type, uint32_t value, desc);
272  void SetUInt64(int number, FieldType type, uint64_t value, desc);
273  void SetFloat(int number, FieldType type, float value, desc);
274  void SetDouble(int number, FieldType type, double value, desc);
275  void SetBool(int number, FieldType type, bool value, desc);
276  void SetEnum(int number, FieldType type, int value, desc);
277  void SetString(int number, FieldType type, std::string value, desc);
278  std::string* MutableString(int number, FieldType type, desc);
279  MessageLite* MutableMessage(int number, FieldType type,
280  const MessageLite& prototype, desc);
281  MessageLite* MutableMessage(const FieldDescriptor* descriptor,
282  MessageFactory* factory);
283  // Adds the given message to the ExtensionSet, taking ownership of the
284  // message object. Existing message with the same number will be deleted.
285  // If "message" is nullptr, this is equivalent to "ClearExtension(number)".
286  void SetAllocatedMessage(int number, FieldType type,
289  void UnsafeArenaSetAllocatedMessage(int number, FieldType type,
292  PROTOBUF_NODISCARD MessageLite* ReleaseMessage(int number,
293  const MessageLite& prototype);
294  MessageLite* UnsafeArenaReleaseMessage(int number,
295  const MessageLite& prototype);
296 
297  PROTOBUF_NODISCARD MessageLite* ReleaseMessage(
298  const FieldDescriptor* descriptor, MessageFactory* factory);
299  MessageLite* UnsafeArenaReleaseMessage(const FieldDescriptor* descriptor,
300  MessageFactory* factory);
301 #undef desc
302  Arena* GetArena() const { return arena_; }
303 
304  // repeated fields -------------------------------------------------
305 
306  // Fetches a RepeatedField extension by number; returns |default_value|
307  // if no such extension exists. User should not touch this directly; it is
308  // used by the GetRepeatedExtension() method.
309  const void* GetRawRepeatedField(int number, const void* default_value) const;
310  // Fetches a mutable version of a RepeatedField extension by number,
311  // instantiating one if none exists. Similar to above, user should not use
312  // this directly; it underlies MutableRepeatedExtension().
313  void* MutableRawRepeatedField(int number, FieldType field_type, bool packed,
314  const FieldDescriptor* desc);
315 
316  // This is an overload of MutableRawRepeatedField to maintain compatibility
317  // with old code using a previous API. This version of
318  // MutableRawRepeatedField() will GOOGLE_CHECK-fail on a missing extension.
319  // (E.g.: borg/clients/internal/proto1/proto2_reflection.cc.)
320  void* MutableRawRepeatedField(int number);
321 
322  int32_t GetRepeatedInt32(int number, int index) const;
323  int64_t GetRepeatedInt64(int number, int index) const;
324  uint32_t GetRepeatedUInt32(int number, int index) const;
325  uint64_t GetRepeatedUInt64(int number, int index) const;
326  float GetRepeatedFloat(int number, int index) const;
327  double GetRepeatedDouble(int number, int index) const;
328  bool GetRepeatedBool(int number, int index) const;
329  int GetRepeatedEnum(int number, int index) const;
330  const std::string& GetRepeatedString(int number, int index) const;
331  const MessageLite& GetRepeatedMessage(int number, int index) const;
332 
333  void SetRepeatedInt32(int number, int index, int32_t value);
334  void SetRepeatedInt64(int number, int index, int64_t value);
335  void SetRepeatedUInt32(int number, int index, uint32_t value);
336  void SetRepeatedUInt64(int number, int index, uint64_t value);
337  void SetRepeatedFloat(int number, int index, float value);
338  void SetRepeatedDouble(int number, int index, double value);
339  void SetRepeatedBool(int number, int index, bool value);
340  void SetRepeatedEnum(int number, int index, int value);
341  void SetRepeatedString(int number, int index, std::string value);
342  std::string* MutableRepeatedString(int number, int index);
343  MessageLite* MutableRepeatedMessage(int number, int index);
344 
345 #define desc const FieldDescriptor* descriptor // avoid line wrapping
346  void AddInt32(int number, FieldType type, bool packed, int32_t value, desc);
347  void AddInt64(int number, FieldType type, bool packed, int64_t value, desc);
348  void AddUInt32(int number, FieldType type, bool packed, uint32_t value, desc);
349  void AddUInt64(int number, FieldType type, bool packed, uint64_t value, desc);
350  void AddFloat(int number, FieldType type, bool packed, float value, desc);
351  void AddDouble(int number, FieldType type, bool packed, double value, desc);
352  void AddBool(int number, FieldType type, bool packed, bool value, desc);
353  void AddEnum(int number, FieldType type, bool packed, int value, desc);
354  void AddString(int number, FieldType type, std::string value, desc);
355  std::string* AddString(int number, FieldType type, desc);
357  const MessageLite& prototype, desc);
359  MessageFactory* factory);
360  void AddAllocatedMessage(const FieldDescriptor* descriptor,
361  MessageLite* new_entry);
362  void UnsafeArenaAddAllocatedMessage(const FieldDescriptor* descriptor,
363  MessageLite* new_entry);
364 #undef desc
365 
366  void RemoveLast(int number);
367  PROTOBUF_NODISCARD MessageLite* ReleaseLast(int number);
368  MessageLite* UnsafeArenaReleaseLast(int number);
369  void SwapElements(int number, int index1, int index2);
370 
371  // -----------------------------------------------------------------
372  // TODO(kenton): Hardcore memory management accessors
373 
374  // =================================================================
375  // convenience methods for implementing methods of Message
376  //
377  // These could all be implemented in terms of the other methods of this
378  // class, but providing them here helps keep the generated code size down.
379 
380  void Clear();
381  void MergeFrom(const MessageLite* extendee, const ExtensionSet& other);
382  void Swap(const MessageLite* extendee, ExtensionSet* other);
383  void InternalSwap(ExtensionSet* other);
384  void SwapExtension(const MessageLite* extendee, ExtensionSet* other,
385  int number);
386  void UnsafeShallowSwapExtension(ExtensionSet* other, int number);
387  bool IsInitialized() const;
388 
389  // Parses a single extension from the input. The input should start out
390  // positioned immediately after the tag.
391  bool ParseField(uint32_t tag, io::CodedInputStream* input,
392  ExtensionFinder* extension_finder,
393  FieldSkipper* field_skipper);
394 
395  // Specific versions for lite or full messages (constructs the appropriate
396  // FieldSkipper automatically). |extendee| is the default
397  // instance for the containing message; it is used only to look up the
398  // extension by number. See RegisterExtension(), above. Unlike the other
399  // methods of ExtensionSet, this only works for generated message types --
400  // it looks up extensions registered using RegisterExtension().
401  bool ParseField(uint32_t tag, io::CodedInputStream* input,
402  const MessageLite* extendee);
403  bool ParseField(uint32_t tag, io::CodedInputStream* input,
404  const Message* extendee, UnknownFieldSet* unknown_fields);
405  bool ParseField(uint32_t tag, io::CodedInputStream* input,
406  const MessageLite* extendee,
407  io::CodedOutputStream* unknown_fields);
408 
409  // Lite parser
410  const char* ParseField(uint64_t tag, const char* ptr,
411  const MessageLite* extendee,
412  internal::InternalMetadata* metadata,
413  internal::ParseContext* ctx);
414  // Full parser
415  const char* ParseField(uint64_t tag, const char* ptr, const Message* extendee,
416  internal::InternalMetadata* metadata,
417  internal::ParseContext* ctx);
418  template <typename Msg>
419  const char* ParseMessageSet(const char* ptr, const Msg* extendee,
422  struct MessageSetItem {
423  const char* _InternalParse(const char* ptr, ParseContext* ctx) {
424  return me->ParseMessageSetItem(ptr, extendee, metadata, ctx);
425  }
426  ExtensionSet* me;
427  const Msg* extendee;
429  } item{this, extendee, metadata};
430  while (!ctx->Done(&ptr)) {
431  uint32_t tag;
432  ptr = ReadTag(ptr, &tag);
435  ptr = ctx->ParseGroup(&item, ptr, tag);
437  } else {
438  if (tag == 0 || (tag & 7) == 4) {
439  ctx->SetLastTag(tag);
440  return ptr;
441  }
442  ptr = ParseField(tag, ptr, extendee, metadata, ctx);
444  }
445  }
446  return ptr;
447  }
448 
449  // Parse an entire message in MessageSet format. Such messages have no
450  // fields, only extensions.
451  bool ParseMessageSetLite(io::CodedInputStream* input,
452  ExtensionFinder* extension_finder,
453  FieldSkipper* field_skipper);
454  bool ParseMessageSet(io::CodedInputStream* input,
455  ExtensionFinder* extension_finder,
456  MessageSetFieldSkipper* field_skipper);
457 
458  // Specific versions for lite or full messages (constructs the appropriate
459  // FieldSkipper automatically).
460  bool ParseMessageSet(io::CodedInputStream* input, const MessageLite* extendee,
461  std::string* unknown_fields);
462  bool ParseMessageSet(io::CodedInputStream* input, const Message* extendee,
463  UnknownFieldSet* unknown_fields);
464 
465  // Write all extension fields with field numbers in the range
466  // [start_field_number, end_field_number)
467  // to the output stream, using the cached sizes computed when ByteSize() was
468  // last called. Note that the range bounds are inclusive-exclusive.
469  void SerializeWithCachedSizes(const MessageLite* extendee,
470  int start_field_number, int end_field_number,
471  io::CodedOutputStream* output) const {
472  output->SetCur(_InternalSerialize(extendee, start_field_number,
473  end_field_number, output->Cur(),
474  output->EpsCopy()));
475  }
476 
477  // Same as SerializeWithCachedSizes, but without any bounds checking.
478  // The caller must ensure that target has sufficient capacity for the
479  // serialized extensions.
480  //
481  // Returns a pointer past the last written byte.
482 
484  int start_field_number, int end_field_number,
485  uint8_t* target,
487  if (flat_size_ == 0) {
488  assert(!is_large());
489  return target;
490  }
491  return _InternalSerializeImpl(extendee, start_field_number,
492  end_field_number, target, stream);
493  }
494 
495  // Like above but serializes in MessageSet format.
497  io::CodedOutputStream* output) const {
498  output->SetCur(InternalSerializeMessageSetWithCachedSizesToArray(
499  extendee, output->Cur(), output->EpsCopy()));
500  }
501  uint8_t* InternalSerializeMessageSetWithCachedSizesToArray(
502  const MessageLite* extendee, uint8_t* target,
504 
505  // For backward-compatibility, versions of two of the above methods that
506  // serialize deterministically iff SetDefaultSerializationDeterministic()
507  // has been called.
508  uint8_t* SerializeWithCachedSizesToArray(int start_field_number,
509  int end_field_number,
510  uint8_t* target) const;
511  uint8_t* SerializeMessageSetWithCachedSizesToArray(
512  const MessageLite* extendee, uint8_t* target) const;
513 
514  // Returns the total serialized size of all the extensions.
515  size_t ByteSize() const;
516 
517  // Like ByteSize() but uses MessageSet format.
518  size_t MessageSetByteSize() const;
519 
520  // Returns (an estimate of) the total number of bytes used for storing the
521  // extensions in memory, excluding sizeof(*this). If the ExtensionSet is
522  // for a lite message (and thus possibly contains lite messages), the results
523  // are undefined (might work, might crash, might corrupt data, might not even
524  // be linked in). It's up to the protocol compiler to avoid calling this on
525  // such ExtensionSets (easy enough since lite messages don't implement
526  // SpaceUsed()).
527  size_t SpaceUsedExcludingSelfLong() const;
528 
529  // This method just calls SpaceUsedExcludingSelfLong() but it can not be
530  // inlined because the definition of SpaceUsedExcludingSelfLong() is not
531  // included in lite runtime and when an inline method refers to it MSVC
532  // will complain about unresolved symbols when building the lite runtime
533  // as .dll.
534  int SpaceUsedExcludingSelf() const;
535 
536  private:
537  template <typename Type>
538  friend class PrimitiveTypeTraits;
539 
540  template <typename Type>
542 
543  template <typename Type, bool IsValid(int)>
544  friend class EnumTypeTraits;
545 
546  template <typename Type, bool IsValid(int)>
548 
550 
551  const int32_t& GetRefInt32(int number, const int32_t& default_value) const;
552  const int64_t& GetRefInt64(int number, const int64_t& default_value) const;
553  const uint32_t& GetRefUInt32(int number, const uint32_t& default_value) const;
554  const uint64_t& GetRefUInt64(int number, const uint64_t& default_value) const;
555  const float& GetRefFloat(int number, const float& default_value) const;
556  const double& GetRefDouble(int number, const double& default_value) const;
557  const bool& GetRefBool(int number, const bool& default_value) const;
558  const int& GetRefEnum(int number, const int& default_value) const;
559  const int32_t& GetRefRepeatedInt32(int number, int index) const;
560  const int64_t& GetRefRepeatedInt64(int number, int index) const;
561  const uint32_t& GetRefRepeatedUInt32(int number, int index) const;
562  const uint64_t& GetRefRepeatedUInt64(int number, int index) const;
563  const float& GetRefRepeatedFloat(int number, int index) const;
564  const double& GetRefRepeatedDouble(int number, int index) const;
565  const bool& GetRefRepeatedBool(int number, int index) const;
566  const int& GetRefRepeatedEnum(int number, int index) const;
567 
568  // Implementation of _InternalSerialize for non-empty map_.
569  uint8_t* _InternalSerializeImpl(const MessageLite* extendee,
570  int start_field_number, int end_field_number,
571  uint8_t* target,
573  // Interface of a lazily parsed singular message extension.
574  class PROTOBUF_EXPORT LazyMessageExtension {
575  public:
578 
579  virtual LazyMessageExtension* New(Arena* arena) const = 0;
580  virtual const MessageLite& GetMessage(const MessageLite& prototype,
581  Arena* arena) const = 0;
582  virtual MessageLite* MutableMessage(const MessageLite& prototype,
583  Arena* arena) = 0;
584  virtual void SetAllocatedMessage(MessageLite* message, Arena* arena) = 0;
585  virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message,
586  Arena* arena) = 0;
587  PROTOBUF_NODISCARD virtual MessageLite* ReleaseMessage(
588  const MessageLite& prototype, Arena* arena) = 0;
589  virtual MessageLite* UnsafeArenaReleaseMessage(const MessageLite& prototype,
590  Arena* arena) = 0;
591 
592  virtual bool IsInitialized() const = 0;
593 
594  PROTOBUF_DEPRECATED_MSG("Please use ByteSizeLong() instead")
595  virtual int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); }
596  virtual size_t ByteSizeLong() const = 0;
597  virtual size_t SpaceUsedLong() const = 0;
598 
599  virtual void MergeFrom(const MessageLite* prototype,
600  const LazyMessageExtension& other, Arena* arena) = 0;
601  virtual void MergeFromMessage(const MessageLite& msg, Arena* arena) = 0;
602  virtual void Clear() = 0;
603 
604  virtual bool ReadMessage(const MessageLite& prototype,
606  virtual const char* _InternalParse(const Message& prototype, Arena* arena,
607  const char* ptr, ParseContext* ctx) = 0;
608  virtual uint8_t* WriteMessageToArray(
609  const MessageLite* prototype, int number, uint8_t* target,
610  io::EpsCopyOutputStream* stream) const = 0;
611 
612  private:
613  virtual void UnusedKeyMethod(); // Dummy key method to avoid weak vtable.
614 
616  };
617  // Give access to function defined below to see LazyMessageExtension.
618  friend LazyMessageExtension* MaybeCreateLazyExtension(Arena* arena);
619  struct Extension {
620  // The order of these fields packs Extension into 24 bytes when using 8
621  // byte alignment. Consider this when adding or removing fields here.
622  union {
627  float float_value;
628  double double_value;
629  bool bool_value;
630  int enum_value;
631  std::string* string_value;
632  MessageLite* message_value;
633  LazyMessageExtension* lazymessage_value;
634 
639  RepeatedField<float>* repeated_float_value;
640  RepeatedField<double>* repeated_double_value;
641  RepeatedField<bool>* repeated_bool_value;
642  RepeatedField<int>* repeated_enum_value;
643  RepeatedPtrField<std::string>* repeated_string_value;
644  RepeatedPtrField<MessageLite>* repeated_message_value;
645  };
646 
647  FieldType type;
648  bool is_repeated;
649 
650  // For singular types, indicates if the extension is "cleared". This
651  // happens when an extension is set and then later cleared by the caller.
652  // We want to keep the Extension object around for reuse, so instead of
653  // removing it from the map, we just set is_cleared = true. This has no
654  // meaning for repeated types; for those, the size of the RepeatedField
655  // simply becomes zero when cleared.
656  bool is_cleared : 4;
657 
658  // For singular message types, indicates whether lazy parsing is enabled
659  // for this extension. This field is only valid when type == TYPE_MESSAGE
660  // and !is_repeated because we only support lazy parsing for singular
661  // message types currently. If is_lazy = true, the extension is stored in
662  // lazymessage_value. Otherwise, the extension will be message_value.
663  bool is_lazy : 4;
664 
665  // For repeated types, this indicates if the [packed=true] option is set.
666  bool is_packed;
667 
668  // For packed fields, the size of the packed data is recorded here when
669  // ByteSize() is called then used during serialization.
670  // TODO(kenton): Use atomic<int> when C++ supports it.
671  mutable int cached_size;
672 
673  // The descriptor for this extension, if one exists and is known. May be
674  // nullptr. Must not be nullptr if the descriptor for the extension does
675  // not live in the same pool as the descriptor for the containing type.
677 
678  // Some helper methods for operations on a single Extension.
679  uint8_t* InternalSerializeFieldWithCachedSizesToArray(
680  const MessageLite* extendee, const ExtensionSet* extension_set,
682  uint8_t* InternalSerializeMessageSetItemWithCachedSizesToArray(
683  const MessageLite* extendee, const ExtensionSet* extension_set,
685  size_t ByteSize(int number) const;
686  size_t MessageSetItemByteSize(int number) const;
687  void Clear();
688  int GetSize() const;
689  void Free();
690  size_t SpaceUsedExcludingSelfLong() const;
691  bool IsInitialized() const;
692  };
693 
694  // The Extension struct is small enough to be passed by value, so we use it
695  // directly as the value type in mappings rather than use pointers. We use
696  // sorted maps rather than hash-maps because we expect most ExtensionSets will
697  // only contain a small number of extension. Also, we want AppendToList and
698  // deterministic serialization to order fields by field number.
699 
700  struct KeyValue {
701  int first;
702  Extension second;
703 
704  struct FirstComparator {
705  bool operator()(const KeyValue& lhs, const KeyValue& rhs) const {
706  return lhs.first < rhs.first;
707  }
708  bool operator()(const KeyValue& lhs, int key) const {
709  return lhs.first < key;
710  }
711  bool operator()(int key, const KeyValue& rhs) const {
712  return key < rhs.first;
713  }
714  };
715  };
716 
717  typedef std::map<int, Extension> LargeMap;
718 
719  // Wrapper API that switches between flat-map and LargeMap.
720 
721  // Finds a key (if present) in the ExtensionSet.
722  const Extension* FindOrNull(int key) const;
723  Extension* FindOrNull(int key);
724 
725  // Helper-functions that only inspect the LargeMap.
726  const Extension* FindOrNullInLargeMap(int key) const;
727  Extension* FindOrNullInLargeMap(int key);
728 
729  // Inserts a new (key, Extension) into the ExtensionSet (and returns true), or
730  // finds the already-existing Extension for that key (returns false).
731  // The Extension* will point to the new-or-found Extension.
732  std::pair<Extension*, bool> Insert(int key);
733 
734  // Grows the flat_capacity_.
735  // If flat_capacity_ > kMaximumFlatCapacity, converts to LargeMap.
736  void GrowCapacity(size_t minimum_new_capacity);
737  static constexpr uint16_t kMaximumFlatCapacity = 256;
738  bool is_large() const { return static_cast<int16_t>(flat_size_) < 0; }
739 
740  // Removes a key from the ExtensionSet.
741  void Erase(int key);
742 
743  size_t Size() const {
744  return PROTOBUF_PREDICT_FALSE(is_large()) ? map_.large->size() : flat_size_;
745  }
746 
747  // Similar to std::for_each.
748  // Each Iterator is decomposed into ->first and ->second fields, so
749  // that the KeyValueFunctor can be agnostic vis-a-vis KeyValue-vs-std::pair.
750  template <typename Iterator, typename KeyValueFunctor>
751  static KeyValueFunctor ForEach(Iterator begin, Iterator end,
752  KeyValueFunctor func) {
753  for (Iterator it = begin; it != end; ++it) func(it->first, it->second);
754  return std::move(func);
755  }
756 
757  // Applies a functor to the <int, Extension&> pairs in sorted order.
758  template <typename KeyValueFunctor>
759  KeyValueFunctor ForEach(KeyValueFunctor func) {
760  if (PROTOBUF_PREDICT_FALSE(is_large())) {
761  return ForEach(map_.large->begin(), map_.large->end(), std::move(func));
762  }
763  return ForEach(flat_begin(), flat_end(), std::move(func));
764  }
765 
766  // Applies a functor to the <int, const Extension&> pairs in sorted order.
767  template <typename KeyValueFunctor>
768  KeyValueFunctor ForEach(KeyValueFunctor func) const {
769  if (PROTOBUF_PREDICT_FALSE(is_large())) {
770  return ForEach(map_.large->begin(), map_.large->end(), std::move(func));
771  }
772  return ForEach(flat_begin(), flat_end(), std::move(func));
773  }
774 
775  // Merges existing Extension from other_extension
776  void InternalExtensionMergeFrom(const MessageLite* extendee, int number,
777  const Extension& other_extension,
778  Arena* other_arena);
779 
780  // Returns true and fills field_number and extension if extension is found.
781  // Note to support packed repeated field compatibility, it also fills whether
782  // the tag on wire is packed, which can be different from
783  // extension->is_packed (whether packed=true is specified).
784  bool FindExtensionInfoFromTag(uint32_t tag, ExtensionFinder* extension_finder,
785  int* field_number, ExtensionInfo* extension,
786  bool* was_packed_on_wire);
787 
788  // Returns true and fills extension if extension is found.
789  // Note to support packed repeated field compatibility, it also fills whether
790  // the tag on wire is packed, which can be different from
791  // extension->is_packed (whether packed=true is specified).
792  bool FindExtensionInfoFromFieldNumber(int wire_type, int field_number,
793  ExtensionFinder* extension_finder,
795  bool* was_packed_on_wire) const;
796 
797  // Find the prototype for a LazyMessage from the extension registry. Returns
798  // null if the extension is not found.
799  const MessageLite* GetPrototypeForLazyMessage(const MessageLite* extendee,
800  int number) const;
801 
802  // Parses a single extension from the input. The input should start out
803  // positioned immediately after the wire tag. This method is called in
804  // ParseField() after field number and was_packed_on_wire is extracted from
805  // the wire tag and ExtensionInfo is found by the field number.
806  bool ParseFieldWithExtensionInfo(int field_number, bool was_packed_on_wire,
807  const ExtensionInfo& extension,
809  FieldSkipper* field_skipper);
810 
811  // Like ParseField(), but this method may parse singular message extensions
812  // lazily depending on the value of FLAGS_eagerly_parse_message_sets.
813  bool ParseFieldMaybeLazily(int wire_type, int field_number,
815  ExtensionFinder* extension_finder,
816  MessageSetFieldSkipper* field_skipper);
817 
818  // Returns true if extension is present and lazy.
819  bool HasLazy(int number) const;
820 
821  // Gets the extension with the given number, creating it if it does not
822  // already exist. Returns true if the extension did not already exist.
823  bool MaybeNewExtension(int number, const FieldDescriptor* descriptor,
824  Extension** result);
825 
826  // Gets the repeated extension for the given descriptor, creating it if
827  // it does not exist.
828  Extension* MaybeNewRepeatedExtension(const FieldDescriptor* descriptor);
829 
830  // Parse a single MessageSet item -- called just after the item group start
831  // tag has been read.
832  bool ParseMessageSetItemLite(io::CodedInputStream* input,
833  ExtensionFinder* extension_finder,
834  FieldSkipper* field_skipper);
835  // Parse a single MessageSet item -- called just after the item group start
836  // tag has been read.
837  bool ParseMessageSetItem(io::CodedInputStream* input,
838  ExtensionFinder* extension_finder,
839  MessageSetFieldSkipper* field_skipper);
840 
841  bool FindExtension(int wire_type, uint32_t field, const MessageLite* extendee,
842  const internal::ParseContext* /*ctx*/,
843  ExtensionInfo* extension, bool* was_packed_on_wire) {
844  GeneratedExtensionFinder finder(extendee);
845  return FindExtensionInfoFromFieldNumber(wire_type, field, &finder,
846  extension, was_packed_on_wire);
847  }
848  inline bool FindExtension(int wire_type, uint32_t field,
849  const Message* extendee,
851  ExtensionInfo* extension, bool* was_packed_on_wire);
852  // Used for MessageSet only
853  const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr,
854  const MessageLite* extendee,
857  // Lite MessageSet doesn't implement lazy.
858  return ParseField(tag, ptr, extendee, metadata, ctx);
859  }
860  const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr,
861  const Message* extendee,
864  const char* ParseMessageSetItem(const char* ptr, const MessageLite* extendee,
867  const char* ParseMessageSetItem(const char* ptr, const Message* extendee,
870 
871  // Implemented in extension_set_inl.h to keep code out of the header file.
872  template <typename T>
873  const char* ParseFieldWithExtensionInfo(int number, bool was_packed_on_wire,
874  const ExtensionInfo& info,
876  const char* ptr,
878  template <typename Msg, typename T>
879  const char* ParseMessageSetItemTmpl(const char* ptr, const Msg* extendee,
882 
883  // Hack: RepeatedPtrFieldBase declares ExtensionSet as a friend. This
884  // friendship should automatically extend to ExtensionSet::Extension, but
885  // unfortunately some older compilers (e.g. GCC 3.4.4) do not implement this
886  // correctly. So, we must provide helpers for calling methods of that
887  // class.
888 
889  // Defined in extension_set_heavy.cc.
890  static inline size_t RepeatedMessage_SpaceUsedExcludingSelfLong(
892 
894  assert(!is_large());
895  return map_.flat;
896  }
897  const KeyValue* flat_begin() const {
898  assert(!is_large());
899  return map_.flat;
900  }
902  assert(!is_large());
903  return map_.flat + flat_size_;
904  }
905  const KeyValue* flat_end() const {
906  assert(!is_large());
907  return map_.flat + flat_size_;
908  }
909 
910  Arena* arena_;
911 
912  // Manual memory-management:
913  // map_.flat is an allocated array of flat_capacity_ elements.
914  // [map_.flat, map_.flat + flat_size_) is the currently-in-use prefix.
916  uint16_t flat_size_; // negative int16_t(flat_size_) indicates is_large()
917  union AllocatedData {
918  KeyValue* flat;
919 
920  // If flat_capacity_ > kMaximumFlatCapacity, switch to LargeMap,
921  // which guarantees O(n lg n) CPU but larger constant factors.
922  LargeMap* large;
923  } map_;
924 
925  static void DeleteFlatMap(const KeyValue* flat, uint16_t flat_capacity);
926 
928 };
929 
930 constexpr ExtensionSet::ExtensionSet()
931  : arena_(nullptr), flat_capacity_(0), flat_size_(0), map_{nullptr} {}
932 
933 // These are just for convenience...
936  const FieldDescriptor* descriptor) {
938 }
939 inline void ExtensionSet::SetRepeatedString(int number, int index,
940  std::string value) {
942 }
945  const FieldDescriptor* descriptor) {
947 }
948 // ===================================================================
949 // Glue for generated extension accessors
950 
951 // -------------------------------------------------------------------
952 // Template magic
953 
954 // First we have a set of classes representing "type traits" for different
955 // field types. A type traits class knows how to implement basic accessors
956 // for extensions of a particular type given an ExtensionSet. The signature
957 // for a type traits class looks like this:
958 //
959 // class TypeTraits {
960 // public:
961 // typedef ? ConstType;
962 // typedef ? MutableType;
963 // // TypeTraits for singular fields and repeated fields will define the
964 // // symbol "Singular" or "Repeated" respectively. These two symbols will
965 // // be used in extension accessors to distinguish between singular
966 // // extensions and repeated extensions. If the TypeTraits for the passed
967 // // in extension doesn't have the expected symbol defined, it means the
968 // // user is passing a repeated extension to a singular accessor, or the
969 // // opposite. In that case the C++ compiler will generate an error
970 // // message "no matching member function" to inform the user.
971 // typedef ? Singular
972 // typedef ? Repeated
973 //
974 // static inline ConstType Get(int number, const ExtensionSet& set);
975 // static inline void Set(int number, ConstType value, ExtensionSet* set);
976 // static inline MutableType Mutable(int number, ExtensionSet* set);
977 //
978 // // Variants for repeated fields.
979 // static inline ConstType Get(int number, const ExtensionSet& set,
980 // int index);
981 // static inline void Set(int number, int index,
982 // ConstType value, ExtensionSet* set);
983 // static inline MutableType Mutable(int number, int index,
984 // ExtensionSet* set);
985 // static inline void Add(int number, ConstType value, ExtensionSet* set);
986 // static inline MutableType Add(int number, ExtensionSet* set);
987 // This is used by the ExtensionIdentifier constructor to register
988 // the extension at dynamic initialization.
989 // template <typename ExtendeeT>
990 // static void Register(int number, FieldType type, bool is_packed);
991 // };
992 //
993 // Not all of these methods make sense for all field types. For example, the
994 // "Mutable" methods only make sense for strings and messages, and the
995 // repeated methods only make sense for repeated types. So, each type
996 // traits class implements only the set of methods from this signature that it
997 // actually supports. This will cause a compiler error if the user tries to
998 // access an extension using a method that doesn't make sense for its type.
999 // For example, if "foo" is an extension of type "optional int32", then if you
1000 // try to write code like:
1001 // my_message.MutableExtension(foo)
1002 // you will get a compile error because PrimitiveTypeTraits<int32_t> does not
1003 // have a "Mutable()" method.
1004 
1005 // -------------------------------------------------------------------
1006 // PrimitiveTypeTraits
1007 
1008 // Since the ExtensionSet has different methods for each primitive type,
1009 // we must explicitly define the methods of the type traits class for each
1010 // known type.
1011 template <typename Type>
1012 class PrimitiveTypeTraits {
1013  public:
1014  typedef Type ConstType;
1017 
1018  static inline ConstType Get(int number, const ExtensionSet& set,
1019  ConstType default_value);
1020 
1021  static inline const ConstType* GetPtr(int number, const ExtensionSet& set,
1022  const ConstType& default_value);
1023  static inline void Set(int number, FieldType field_type, ConstType value,
1024  ExtensionSet* set);
1025  template <typename ExtendeeT>
1026  static void Register(int number, FieldType type, bool is_packed) {
1027  ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
1028  type, false, is_packed);
1029  }
1030 };
1031 
1032 template <typename Type>
1033 class RepeatedPrimitiveTypeTraits {
1034  public:
1035  typedef Type ConstType;
1038 
1040 
1041  static inline Type Get(int number, const ExtensionSet& set, int index);
1042  static inline const Type* GetPtr(int number, const ExtensionSet& set,
1043  int index);
1044  static inline const RepeatedField<ConstType>* GetRepeatedPtr(
1045  int number, const ExtensionSet& set);
1046  static inline void Set(int number, int index, Type value, ExtensionSet* set);
1047  static inline void Add(int number, FieldType field_type, bool is_packed,
1049 
1050  static inline const RepeatedField<ConstType>& GetRepeated(
1051  int number, const ExtensionSet& set);
1052  static inline RepeatedField<Type>* MutableRepeated(int number,
1054  bool is_packed,
1055  ExtensionSet* set);
1056 
1058  template <typename ExtendeeT>
1059  static void Register(int number, FieldType type, bool is_packed) {
1060  ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
1061  type, true, is_packed);
1062  }
1063 };
1064 
1065 class PROTOBUF_EXPORT RepeatedPrimitiveDefaults {
1066  private:
1067  template <typename Type>
1069  static const RepeatedPrimitiveDefaults* default_instance();
1074  RepeatedField<double> default_repeated_field_double_;
1075  RepeatedField<float> default_repeated_field_float_;
1076  RepeatedField<bool> default_repeated_field_bool_;
1077 };
1078 
1079 #define PROTOBUF_DEFINE_PRIMITIVE_TYPE(TYPE, METHOD) \
1080  template <> \
1081  inline TYPE PrimitiveTypeTraits<TYPE>::Get( \
1082  int number, const ExtensionSet& set, TYPE default_value) { \
1083  return set.Get##METHOD(number, default_value); \
1084  } \
1085  template <> \
1086  inline const TYPE* PrimitiveTypeTraits<TYPE>::GetPtr( \
1087  int number, const ExtensionSet& set, const TYPE& default_value) { \
1088  return &set.GetRef##METHOD(number, default_value); \
1089  } \
1090  template <> \
1091  inline void PrimitiveTypeTraits<TYPE>::Set(int number, FieldType field_type, \
1092  TYPE value, ExtensionSet* set) { \
1093  set->Set##METHOD(number, field_type, value, nullptr); \
1094  } \
1095  \
1096  template <> \
1097  inline TYPE RepeatedPrimitiveTypeTraits<TYPE>::Get( \
1098  int number, const ExtensionSet& set, int index) { \
1099  return set.GetRepeated##METHOD(number, index); \
1100  } \
1101  template <> \
1102  inline const TYPE* RepeatedPrimitiveTypeTraits<TYPE>::GetPtr( \
1103  int number, const ExtensionSet& set, int index) { \
1104  return &set.GetRefRepeated##METHOD(number, index); \
1105  } \
1106  template <> \
1107  inline void RepeatedPrimitiveTypeTraits<TYPE>::Set( \
1108  int number, int index, TYPE value, ExtensionSet* set) { \
1109  set->SetRepeated##METHOD(number, index, value); \
1110  } \
1111  template <> \
1112  inline void RepeatedPrimitiveTypeTraits<TYPE>::Add( \
1113  int number, FieldType field_type, bool is_packed, TYPE value, \
1114  ExtensionSet* set) { \
1115  set->Add##METHOD(number, field_type, is_packed, value, nullptr); \
1116  } \
1117  template <> \
1118  inline const RepeatedField<TYPE>* \
1119  RepeatedPrimitiveTypeTraits<TYPE>::GetDefaultRepeatedField() { \
1120  return &RepeatedPrimitiveDefaults::default_instance() \
1121  ->default_repeated_field_##TYPE##_; \
1122  } \
1123  template <> \
1124  inline const RepeatedField<TYPE>& \
1125  RepeatedPrimitiveTypeTraits<TYPE>::GetRepeated(int number, \
1126  const ExtensionSet& set) { \
1127  return *reinterpret_cast<const RepeatedField<TYPE>*>( \
1128  set.GetRawRepeatedField(number, GetDefaultRepeatedField())); \
1129  } \
1130  template <> \
1131  inline const RepeatedField<TYPE>* \
1132  RepeatedPrimitiveTypeTraits<TYPE>::GetRepeatedPtr(int number, \
1133  const ExtensionSet& set) { \
1134  return &GetRepeated(number, set); \
1135  } \
1136  template <> \
1137  inline RepeatedField<TYPE>* \
1138  RepeatedPrimitiveTypeTraits<TYPE>::MutableRepeated( \
1139  int number, FieldType field_type, bool is_packed, ExtensionSet* set) { \
1140  return reinterpret_cast<RepeatedField<TYPE>*>( \
1141  set->MutableRawRepeatedField(number, field_type, is_packed, nullptr)); \
1142  }
1143 
1151 
1152 #undef PROTOBUF_DEFINE_PRIMITIVE_TYPE
1153 
1154 // -------------------------------------------------------------------
1155 // StringTypeTraits
1156 
1157 // Strings support both Set() and Mutable().
1158 class PROTOBUF_EXPORT StringTypeTraits {
1159  public:
1160  typedef const std::string& ConstType;
1163 
1164  static inline const std::string& Get(int number, const ExtensionSet& set,
1165  ConstType default_value) {
1166  return set.GetString(number, default_value);
1167  }
1168  static inline const std::string* GetPtr(int number, const ExtensionSet& set,
1169  ConstType default_value) {
1170  return &Get(number, set, default_value);
1171  }
1172  static inline void Set(int number, FieldType field_type,
1173  const std::string& value, ExtensionSet* set) {
1174  set->SetString(number, field_type, value, nullptr);
1175  }
1177  ExtensionSet* set) {
1178  return set->MutableString(number, field_type, nullptr);
1179  }
1180  template <typename ExtendeeT>
1181  static void Register(int number, FieldType type, bool is_packed) {
1182  ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
1183  type, false, is_packed);
1184  }
1185 };
1186 
1187 class PROTOBUF_EXPORT RepeatedStringTypeTraits {
1188  public:
1189  typedef const std::string& ConstType;
1192 
1194 
1195  static inline const std::string& Get(int number, const ExtensionSet& set,
1196  int index) {
1197  return set.GetRepeatedString(number, index);
1198  }
1199  static inline const std::string* GetPtr(int number, const ExtensionSet& set,
1200  int index) {
1201  return &Get(number, set, index);
1202  }
1204  int number, const ExtensionSet& set) {
1205  return &GetRepeated(number, set);
1206  }
1207  static inline void Set(int number, int index, const std::string& value,
1208  ExtensionSet* set) {
1209  set->SetRepeatedString(number, index, value);
1210  }
1211  static inline std::string* Mutable(int number, int index, ExtensionSet* set) {
1212  return set->MutableRepeatedString(number, index);
1213  }
1214  static inline void Add(int number, FieldType field_type, bool /*is_packed*/,
1215  const std::string& value, ExtensionSet* set) {
1216  set->AddString(number, field_type, value, nullptr);
1217  }
1219  ExtensionSet* set) {
1220  return set->AddString(number, field_type, nullptr);
1221  }
1223  int number, const ExtensionSet& set) {
1224  return *reinterpret_cast<const RepeatedPtrField<std::string>*>(
1225  set.GetRawRepeatedField(number, GetDefaultRepeatedField()));
1226  }
1227 
1229  int number, FieldType field_type, bool is_packed, ExtensionSet* set) {
1230  return reinterpret_cast<RepeatedPtrField<std::string>*>(
1231  set->MutableRawRepeatedField(number, field_type, is_packed, nullptr));
1232  }
1233 
1234  static const RepeatedFieldType* GetDefaultRepeatedField();
1235 
1236  template <typename ExtendeeT>
1237  static void Register(int number, FieldType type, bool is_packed) {
1238  ExtensionSet::RegisterExtension(&ExtendeeT::default_instance(), number,
1239  type, true, is_packed);
1240  }
1241 
1242  private:
1243  static void InitializeDefaultRepeatedFields();
1244  static void DestroyDefaultRepeatedFields();
1245 };
1246 
1247 // -------------------------------------------------------------------
1248 // EnumTypeTraits
1249 
1250 // ExtensionSet represents enums using integers internally, so we have to
1251 // static_cast around.
1252 template <typename Type, bool IsValid(int)>
1253 class EnumTypeTraits {
1254  public:
1255  typedef Type ConstType;
1258 
1259  static inline ConstType Get(int number, const ExtensionSet& set,
1260  ConstType default_value) {
1261  return static_cast<Type>(set.GetEnum(number, default_value));
1262  }
1263  static inline const ConstType* GetPtr(int number, const ExtensionSet& set,
1264  const ConstType& default_value) {
1265  return reinterpret_cast<const Type*>(
1266  &set.GetRefEnum(number, default_value));
1267  }
1268  static inline void Set(int number, FieldType field_type, ConstType value,
1269  ExtensionSet* set) {
1270  GOOGLE_DCHECK(IsValid(value));
1271  set->SetEnum(number, field_type, value, nullptr);
1272  }
1273  template <typename ExtendeeT>
1274  static void Register(int number, FieldType type, bool is_packed) {
1275  ExtensionSet::RegisterEnumExtension(&ExtendeeT::default_instance(), number,
1276  type, false, is_packed, IsValid);
1277  }
1278 };
1279 
1280 template <typename Type, bool IsValid(int)>
1281 class RepeatedEnumTypeTraits {
1282  public:
1283  typedef Type ConstType;
1286 
1288 
1289  static inline ConstType Get(int number, const ExtensionSet& set, int index) {
1290  return static_cast<Type>(set.GetRepeatedEnum(number, index));
1291  }
1292  static inline const ConstType* GetPtr(int number, const ExtensionSet& set,
1293  int index) {
1294  return reinterpret_cast<const Type*>(
1295  &set.GetRefRepeatedEnum(number, index));
1296  }
1297  static inline void Set(int number, int index, ConstType value,
1298  ExtensionSet* set) {
1299  GOOGLE_DCHECK(IsValid(value));
1300  set->SetRepeatedEnum(number, index, value);
1301  }
1302  static inline void Add(int number, FieldType field_type, bool is_packed,
1304  GOOGLE_DCHECK(IsValid(value));
1305  set->AddEnum(number, field_type, is_packed, value, nullptr);
1306  }
1307  static inline const RepeatedField<Type>& GetRepeated(
1308  int number, const ExtensionSet& set) {
1309  // Hack: the `Extension` struct stores a RepeatedField<int> for enums.
1310  // RepeatedField<int> cannot implicitly convert to RepeatedField<EnumType>
1311  // so we need to do some casting magic. See message.h for similar
1312  // contortions for non-extension fields.
1313  return *reinterpret_cast<const RepeatedField<Type>*>(
1314  set.GetRawRepeatedField(number, GetDefaultRepeatedField()));
1315  }
1316  static inline const RepeatedField<Type>* GetRepeatedPtr(
1317  int number, const ExtensionSet& set) {
1318  return &GetRepeated(number, set);
1319  }
1322  bool is_packed,
1323  ExtensionSet* set) {
1324  return reinterpret_cast<RepeatedField<Type>*>(
1325  set->MutableRawRepeatedField(number, field_type, is_packed, nullptr));
1326  }
1327 
1329  // Hack: as noted above, repeated enum fields are internally stored as a
1330  // RepeatedField<int>. We need to be able to instantiate global static
1331  // objects to return as default (empty) repeated fields on non-existent
1332  // extensions. We would not be able to know a-priori all of the enum types
1333  // (values of |Type|) to instantiate all of these, so we just re-use
1334  // int32_t's default repeated field object.
1335  return reinterpret_cast<const RepeatedField<Type>*>(
1337  }
1338  template <typename ExtendeeT>
1339  static void Register(int number, FieldType type, bool is_packed) {
1340  ExtensionSet::RegisterEnumExtension(&ExtendeeT::default_instance(), number,
1341  type, true, is_packed, IsValid);
1342  }
1343 };
1344 
1345 // -------------------------------------------------------------------
1346 // MessageTypeTraits
1347 
1348 // ExtensionSet guarantees that when manipulating extensions with message
1349 // types, the implementation used will be the compiled-in class representing
1350 // that type. So, we can static_cast down to the exact type we expect.
1351 template <typename Type>
1352 class MessageTypeTraits {
1353  public:
1354  typedef const Type& ConstType;
1355  typedef Type* MutableType;
1357 
1358  static inline ConstType Get(int number, const ExtensionSet& set,
1359  ConstType default_value) {
1360  return static_cast<const Type&>(set.GetMessage(number, default_value));
1361  }
1362  static inline std::nullptr_t GetPtr(int /* number */, const ExtensionSet& /* set */,
1363  ConstType /* default_value */) {
1364  // Cannot be implemented because of forward declared messages?
1365  return nullptr;
1366  }
1368  ExtensionSet* set) {
1369  return static_cast<Type*>(set->MutableMessage(
1370  number, field_type, Type::default_instance(), nullptr));
1371  }
1372  static inline void SetAllocated(int number, FieldType field_type,
1374  set->SetAllocatedMessage(number, field_type, nullptr, message);
1375  }
1378  ExtensionSet* set) {
1379  set->UnsafeArenaSetAllocatedMessage(number, field_type, nullptr, message);
1380  }
1381  PROTOBUF_NODISCARD static inline MutableType Release(
1382  int number, FieldType /* field_type */, ExtensionSet* set) {
1383  return static_cast<Type*>(
1384  set->ReleaseMessage(number, Type::default_instance()));
1385  }
1387  FieldType /* field_type */,
1388  ExtensionSet* set) {
1389  return static_cast<Type*>(
1390  set->UnsafeArenaReleaseMessage(number, Type::default_instance()));
1391  }
1392  template <typename ExtendeeT>
1393  static void Register(int number, FieldType type, bool is_packed) {
1394  ExtensionSet::RegisterMessageExtension(&ExtendeeT::default_instance(),
1395  number, type, false, is_packed,
1397  }
1398 };
1399 
1400 // forward declaration.
1401 class RepeatedMessageGenericTypeTraits;
1402 
1403 template <typename Type>
1404 class RepeatedMessageTypeTraits {
1405  public:
1406  typedef const Type& ConstType;
1407  typedef Type* MutableType;
1409 
1411 
1412  static inline ConstType Get(int number, const ExtensionSet& set, int index) {
1413  return static_cast<const Type&>(set.GetRepeatedMessage(number, index));
1414  }
1415  static inline std::nullptr_t GetPtr(int /* number */, const ExtensionSet& /* set */,
1416  int /* index */) {
1417  // Cannot be implemented because of forward declared messages?
1418  return nullptr;
1419  }
1420  static inline std::nullptr_t GetRepeatedPtr(int /* number */,
1421  const ExtensionSet& /* set */) {
1422  // Cannot be implemented because of forward declared messages?
1423  return nullptr;
1424  }
1425  static inline MutableType Mutable(int number, int index, ExtensionSet* set) {
1426  return static_cast<Type*>(set->MutableRepeatedMessage(number, index));
1427  }
1429  ExtensionSet* set) {
1430  return static_cast<Type*>(
1431  set->AddMessage(number, field_type, Type::default_instance(), nullptr));
1432  }
1433  static inline const RepeatedPtrField<Type>& GetRepeated(
1434  int number, const ExtensionSet& set) {
1435  // See notes above in RepeatedEnumTypeTraits::GetRepeated(): same
1436  // casting hack applies here, because a RepeatedPtrField<MessageLite>
1437  // cannot naturally become a RepeatedPtrType<Type> even though Type is
1438  // presumably a message. google::protobuf::Message goes through similar contortions
1439  // with a reinterpret_cast<>.
1440  return *reinterpret_cast<const RepeatedPtrField<Type>*>(
1441  set.GetRawRepeatedField(number, GetDefaultRepeatedField()));
1442  }
1445  bool is_packed,
1446  ExtensionSet* set) {
1447  return reinterpret_cast<RepeatedPtrField<Type>*>(
1448  set->MutableRawRepeatedField(number, field_type, is_packed, nullptr));
1449  }
1450 
1452  template <typename ExtendeeT>
1453  static void Register(int number, FieldType type, bool is_packed) {
1454  ExtensionSet::RegisterMessageExtension(&ExtendeeT::default_instance(),
1455  number, type, true, is_packed,
1457  }
1458 };
1459 
1460 template <typename Type>
1463  static auto instance = OnShutdownDelete(new RepeatedFieldType);
1464  return instance;
1465 }
1466 
1467 // -------------------------------------------------------------------
1468 // ExtensionIdentifier
1469 
1470 // This is the type of actual extension objects. E.g. if you have:
1471 // extend Foo {
1472 // optional int32 bar = 1234;
1473 // }
1474 // then "bar" will be defined in C++ as:
1475 // ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32_t>, 5, false> bar(1234);
1476 //
1477 // Note that we could, in theory, supply the field number as a template
1478 // parameter, and thus make an instance of ExtensionIdentifier have no
1479 // actual contents. However, if we did that, then using an extension
1480 // identifier would not necessarily cause the compiler to output any sort
1481 // of reference to any symbol defined in the extension's .pb.o file. Some
1482 // linkers will actually drop object files that are not explicitly referenced,
1483 // but that would be bad because it would cause this extension to not be
1484 // registered at static initialization, and therefore using it would crash.
1485 
1486 template <typename ExtendeeType, typename TypeTraitsType, FieldType field_type,
1487  bool is_packed>
1488 class ExtensionIdentifier {
1489  public:
1490  typedef TypeTraitsType TypeTraits;
1491  typedef ExtendeeType Extendee;
1492 
1493  ExtensionIdentifier(int number, typename TypeTraits::ConstType default_value)
1495  Register(number);
1496  }
1497  inline int number() const { return number_; }
1498  typename TypeTraits::ConstType default_value() const {
1499  return default_value_;
1500  }
1501 
1502  static void Register(int number) {
1503  TypeTraits::template Register<ExtendeeType>(number, field_type, is_packed);
1504  }
1505 
1506  typename TypeTraits::ConstType const& default_value_ref() const {
1507  return default_value_;
1508  }
1509 
1510  private:
1511  const int number_;
1512  typename TypeTraits::ConstType default_value_;
1513 };
1514 
1515 // -------------------------------------------------------------------
1516 // Generated accessors
1517 
1518 
1519 // Used to retrieve a lazy extension, may return nullptr in some environments.
1520 extern PROTOBUF_ATTRIBUTE_WEAK ExtensionSet::LazyMessageExtension*
1522 
1523 } // namespace internal
1524 
1525 // Call this function to ensure that this extensions's reflection is linked into
1526 // the binary:
1527 //
1528 // google::protobuf::LinkExtensionReflection(Foo::my_extension);
1529 //
1530 // This will ensure that the following lookup will succeed:
1531 //
1532 // DescriptorPool::generated_pool()->FindExtensionByName("Foo.my_extension");
1533 //
1534 // This is often relevant for parsing extensions in text mode.
1535 //
1536 // As a side-effect, it will also guarantee that anything else from the same
1537 // .proto file will also be available for lookup in the generated pool.
1538 //
1539 // This function does not actually register the extension, so it does not need
1540 // to be called before the lookup. However it does need to occur in a function
1541 // that cannot be stripped from the binary (ie. it must be reachable from main).
1542 //
1543 // Best practice is to call this function as close as possible to where the
1544 // reflection is actually needed. This function is very cheap to call, so you
1545 // should not need to worry about its runtime overhead except in tight loops (on
1546 // x86-64 it compiles into two "mov" instructions).
1547 template <typename ExtendeeType, typename TypeTraitsType,
1548  internal::FieldType field_type, bool is_packed>
1551  ExtendeeType, TypeTraitsType, field_type, is_packed>& extension) {
1553 }
1554 
1555 } // namespace protobuf
1556 } // namespace google
1557 
1558 #include <google/protobuf/port_undef.inc>
1559 
1560 #endif // GOOGLE_PROTOBUF_EXTENSION_SET_H__
google::protobuf.internal::ExtensionInfo::message_info
MessageInfo message_info
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:124
google::protobuf.internal::RepeatedPrimitiveTypeTraits::ConstType
Type ConstType
Definition: protobuf/src/google/protobuf/extension_set.h:1035
google::protobuf.internal::EnumTypeTraits::Set
static void Set(int number, FieldType field_type, ConstType value, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1268
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
google::protobuf.internal::RepeatedMessageTypeTraits::Mutable
static MutableType Mutable(int number, int index, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1425
google::protobuf.internal::ReadTag
const char * ReadTag(const char *p, uint32 *out, uint32 max_tag=0)
Definition: bloaty/third_party/protobuf/src/google/protobuf/parse_context.h:494
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
google::protobuf.internal::RepeatedPrimitiveDefaults::default_repeated_field_int32_t_
RepeatedField< int32_t > default_repeated_field_int32_t_
Definition: protobuf/src/google/protobuf/extension_set.h:1070
google::protobuf.internal::ExtensionSet
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:175
google::protobuf.internal::StringTypeTraits::Set
static void Set(int number, FieldType field_type, const std::string &value, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1172
google::protobuf::RepeatedPtrField< std::string >
google::protobuf.internal::EnumTypeTraits::Get
static ConstType Get(int number, const ExtensionSet &set, ConstType default_value)
Definition: protobuf/src/google/protobuf/extension_set.h:1259
google::protobuf.internal::RepeatedMessageTypeTraits::GetRepeatedPtr
static std::nullptr_t GetRepeatedPtr(int, const ExtensionSet &)
Definition: protobuf/src/google/protobuf/extension_set.h:1420
google::protobuf.internal::RepeatedEnumTypeTraits::MutableType
Type MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1284
google::protobuf.internal::RepeatedPrimitiveTypeTraits::GetRepeatedPtr
static const RepeatedField< ConstType > * GetRepeatedPtr(int number, const ExtensionSet &set)
absl::swap_internal::Swap
void Swap(T &lhs, T &rhs) noexcept(IsNothrowSwappable< T >::value)
Definition: abseil-cpp/absl/meta/type_traits.h:772
google::protobuf.internal::ExtensionInfo::is_repeated
bool is_repeated
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:110
google::protobuf.internal::FieldType
uint8 FieldType
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:83
regen-readme.it
it
Definition: regen-readme.py:15
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf.internal::PrimitiveTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:932
google::protobuf::FieldDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:515
google::protobuf.internal::ExtensionSet::ForEach
KeyValueFunctor ForEach(KeyValueFunctor func) const
Definition: protobuf/src/google/protobuf/extension_set.h:768
google::protobuf.internal::ExtensionIdentifier::ExtensionIdentifier
ExtensionIdentifier(int number, typename TypeTraits::ConstType default_value)
Definition: protobuf/src/google/protobuf/extension_set.h:1493
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/macros.h:40
ctx
Definition: benchmark-async.c:30
google::protobuf.internal::RepeatedStringTypeTraits::GetRepeated
static const RepeatedPtrField< std::string > & GetRepeated(int number, const ExtensionSet &set)
Definition: protobuf/src/google/protobuf/extension_set.h:1222
google::protobuf.internal::RepeatedMessageTypeTraits::GetPtr
static std::nullptr_t GetPtr(int, const ExtensionSet &, int)
Definition: protobuf/src/google/protobuf/extension_set.h:1415
testing::internal::Int32
TypeWithSize< 4 >::Int Int32
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2159
metadata
Definition: cq_verifier.cc:48
google::protobuf.internal::MessageTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1393
google::protobuf::extension
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:2001
google::protobuf.internal::Get
const T & Get(const void *ptr)
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_util.cc:97
begin
char * begin
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1007
Free
Definition: bssl_shim.cc:90
google::protobuf.internal::RepeatedStringTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1237
Bool
Definition: bloaty/third_party/googletest/googletest/test/gtest_pred_impl_unittest.cc:56
google::protobuf.internal::PrimitiveTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1026
uint16_t
unsigned short uint16_t
Definition: stdint-msvc2008.h:79
google::protobuf.internal.python_message.MergeFrom
MergeFrom
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1339
google::protobuf.internal::RepeatedPrimitiveDefaults
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:978
google::protobuf.internal::ExtensionInfo::enum_validity_check
EnumValidityCheck enum_validity_check
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:123
google::protobuf.internal::RepeatedPrimitiveDefaults::default_repeated_field_uint64_t_
RepeatedField< uint64_t > default_repeated_field_uint64_t_
Definition: protobuf/src/google/protobuf/extension_set.h:1073
google::protobuf.internal::EnumTypeTraits::MutableType
Type MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1256
google::protobuf.internal::EnumTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1274
google::protobuf.internal::RepeatedEnumTypeTraits::GetDefaultRepeatedField
static const RepeatedFieldType * GetDefaultRepeatedField()
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1200
large
int large
Definition: bloaty/third_party/zlib/examples/enough.c:172
GOOGLE_DCHECK
#define GOOGLE_DCHECK
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:194
phone_pb2.message_type
message_type
Definition: phone_pb2.py:200
Arena
Definition: arena.c:39
google::protobuf.internal::GeneratedExtensionFinder::GeneratedExtensionFinder
GeneratedExtensionFinder(const MessageLite *extendee)
Definition: protobuf/src/google/protobuf/extension_set.h:155
metadata
struct metadata metadata
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf.internal::ExtensionSet::SerializeMessageSetWithCachedSizes
void SerializeMessageSetWithCachedSizes(const MessageLite *extendee, io::CodedOutputStream *output) const
Definition: protobuf/src/google/protobuf/extension_set.h:496
google::protobuf.internal::ExtensionSet::Size
size_t Size() const
Definition: protobuf/src/google/protobuf/extension_set.h:743
google::protobuf.internal::ExtensionSet::flat_size_
uint16_t flat_size_
Definition: protobuf/src/google/protobuf/extension_set.h:916
google::protobuf.internal::StringTypeTraits::MutableType
std::string * MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1161
google::protobuf.internal::ParseContext
Definition: bloaty/third_party/protobuf/src/google/protobuf/parse_context.h:336
google::protobuf.internal::MessageTypeTraits::ConstType
const typedef Type & ConstType
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1226
New
T * New(Args &&... args)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:195
testing::internal::UInt64
TypeWithSize< 8 >::UInt UInt64
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2162
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
google::protobuf.internal::RepeatedPrimitiveTypeTraits::Repeated
RepeatedPrimitiveTypeTraits< Type > Repeated
Definition: protobuf/src/google/protobuf/extension_set.h:1037
google::protobuf.internal::FieldSkipper
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:741
instance
RefCountedPtr< grpc_tls_certificate_provider > instance
Definition: xds_server_config_fetcher.cc:224
google::protobuf.internal::RepeatedEnumTypeTraits::Set
static void Set(int number, int index, ConstType value, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1297
google::protobuf.internal::MessageTypeTraits::UnsafeArenaSetAllocated
static void UnsafeArenaSetAllocated(int number, FieldType field_type, MutableType message, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1376
google::protobuf.internal::GeneratedExtensionFinder::extendee_
const MessageLite * extendee_
Definition: protobuf/src/google/protobuf/extension_set.h:163
google::protobuf.internal::MessageTypeTraits::Release
static PROTOBUF_NODISCARD MutableType Release(int number, FieldType, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1381
google::protobuf.internal::MessageTypeTraits::UnsafeArenaRelease
static MutableType UnsafeArenaRelease(int number, FieldType, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1386
google::protobuf::RepeatedField< int32_t >
google::protobuf.internal::RepeatedMessageTypeTraits::Repeated
RepeatedMessageTypeTraits< Type > Repeated
Definition: protobuf/src/google/protobuf/extension_set.h:1408
grpc_core::ForEach
for_each_detail::ForEach< Reader, Action > ForEach(Reader reader, Action action)
For each item acquired by calling Reader::Next, run the promise Action.
Definition: for_each.h:133
google::protobuf.internal::RepeatedMessageTypeTraits::MutableType
Type * MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1407
google::protobuf.internal::RepeatedEnumTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1339
Type::default_instance
static const Type & default_instance()
Definition: bloaty/third_party/protobuf/src/google/protobuf/type.pb.cc:454
google::protobuf.internal::RepeatedEnumTypeTraits::GetRepeatedPtr
static const RepeatedField< Type > * GetRepeatedPtr(int number, const ExtensionSet &set)
Definition: protobuf/src/google/protobuf/extension_set.h:1316
google::protobuf::MessageLite
Definition: bloaty/third_party/protobuf/src/google/protobuf/message_lite.h:184
second
StrT second
Definition: cxa_demangle.cpp:4885
testing::internal::UInt32
TypeWithSize< 4 >::UInt UInt32
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2160
PROTOBUF_DEFINE_PRIMITIVE_TYPE
#define PROTOBUF_DEFINE_PRIMITIVE_TYPE(TYPE, METHOD)
Definition: protobuf/src/google/protobuf/extension_set.h:1079
google::protobuf::Reflection
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:397
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
google::protobuf.internal.python_message._InternalParse
_InternalParse
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1196
google::protobuf.internal::PrimitiveTypeTraits::ConstType
Type ConstType
Definition: protobuf/src/google/protobuf/extension_set.h:1014
google::protobuf.internal::PrimitiveTypeTraits::Set
static void Set(int number, FieldType field_type, ConstType value, ExtensionSet *set)
google::protobuf::python::cmessage::UnknownFieldSet
static PyObject * UnknownFieldSet(CMessage *self)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2512
google::protobuf.internal::ExtensionSet::flat_capacity_
uint16_t flat_capacity_
Definition: protobuf/src/google/protobuf/extension_set.h:915
google::protobuf::MessageFactory
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:1066
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
google::protobuf.internal::ExtensionSet::Extension::int64_t_value
int64_t int64_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:624
google::protobuf.internal::StringTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1181
Descriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:121
google::protobuf.internal::OnShutdownDelete
T * OnShutdownDelete(T *p)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/common.h:185
google::protobuf.internal::RepeatedMessageTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1453
google::protobuf.internal::StringTypeTraits::GetPtr
static const std::string * GetPtr(int number, const ExtensionSet &set, ConstType default_value)
Definition: protobuf/src/google/protobuf/extension_set.h:1168
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
google::protobuf.internal::RepeatedPrimitiveTypeTraits::GetDefaultRepeatedField
static const RepeatedFieldType * GetDefaultRepeatedField()
google::protobuf.internal::RepeatedMessageTypeTraits::MutableRepeated
static RepeatedPtrField< Type > * MutableRepeated(int number, FieldType field_type, bool is_packed, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1443
google::protobuf.internal::MessageTypeTraits::Singular
MessageTypeTraits< Type > Singular
Definition: protobuf/src/google/protobuf/extension_set.h:1356
google::protobuf.internal::MessageTypeTraits::MutableType
Type * MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1355
google::protobuf.internal::RepeatedStringTypeTraits::MutableRepeated
static RepeatedPtrField< std::string > * MutableRepeated(int number, FieldType field_type, bool is_packed, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1228
google::protobuf.internal::RepeatedEnumTypeTraits::RepeatedFieldType
RepeatedField< Type > RepeatedFieldType
Definition: protobuf/src/google/protobuf/extension_set.h:1287
google::protobuf.internal::ExtensionSet::GetArena
Arena * GetArena() const
Definition: protobuf/src/google/protobuf/extension_set.h:302
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
google::protobuf.internal::ExtensionSet::ExtensionSet
ExtensionSet()
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.cc:195
google::protobuf.internal::ExtensionSet::LazyMessageExtension::~LazyMessageExtension
virtual ~LazyMessageExtension()
Definition: protobuf/src/google/protobuf/extension_set.h:577
FieldDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:133
google::protobuf::io::EpsCopyOutputStream
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:651
google::protobuf::python::repeated_composite_container::AddMessage
static PyObject * AddMessage(RepeatedCompositeContainer *self, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:109
google::protobuf.internal::RepeatedStringTypeTraits::GetPtr
static const std::string * GetPtr(int number, const ExtensionSet &set, int index)
Definition: protobuf/src/google/protobuf/extension_set.h:1199
google::protobuf.internal::RepeatedMessageTypeTraits::RepeatedFieldType
RepeatedPtrField< Type > RepeatedFieldType
Definition: protobuf/src/google/protobuf/extension_set.h:1410
google::protobuf.internal::ExtensionSet::Extension::repeated_int64_t_value
RepeatedField< int64_t > * repeated_int64_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:636
google::protobuf.internal::RepeatedEnumTypeTraits::Add
static void Add(int number, FieldType field_type, bool is_packed, ConstType value, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1302
google::protobuf.internal::RepeatedPrimitiveTypeTraits::GetPtr
static const Type * GetPtr(int number, const ExtensionSet &set, int index)
google::protobuf.internal::GeneratedExtensionFinder
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:145
int16_t
signed short int16_t
Definition: stdint-msvc2008.h:76
google::protobuf.internal::RepeatedEnumTypeTraits::ConstType
Type ConstType
Definition: protobuf/src/google/protobuf/extension_set.h:1283
google::protobuf.internal.python_message.ClearExtension
ClearExtension
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:914
arena_
Arena * arena_
Definition: client_channel.cc:391
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
google::protobuf.internal::StringTypeTraits::Get
static const std::string & Get(int number, const ExtensionSet &set, ConstType default_value)
Definition: protobuf/src/google/protobuf/extension_set.h:1164
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
tag
static void * tag(intptr_t t)
Definition: bad_client.cc:318
google::protobuf.internal::RepeatedPrimitiveTypeTraits::Add
static void Add(int number, FieldType field_type, bool is_packed, Type value, ExtensionSet *set)
gmock_output_test.output
output
Definition: bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
Type
Definition: bloaty/third_party/protobuf/src/google/protobuf/type.pb.h:182
google::protobuf.internal::ExtensionSet::RegisterEnumExtension
static void RegisterEnumExtension(const MessageLite *containing_type, int number, FieldType type, bool is_repeated, bool is_packed, EnumValidityFunc *is_valid)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.cc:160
google::protobuf.internal::field_type
WireFormatLite::FieldType field_type(FieldType type)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc:138
google::protobuf.internal::RepeatedStringTypeTraits::Get
static const std::string & Get(int number, const ExtensionSet &set, int index)
Definition: protobuf/src/google/protobuf/extension_set.h:1195
google::protobuf.internal::ExtensionSet::MutableRepeatedString
std::string * MutableRepeatedString(int number, int index)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.cc:546
google::protobuf.internal::RepeatedPrimitiveTypeTraits::GetRepeated
static const RepeatedField< ConstType > & GetRepeated(int number, const ExtensionSet &set)
google::protobuf.internal::ToIntSize
int ToIntSize(size_t size)
Definition: bloaty/third_party/protobuf/src/google/protobuf/message_lite.h:105
google::protobuf.internal::ExtensionSet::ForEach
static KeyValueFunctor ForEach(Iterator begin, Iterator end, KeyValueFunctor func)
Definition: protobuf/src/google/protobuf/extension_set.h:751
GOOGLE_PROTOBUF_PARSER_ASSERT
#define GOOGLE_PROTOBUF_PARSER_ASSERT(predicate)
Definition: bloaty/third_party/protobuf/src/google/protobuf/parse_context.h:660
grpc::protobuf::MessageLite
GRPC_CUSTOM_MESSAGELITE MessageLite
Definition: include/grpcpp/impl/codegen/config_protobuf.h:79
google::protobuf.internal::StringTypeTraits::Singular
StringTypeTraits Singular
Definition: protobuf/src/google/protobuf/extension_set.h:1162
google::protobuf.internal.python_message._InternalSerialize
_InternalSerialize
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1112
google::protobuf.internal::RepeatedStringTypeTraits::GetRepeatedPtr
static const RepeatedPtrField< std::string > * GetRepeatedPtr(int number, const ExtensionSet &set)
Definition: protobuf/src/google/protobuf/extension_set.h:1203
testing::internal::Float
FloatingPoint< float > Float
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-internal.h:396
google::protobuf.internal::ExtensionSet::KeyValue
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:630
google::protobuf.internal::ExtensionSet::LazyMessageExtension::LazyMessageExtension
LazyMessageExtension()
Definition: protobuf/src/google/protobuf/extension_set.h:576
google::protobuf.internal::ExtensionSet::SetString
void SetString(int number, FieldType type, std::string value, desc)
google::protobuf.internal::ExtensionInfo::descriptor
const FieldDescriptor * descriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:130
google::protobuf.internal::EnumTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1138
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
google::protobuf.internal::ExtensionSet::Extension::repeated_int32_t_value
RepeatedField< int32_t > * repeated_int32_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:635
google::protobuf.internal::ExtensionInfo
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:101
google::protobuf.internal::ExtensionInfo::EnumValidityCheck::arg
const void * arg
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:115
grpc::protobuf::io::CodedInputStream
GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream
Definition: include/grpcpp/impl/codegen/config_protobuf.h:102
google::protobuf.internal::MessageTypeTraits::GetPtr
static std::nullptr_t GetPtr(int, const ExtensionSet &, ConstType)
Definition: protobuf/src/google/protobuf/extension_set.h:1362
google::protobuf::DescriptorPool
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1539
google::protobuf.internal::InternalMetadata
Definition: protobuf/src/google/protobuf/metadata_lite.h:62
arg
Definition: cmdline.cc:40
google::protobuf.internal::ExtensionSet::LazyMessageExtension
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:515
google::protobuf.internal::RepeatedStringTypeTraits::Repeated
RepeatedStringTypeTraits Repeated
Definition: protobuf/src/google/protobuf/extension_set.h:1191
number
int32_t number
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:850
google::protobuf.internal::StringTypeTraits::Mutable
static std::string * Mutable(int number, FieldType field_type, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1176
google::protobuf.internal::RepeatedEnumTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1161
google::protobuf.internal::ExtensionSet::Extension::repeated_uint64_t_value
RepeatedField< uint64_t > * repeated_uint64_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:638
google::protobuf.internal::ExtensionInfo::EnumValidityCheck::func
EnumValidityFuncWithArg * func
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:114
google::protobuf::LinkExtensionReflection
void LinkExtensionReflection(const google::protobuf::internal::ExtensionIdentifier< ExtendeeType, TypeTraitsType, field_type, is_packed > &extension)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1577
google::protobuf.internal::ExtensionSet::KeyValue::FirstComparator::operator()
bool operator()(int key, const KeyValue &rhs) const
Definition: protobuf/src/google/protobuf/extension_set.h:711
google::protobuf.internal::WireFormatLite::kMessageSetItemStartTag
static const int kMessageSetItemStartTag
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:215
google::protobuf.internal::MaybeCreateLazyExtension
PROTOBUF_ATTRIBUTE_WEAK ExtensionSet::LazyMessageExtension * MaybeCreateLazyExtension(Arena *arena)
google::protobuf.internal::ExtensionSet::RegisterExtension
static void RegisterExtension(const MessageLite *containing_type, int number, FieldType type, bool is_repeated, bool is_packed)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.cc:137
google::protobuf.internal::ExtensionSet::Extension::uint64_t_value
uint64_t uint64_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:626
grpc::protobuf::io::CodedOutputStream
GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream
Definition: src/compiler/config.h:55
google::protobuf.internal::RepeatedMessageTypeTraits::GetDefaultRepeatedField
static const RepeatedFieldType * GetDefaultRepeatedField()
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1319
google::protobuf.internal::EnumTypeTraits::Singular
EnumTypeTraits< Type, IsValid > Singular
Definition: protobuf/src/google/protobuf/extension_set.h:1257
google::protobuf.internal::RepeatedMessageTypeTraits::Get
static ConstType Get(int number, const ExtensionSet &set, int index)
Definition: protobuf/src/google/protobuf/extension_set.h:1412
google::protobuf.internal.python_message.ByteSize
ByteSize
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1067
google::protobuf.internal::ExtensionSet::Extension::int32_t_value
int32_t int32_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:623
google::protobuf.internal::RepeatedStringTypeTraits::MutableType
std::string * MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1190
google::protobuf.internal::ExtensionIdentifier::default_value
TypeTraits::ConstType default_value() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1353
google::protobuf.internal::ExtensionSet::Extension::repeated_uint32_t_value
RepeatedField< uint32_t > * repeated_uint32_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:637
google::protobuf.internal::PrimitiveTypeTraits::Get
static ConstType Get(int number, const ExtensionSet &set, ConstType default_value)
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
google::protobuf.internal::ExtensionSet::Extension::uint32_t_value
uint32_t uint32_t_value
Definition: protobuf/src/google/protobuf/extension_set.h:625
google::protobuf.internal::ExtensionSet::AllocatedData
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:840
google::protobuf.internal::ExtensionSet::is_large
bool is_large() const
Definition: protobuf/src/google/protobuf/extension_set.h:738
google::protobuf.internal::ExtensionFinder
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:135
google::protobuf.internal::EnumTypeTraits::ConstType
Type ConstType
Definition: protobuf/src/google/protobuf/extension_set.h:1255
google::protobuf.internal::ExtensionIdentifier::number
int number() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1352
google::protobuf::io::CodedOutputStream
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1044
google::protobuf.internal::ExtensionSet::ParseMessageSet
const char * ParseMessageSet(const char *ptr, const Msg *extendee, InternalMetadata *metadata, internal::ParseContext *ctx)
Definition: protobuf/src/google/protobuf/extension_set.h:419
google::protobuf.internal::RepeatedMessageTypeTraits::ConstType
const typedef Type & ConstType
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1273
google::protobuf.internal::ExtensionSet::LargeMap
std::map< int, Extension > LargeMap
Definition: protobuf/src/google/protobuf/extension_set.h:717
google::protobuf.internal::RepeatedEnumTypeTraits::Get
static ConstType Get(int number, const ExtensionSet &set, int index)
Definition: protobuf/src/google/protobuf/extension_set.h:1289
google::protobuf.internal::ExtensionInfo::ExtensionInfo
constexpr ExtensionInfo()
Definition: protobuf/src/google/protobuf/extension_set.h:104
google::protobuf.internal::PrimitiveTypeTraits::GetPtr
static const ConstType * GetPtr(int number, const ExtensionSet &set, const ConstType &default_value)
google::protobuf.internal::ExtensionIdentifier
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1343
google::protobuf.internal::RepeatedPrimitiveTypeTraits::MutableType
Type MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1036
google::protobuf.internal::RepeatedStringTypeTraits::Add
static std::string * Add(int number, FieldType field_type, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1218
google::protobuf.internal::RepeatedMessageTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1271
google::protobuf.internal::RepeatedStringTypeTraits::Mutable
static std::string * Mutable(int number, int index, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1211
google::protobuf.internal::MessageTypeTraits::Get
static ConstType Get(int number, const ExtensionSet &set, ConstType default_value)
Definition: protobuf/src/google/protobuf/extension_set.h:1358
google::protobuf.internal::RepeatedPrimitiveTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:950
GetString
static bool GetString(std::string *out, CBS *cbs)
Definition: ssl_ctx_api.cc:228
google::protobuf::Message
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:205
google::protobuf.internal::RepeatedMessageTypeTraits::Add
static MutableType Add(int number, FieldType field_type, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1428
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
google::protobuf.internal::RepeatedEnumTypeTraits::GetPtr
static const ConstType * GetPtr(int number, const ExtensionSet &set, int index)
Definition: protobuf/src/google/protobuf/extension_set.h:1292
func
const EVP_CIPHER *(* func)(void)
Definition: cipher_extra.c:73
key
const char * key
Definition: hpack_parser_table.cc:164
desc
#define desc
Definition: protobuf/src/google/protobuf/extension_set.h:345
google::protobuf.internal::ExtensionIdentifier::Extendee
ExtendeeType Extendee
Definition: protobuf/src/google/protobuf/extension_set.h:1491
google::protobuf.internal.python_message.Clear
Clear
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1430
google::protobuf.internal::RepeatedStringTypeTraits::Add
static void Add(int number, FieldType field_type, bool, const std::string &value, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1214
google::protobuf.internal::MessageTypeTraits::Mutable
static MutableType Mutable(int number, FieldType field_type, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1367
google::protobuf.internal::ExtensionInfo::EnumValidityCheck
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:113
google::protobuf.internal::RepeatedStringTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1080
google::protobuf.internal::ExtensionSet::SetRepeatedString
void SetRepeatedString(int number, int index, std::string value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:859
google::protobuf.internal::RepeatedPrimitiveTypeTraits::Get
static Type Get(int number, const ExtensionSet &set, int index)
google::protobuf.internal::RepeatedPrimitiveTypeTraits::Register
static void Register(int number, FieldType type, bool is_packed)
Definition: protobuf/src/google/protobuf/extension_set.h:1059
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
google::protobuf.internal::ExtensionInfo::is_packed
bool is_packed
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:111
absl::container_internal::internal_layout::adl_barrier::Find
constexpr size_t Find(Needle, Needle, Ts...)
Definition: abseil-cpp/absl/container/internal/layout.h:269
google::protobuf.internal.python_message.RegisterExtension
RegisterExtension
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:790
google::protobuf.internal::ExtensionSet::FindExtension
bool FindExtension(int wire_type, uint32_t field, const MessageLite *extendee, const internal::ParseContext *, ExtensionInfo *extension, bool *was_packed_on_wire)
Definition: protobuf/src/google/protobuf/extension_set.h:841
google::protobuf.internal::ExtensionSet::KeyValue::FirstComparator::operator()
bool operator()(const KeyValue &lhs, const KeyValue &rhs) const
Definition: protobuf/src/google/protobuf/extension_set.h:705
first
StrT first
Definition: cxa_demangle.cpp:4884
google::protobuf.internal::RepeatedPrimitiveTypeTraits::MutableRepeated
static RepeatedField< Type > * MutableRepeated(int number, FieldType field_type, bool is_packed, ExtensionSet *set)
google::protobuf.internal::EnumValidityFunc
bool EnumValidityFunc(int number)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:94
google::protobuf.internal::RepeatedEnumTypeTraits::Repeated
RepeatedEnumTypeTraits< Type, IsValid > Repeated
Definition: protobuf/src/google/protobuf/extension_set.h:1285
google::protobuf::UnknownFieldSet
Definition: bloaty/third_party/protobuf/src/google/protobuf/unknown_field_set.h:81
testing::internal::Double
FloatingPoint< double > Double
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-internal.h:397
google::protobuf::io::CodedInputStream
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:180
field_type
zend_class_entry * field_type
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/message.c:2030
google::protobuf.internal::RepeatedPrimitiveTypeTraits::Set
static void Set(int number, int index, Type value, ExtensionSet *set)
cpp.gmock_class.set
set
Definition: bloaty/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class.py:44
google::protobuf.internal::PrimitiveTypeTraits::MutableType
Type MutableType
Definition: protobuf/src/google/protobuf/extension_set.h:1015
google::protobuf.internal::RepeatedPrimitiveDefaults::default_repeated_field_int64_t_
RepeatedField< int64_t > default_repeated_field_int64_t_
Definition: protobuf/src/google/protobuf/extension_set.h:1071
google::protobuf::Descriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:231
google::protobuf.internal::ExtensionSet::RegisterMessageExtension
static void RegisterMessageExtension(const MessageLite *containing_type, int number, FieldType type, bool is_repeated, bool is_packed, const MessageLite *prototype)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.cc:172
google::protobuf.internal::RepeatedStringTypeTraits::RepeatedFieldType
RepeatedPtrField< std::string > RepeatedFieldType
Definition: protobuf/src/google/protobuf/extension_set.h:1193
google::protobuf.internal::ExtensionSet::flat_begin
const KeyValue * flat_begin() const
Definition: protobuf/src/google/protobuf/extension_set.h:897
google::protobuf.internal::ExtensionIdentifier::Register
static void Register(int number)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1357
google::protobuf.internal::ExtensionIdentifier::default_value_ref
TypeTraits::ConstType const & default_value_ref() const
Definition: protobuf/src/google/protobuf/extension_set.h:1506
google::protobuf::descriptor_unittest::AddEnum
EnumDescriptorProto * AddEnum(FileDescriptorProto *file, const std::string &name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor_unittest.cc:87
google::protobuf.internal::RepeatedPtrFieldBase
Definition: bloaty/third_party/protobuf/src/google/protobuf/repeated_field.h:451
absl::inlined_vector_internal::Iterator
Pointer< A > Iterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:64
google::protobuf.internal::ExtensionIdentifier::number_
const int number_
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1362
google::protobuf.internal::MessageTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1224
google::protobuf.internal.python_message.IsInitialized
IsInitialized
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1245
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
google::protobuf.internal::ExtensionInfo::MessageInfo::prototype
const MessageLite * prototype
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:119
google::protobuf.internal::StrongReference
void StrongReference(const T &var)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/common.h:193
google::protobuf.internal::ExtensionIdentifier::TypeTraits
TypeTraitsType TypeTraits
Definition: protobuf/src/google/protobuf/extension_set.h:1490
google::protobuf.internal::RepeatedMessageTypeTraits::GetRepeated
static const RepeatedPtrField< Type > & GetRepeated(int number, const ExtensionSet &set)
Definition: protobuf/src/google/protobuf/extension_set.h:1433
pool
InternalDescriptorPool * pool
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:807
google::protobuf.internal::ExtensionSet::MutableString
std::string * MutableString(int number, FieldType type, desc)
google::protobuf.internal::ExtensionIdentifier::default_value_
TypeTraits::ConstType default_value_
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1363
google::protobuf.internal::EnumTypeTraits::GetPtr
static const ConstType * GetPtr(int number, const ExtensionSet &set, const ConstType &default_value)
Definition: protobuf/src/google/protobuf/extension_set.h:1263
google::protobuf.internal::GeneratedExtensionFinder::~GeneratedExtensionFinder
~GeneratedExtensionFinder() override
Definition: protobuf/src/google/protobuf/extension_set.h:157
internal
Definition: benchmark/test/output_test_helper.cc:20
google::protobuf.internal::ExtensionSet::_InternalSerialize
uint8_t * _InternalSerialize(const MessageLite *extendee, int start_field_number, int end_field_number, uint8_t *target, io::EpsCopyOutputStream *stream) const
Definition: protobuf/src/google/protobuf/extension_set.h:483
google::protobuf.internal::ExtensionInfo::ExtensionInfo
constexpr ExtensionInfo(const MessageLite *extendee, int param_number, FieldType type_param, bool isrepeated, bool ispacked)
Definition: protobuf/src/google/protobuf/extension_set.h:105
google::protobuf.internal::ExtensionSet::flat_begin
KeyValue * flat_begin()
Definition: protobuf/src/google/protobuf/extension_set.h:893
testing::internal::Int64
TypeWithSize< 8 >::Int Int64
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2161
google::protobuf::python::repeated_composite_container::Insert
static PyObject * Insert(PyObject *pself, PyObject *args)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:139
google::protobuf.internal::RepeatedEnumTypeTraits::GetRepeated
static const RepeatedField< Type > & GetRepeated(int number, const ExtensionSet &set)
Definition: protobuf/src/google/protobuf/extension_set.h:1307
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
google::protobuf.internal::ExtensionSet::KeyValue::FirstComparator::operator()
bool operator()(const KeyValue &lhs, int key) const
Definition: protobuf/src/google/protobuf/extension_set.h:708
google::protobuf.internal::ExtensionInfo::type
FieldType type
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:109
google::protobuf.internal::ExtensionSet::Extension
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:551
setup.template
template
Definition: setup.py:47
google::protobuf.internal::PrimitiveTypeTraits::Singular
PrimitiveTypeTraits< Type > Singular
Definition: protobuf/src/google/protobuf/extension_set.h:1016
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
google::protobuf.internal.wire_format.MessageSetItemByteSize
def MessageSetItemByteSize(field_number, msg)
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/wire_format.py:204
DescriptorPool
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:110
google::protobuf.internal::RepeatedStringTypeTraits::Set
static void Set(int number, int index, const std::string &value, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1207
google::protobuf.internal::ExtensionInfo::number
int number
Definition: protobuf/src/google/protobuf/extension_set.h:115
google::protobuf.internal::ExtensionSet::AddString
void AddString(int number, FieldType type, std::string value, desc)
google::protobuf.internal::MessageTypeTraits::SetAllocated
static void SetAllocated(int number, FieldType field_type, MutableType message, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1372
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
google::protobuf.internal::ExtensionSet::ForEach
KeyValueFunctor ForEach(KeyValueFunctor func)
Definition: protobuf/src/google/protobuf/extension_set.h:759
google::protobuf.internal::MessageSetFieldSkipper
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc:61
google::protobuf::FindOrNull
const Collection::value_type::second_type * FindOrNull(const Collection &collection, const typename Collection::value_type::first_type &key)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/map_util.h:137
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
google::protobuf.internal::RepeatedPrimitiveTypeTraits::RepeatedFieldType
RepeatedField< Type > RepeatedFieldType
Definition: protobuf/src/google/protobuf/extension_set.h:1039
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
Message
Definition: protobuf/php/ext/google/protobuf/message.c:53
google::protobuf.internal::RepeatedEnumTypeTraits::MutableRepeated
static RepeatedField< Type > * MutableRepeated(int number, FieldType field_type, bool is_packed, ExtensionSet *set)
Definition: protobuf/src/google/protobuf/extension_set.h:1320
google::protobuf.internal::RepeatedPrimitiveDefaults::default_repeated_field_uint32_t_
RepeatedField< uint32_t > default_repeated_field_uint32_t_
Definition: protobuf/src/google/protobuf/extension_set.h:1072
google::protobuf.internal::ExtensionSet::flat_end
const KeyValue * flat_end() const
Definition: protobuf/src/google/protobuf/extension_set.h:905
google::protobuf.internal::StringTypeTraits
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:1055
google::protobuf.internal::EnumValidityFuncWithArg
bool EnumValidityFuncWithArg(const void *arg, int number)
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:98
google::protobuf.internal::ExtensionSet::flat_end
KeyValue * flat_end()
Definition: protobuf/src/google/protobuf/extension_set.h:901
google::protobuf.internal::ExtensionSet::SerializeWithCachedSizes
void SerializeWithCachedSizes(const MessageLite *extendee, int start_field_number, int end_field_number, io::CodedOutputStream *output) const
Definition: protobuf/src/google/protobuf/extension_set.h:469
google::protobuf.internal::ExtensionSet::ParseFieldMaybeLazily
const char * ParseFieldMaybeLazily(uint64_t tag, const char *ptr, const MessageLite *extendee, internal::InternalMetadata *metadata, internal::ParseContext *ctx)
Definition: protobuf/src/google/protobuf/extension_set.h:853
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
google::protobuf.internal::ExtensionInfo::message
const MessageLite * message
Definition: protobuf/src/google/protobuf/extension_set.h:114


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:21