aboutsummaryrefslogtreecommitdiffstats
path: root/src/google/protobuf/message.h
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2010-05-29 13:00:38 -0700
committerWink Saville <wink@google.com>2010-05-29 13:00:38 -0700
commitd0332953cda33fb4f8e24ebff9c49159b69c43d6 (patch)
tree81612e8b12f590310aeb0ebf1da37b304eb7baa6 /src/google/protobuf/message.h
parentede38fe9b9f93888e6e41afc7abb09525f44da95 (diff)
downloadexternal_protobuf-d0332953cda33fb4f8e24ebff9c49159b69c43d6.zip
external_protobuf-d0332953cda33fb4f8e24ebff9c49159b69c43d6.tar.gz
external_protobuf-d0332953cda33fb4f8e24ebff9c49159b69c43d6.tar.bz2
Add protobuf 2.3.0 sources
This is the contents of protobuf-2.3.0.tar.bz2 from http://code.google.com/p/protobuf/downloads/list. Change-Id: Idfde09ce7ef5ac027b07ee83f2674fbbed5c30b2
Diffstat (limited to 'src/google/protobuf/message.h')
-rw-r--r--src/google/protobuf/message.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h
index 54b596d..c0062f9 100644
--- a/src/google/protobuf/message.h
+++ b/src/google/protobuf/message.h
@@ -148,6 +148,7 @@ namespace protobuf {
// Defined in this file.
class Message;
class Reflection;
+class MessageFactory;
// Defined in other files.
class Descriptor; // descriptor.h
@@ -238,13 +239,15 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite {
// Reflection object's SpaceUsed() method.
virtual int SpaceUsed() const;
- // Debugging -------------------------------------------------------
+ // Debugging & Testing----------------------------------------------
// Generates a human readable form of this message, useful for debugging
// and other purposes.
string DebugString() const;
// Like DebugString(), but with less whitespace.
string ShortDebugString() const;
+ // Like DebugString(), but do not escape UTF-8 byte sequences.
+ string Utf8DebugString() const;
// Convenience function useful in GDB. Prints DebugString() to stdout.
void PrintDebugString() const;
@@ -327,6 +330,7 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite {
// GetReflection() wrappers.
virtual Metadata GetMetadata() const = 0;
+
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Message);
};
@@ -453,8 +457,10 @@ class LIBPROTOBUF_EXPORT Reflection {
const FieldDescriptor* field) const = 0;
virtual const EnumValueDescriptor* GetEnum(
const Message& message, const FieldDescriptor* field) const = 0;
+ // See MutableMessage() for the meaning of the "factory" parameter.
virtual const Message& GetMessage(const Message& message,
- const FieldDescriptor* field) const = 0;
+ const FieldDescriptor* field,
+ MessageFactory* factory = NULL) const = 0;
// Get a string value without copying, if possible.
//
@@ -499,9 +505,19 @@ class LIBPROTOBUF_EXPORT Reflection {
virtual void SetEnum (Message* message,
const FieldDescriptor* field,
const EnumValueDescriptor* value) const = 0;
- // Get a mutable pointer to a field with a message type.
+ // Get a mutable pointer to a field with a message type. If a MessageFactory
+ // is provided, it will be used to construct instances of the sub-message;
+ // otherwise, the default factory is used. If the field is an extension that
+ // does not live in the same pool as the containing message's descriptor (e.g.
+ // it lives in an overlay pool), then a MessageFactory must be provided.
+ // If you have no idea what that meant, then you probably don't need to worry
+ // about it (don't provide a MessageFactory). WARNING: If the
+ // FieldDescriptor is for a compiled-in extension, then
+ // factory->GetPrototype(field->message_type() MUST return an instance of the
+ // compiled-in class for this type, NOT DynamicMessage.
virtual Message* MutableMessage(Message* message,
- const FieldDescriptor* field) const = 0;
+ const FieldDescriptor* field,
+ MessageFactory* factory = NULL) const = 0;
// Repeated field getters ------------------------------------------
@@ -603,8 +619,10 @@ class LIBPROTOBUF_EXPORT Reflection {
virtual void AddEnum (Message* message,
const FieldDescriptor* field,
const EnumValueDescriptor* value) const = 0;
+ // See MutableMessage() for comments on the "factory" parameter.
virtual Message* AddMessage(Message* message,
- const FieldDescriptor* field) const = 0;
+ const FieldDescriptor* field,
+ MessageFactory* factory = NULL) const = 0;
// Extensions ------------------------------------------------------