class Message
Defined at line 262 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
Defined in message.h
Public Methods
void CopyFrom (const Message & from)
Make this message into a copy of the given message. The given message
must have the same descriptor, but need not necessarily be the same class.
By default this is just implemented as "Clear(); MergeFrom(from);".
void MergeFrom (const Message & from)
Merge the fields from the given message into this message. Singular
fields will be overwritten, if specified in from, except for embedded
messages which will be merged. Repeated fields will be concatenated.
The given message must be of the same type as this message (i.e. the
exact same class).
void CheckInitialized ()
Verifies that IsInitialized() returns true. ABSL_CHECK-fails otherwise,
with a nice error message.
void FindInitializationErrors (std::vector<std::string> * errors)
Slowly build a list of all required fields that are not set.
This is much, much slower than IsInitialized() as it is implemented
purely via reflection. Generally, you should not call this unless you
have already determined that an error exists by calling IsInitialized().
std::string InitializationErrorString ()
Like FindInitializationErrors, but joins all the strings, delimited by
commas, and returns them.
void DiscardUnknownFields ()
Clears all unknown fields from this message and all embedded messages.
Normally, if unknown tag numbers are encountered when parsing a message,
the tag and value are stored in the message's UnknownFieldSet and
then written back out when the message is serialized. This allows servers
which simply route messages to other servers to pass through messages
that have new field definitions which they don't yet know about. However,
this behavior can have security implications. To avoid it, call this
method after parsing.
See Reflection::GetUnknownFields() for more on unknown fields.
std::string DebugString ()
Generates a human-readable form of this message for debugging purposes.
Note that the format and content of a debug string is not guaranteed, may
change without notice, and should not be depended on. Code that does
anything except display a string to assist in debugging should use
TextFormat instead.
void Clear ()
size_t ByteSizeLong ()
void Message (const Message & )
Defined at line 264 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
const Descriptor * GetDescriptor ()
Get a non-owning pointer to a Descriptor for this message's type. This
describes what fields the message contains, the types of those fields, etc.
This object remains property of the Message.
Defined at line 375 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
std::string ShortDebugString ()
Like DebugString(), but with less whitespace.
uint8_t * _InternalSerialize (uint8_t * target, io::EpsCopyOutputStream * stream)
Message & operator= (const Message & )
Defined at line 265 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
Message * New ()
Construct a new instance of the same type. Ownership is passed to the
caller. (This is also defined in MessageLite, but is defined again here
for return-type covariance.)
Defined at line 272 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
Message * New (Arena * arena)
Construct a new instance on the arena. Ownership is passed to the caller
if arena is a nullptr.
Defined at line 276 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
int SpaceUsed ()
Defined at line 331 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
const Reflection * GetReflection ()
Get a non-owning pointer to the Reflection interface for this Message,
which can be used to read and modify the fields of the Message dynamically
(in other words, without knowing the message type at compile time). This
object remains property of the Message.
Defined at line 383 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
size_t SpaceUsedLong ()
Computes (an estimate of) the total number of bytes currently used for
storing the message in memory.
SpaceUsedLong() is noticeably slower than ByteSizeLong(), as it is
implemented using reflection (rather than the generated code implementation
for ByteSizeLong()). Like ByteSizeLong(), its CPU time is linear in the
number of fields defined for the proto.
Note: The precise value of this method should never be depended on, and can
change substantially due to internal details. In debug builds, this will
include a random fuzz factor to prevent these dependencies.
std::string Utf8DebugString ()
Like DebugString(), but do not escape UTF-8 byte sequences.
void PrintDebugString ()
Convenience function useful in GDB. Prints DebugString() to stdout.
Protected Methods
Metadata GetMetadata ()
Get a struct containing the metadata for the Message, which is used in turn
to implement GetDescriptor() and GetReflection() above.
Metadata GetMetadataImpl (const internal::ClassDataFull & data)
bool IsInitializedImpl (const MessageLite & )
For CODE_SIZE types
bool AbslParseFlagImpl (absl::string_view text, std::string & error)
std::string AbslUnparseFlagImpl ()
size_t ComputeUnknownFieldsSize (size_t total_size, const internal::CachedSize * cached_size)
size_t MaybeComputeUnknownFieldsSize (size_t total_size, const internal::CachedSize * cached_size)
void MergeImpl (MessageLite & to, const MessageLite & from)
Reflection based version for reflection based types.
void ClearImpl ()
size_t ByteSizeLongImpl (const MessageLite & msg)
void Message ()
Defined at line 416 of file ../../third_party/protobuf/src/src/google/protobuf/message.h
uint8_t * _InternalSerializeImpl (const MessageLite &msg,uint8_t *target,io::EpsCopyOutputStream *stream)
Friends
basic_string Message (const Message & msg)
bool Message (absl::string_view text, Message * msg, std::string * error)
template <typename Sink>
void Message (Sink & sinkconst google::protobuf::Message & message)