class DescriptorNames
Defined at line 243 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
This class is used to index into the memory it is pointing at.
The layout is as follows:
[ chars .... ] [ data0 (uint16_t) ] [ ... ] [ dataN (uint16_t) ]
^
payload_ points here
The offsets are relative to payload_.
The offsets are as follows:
(0) `name` size. `name` ends at `payload_`
(1) `full_name` size. `full_name` ends at `payload_` and shares bytes with
`name`.
.. the following offsets only available for `FieldDescriptor` ..
(2)/(3) `lowercase` offset/size. The data bytes could be shared.
(4)/(5) `camelcase` offset/size. The data bytes could be shared.
(6)/(7) `json_name` offset/size. The data bytes could be shared.
NOTE ABOUT NULL TERMINATION:
The name accessors were migrated from `std::string` to `absl::string_view`,
which caused valid code to break. In particular, there are previously
correct callers calling `foo.name().data()` and using it as a NULL
terminated C-string.
To prevent further breakage we are adding null termination on all these
names even though it is outside the contract for `absl::string_view`.
This might change in the future.
Public Methods
void DescriptorNames ()
Uninitialized, to support `= default` of descriptor types.
Defined at line 246 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
void DescriptorNames (const char * payload)
Defined at line 247 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
absl::string_view name ()
The full name is just before `payload_`, and the name is the suffix of it.
We don't need a special offset for them.
NOTE: the sizes don't include the null terminator, so add +1 to the offset.
Defined at line 252 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
absl::string_view full_name ()
Defined at line 255 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
absl::string_view lowercase_name ()
Only available for `FieldDescriptor`. This is not checked at runtime.
NOTE: The offsets here already take into account the null terminator.
Defined at line 261 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
absl::string_view camelcase_name ()
Defined at line 264 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
absl::string_view json_name ()
Defined at line 267 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h
size_t AllocationSizeForSimpleNames (size_t full_name_size)
Defined at line 271 of file ../../third_party/protobuf/src/src/google/protobuf/descriptor.h