diff options
author | Adam Cozzette <acozzette@google.com> | 2017-09-12 10:32:01 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2017-09-14 10:03:57 -0700 |
commit | 13fd045dbb2b4dacea32be162a41d5a4b0d1802f (patch) | |
tree | c219e7eb18b82523e36c6748861c403a14ea66ae /src/google/protobuf/message.h | |
parent | d1bc27caef8377a710370189675cb0958443e8f1 (diff) |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/message.h')
-rw-r--r-- | src/google/protobuf/message.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 44fe0fde..ab018596 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -327,18 +327,19 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite { // Typedef for backwards-compatibility. typedef google::protobuf::Reflection Reflection; - // Get a Descriptor for this message's type. This describes what - // fields the message contains, the types of those fields, etc. + // 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. const Descriptor* GetDescriptor() const { return GetMetadata().descriptor; } - // Get 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. + // 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. // // This method remains virtual in case a subclass does not implement // reflection and wants to override the default behavior. - virtual const Reflection* GetReflection() const { + virtual const Reflection* GetReflection() const PROTOBUF_FINAL { return GetMetadata().reflection; } @@ -496,11 +497,14 @@ class LIBPROTOBUF_EXPORT Reflection { int index1, int index2) const = 0; - // List all fields of the message which are currently set. This includes - // extensions. Singular fields will only be listed if HasField(field) would - // return true and repeated fields will only be listed if FieldSize(field) - // would return non-zero. Fields (both normal fields and extension fields) - // will be listed ordered by field number. + // List all fields of the message which are currently set, except for unknown + // fields, but including extension known to the parser (i.e. compiled in). + // Singular fields will only be listed if HasField(field) would return true + // and repeated fields will only be listed if FieldSize(field) would return + // non-zero. Fields (both normal fields and extension fields) will be listed + // ordered by field number. + // Use Reflection::GetUnknownFields() or message.unknown_fields() to also get + // access to fields/extensions unknown to the parser. virtual void ListFields( const Message& message, std::vector<const FieldDescriptor*>* output) const = 0; @@ -922,7 +926,7 @@ class LIBPROTOBUF_EXPORT Reflection { // Returns a raw pointer to the repeated field // - // "cpp_type" and "message_type" are decuded from the type parameter T passed + // "cpp_type" and "message_type" are deduced from the type parameter T passed // to Get(Mutable)RepeatedFieldRef. If T is a generated message type, // "message_type" should be set to its descriptor. Otherwise "message_type" // should be set to NULL. Implementations of this method should check whether |