110 #ifndef GOOGLE_PROTOBUF_MESSAGE_H__
111 #define GOOGLE_PROTOBUF_MESSAGE_H__
123 #define GOOGLE_PROTOBUF_HAS_ONEOF
131 class MessageFactory;
134 class UnknownFieldSet;
136 class ZeroCopyInputStream;
137 class ZeroCopyOutputStream;
138 class CodedInputStream;
139 class CodedOutputStream;
175 virtual Message* New()
const = 0;
180 virtual void CopyFrom(
const Message& from);
187 virtual void MergeFrom(
const Message& from);
191 void CheckInitialized()
const;
197 void FindInitializationErrors(vector<string>* errors)
const;
201 string InitializationErrorString()
const;
213 virtual void DiscardUnknownFields();
218 virtual int SpaceUsed()
const;
224 string DebugString()
const;
226 string ShortDebugString()
const;
228 string Utf8DebugString()
const;
230 void PrintDebugString()
const;
238 bool ParseFromFileDescriptor(
int file_descriptor);
241 bool ParsePartialFromFileDescriptor(
int file_descriptor);
244 bool ParseFromIstream(istream*
input);
247 bool ParsePartialFromIstream(istream*
input);
251 bool SerializeToFileDescriptor(
int file_descriptor)
const;
253 bool SerializePartialToFileDescriptor(
int file_descriptor)
const;
256 bool SerializeToOstream(ostream*
output)
const;
258 bool SerializePartialToOstream(ostream*
output)
const;
265 virtual string GetTypeName()
const;
266 virtual void Clear();
267 virtual bool IsInitialized()
const;
268 virtual void CheckTypeAndMergeFrom(
const MessageLite& other);
270 virtual int ByteSize()
const;
281 virtual void SetCachedSize(
int size)
const;
302 return GetMetadata().reflection;
309 virtual Metadata GetMetadata()
const = 0;
366 const Message& message)
const = 0;
373 virtual int SpaceUsed(
const Message& message)
const = 0;
376 virtual bool HasField(
const Message& message,
380 virtual int FieldSize(
const Message& message,
385 virtual void ClearField(
Message* message,
415 virtual void RemoveLast(
Message* message,
423 virtual void Swap(
Message* message1,
Message* message2)
const = 0;
426 virtual void SwapFields(
Message* message1,
428 const vector<const FieldDescriptor*>& fields)
432 virtual void SwapElements(
Message* message,
435 int index2)
const = 0;
442 virtual void ListFields(
const Message& message,
443 vector<const FieldDescriptor*>*
output)
const = 0;
457 virtual float GetFloat (
const Message& message,
459 virtual double GetDouble(
const Message& message,
461 virtual bool GetBool (
const Message& message,
463 virtual string GetString(
const Message& message,
487 virtual const string& GetStringReference(
const Message& message,
489 string* scratch)
const = 0;
495 virtual void SetInt32 (
Message* message,
497 virtual void SetInt64 (
Message* message,
499 virtual void SetUInt32(
Message* message,
501 virtual void SetUInt64(
Message* message,
503 virtual void SetFloat (
Message* message,
505 virtual void SetDouble(
Message* message,
507 virtual void SetBool (
Message* message,
509 virtual void SetString(
Message* message,
511 const string&
value)
const = 0;
512 virtual void SetEnum (
Message* message,
532 virtual void SetAllocatedMessage(
Message* message,
552 int index)
const = 0;
555 int index)
const = 0;
558 int index)
const = 0;
561 int index)
const = 0;
562 virtual float GetRepeatedFloat (
const Message& message,
564 int index)
const = 0;
565 virtual double GetRepeatedDouble(
const Message& message,
567 int index)
const = 0;
568 virtual bool GetRepeatedBool (
const Message& message,
570 int index)
const = 0;
571 virtual string GetRepeatedString(
const Message& message,
573 int index)
const = 0;
577 virtual const Message& GetRepeatedMessage(
582 virtual const string& GetRepeatedStringReference(
584 int index,
string* scratch)
const = 0;
590 virtual void SetRepeatedInt32 (
Message* message,
593 virtual void SetRepeatedInt64 (
Message* message,
596 virtual void SetRepeatedUInt32(
Message* message,
599 virtual void SetRepeatedUInt64(
Message* message,
602 virtual void SetRepeatedFloat (
Message* message,
604 int index,
float value)
const = 0;
605 virtual void SetRepeatedDouble(
Message* message,
607 int index,
double value)
const = 0;
608 virtual void SetRepeatedBool (
Message* message,
610 int index,
bool value)
const = 0;
611 virtual void SetRepeatedString(
Message* message,
613 int index,
const string&
value)
const = 0;
614 virtual void SetRepeatedEnum(
Message* message,
619 virtual Message* MutableRepeatedMessage(
626 virtual void AddInt32 (
Message* message,
628 virtual void AddInt64 (
Message* message,
630 virtual void AddUInt32(
Message* message,
632 virtual void AddUInt64(
Message* message,
634 virtual void AddFloat (
Message* message,
636 virtual void AddDouble(
Message* message,
638 virtual void AddBool (
Message* message,
640 virtual void AddString(
Message* message,
642 const string&
value)
const = 0;
643 virtual void AddEnum (
Message* message,
689 const string& name)
const = 0;
694 int number)
const = 0;
704 virtual void* MutableRawRepeatedField(
706 int ctype,
const Descriptor* message_type)
const = 0;
713 void* MutableRawRepeatedString(
769 static void InternalRegisterGeneratedFile(
770 const char* filename,
void (*register_messages)(
const string&));
775 static void InternalRegisterGeneratedMessage(
const Descriptor* descriptor,
783 #define DECLARE_GET_REPEATED_FIELD(TYPE) \
786 const RepeatedField<TYPE>& Reflection::GetRepeatedField<TYPE>( \
787 const Message& message, const FieldDescriptor* field) const; \
790 RepeatedField<TYPE>* Reflection::MutableRepeatedField<TYPE>( \
791 Message* message, const FieldDescriptor* field) const;
801 #undef DECLARE_GET_REPEATED_FIELD
814 MutableRawRepeatedString(const_cast<Message*>(&message), field,
true));
821 MutableRawRepeatedString(message, field,
true));
845 template<
typename PB>
851 PB::default_instance().GetDescriptor()));
854 template<
typename PB>
860 PB::default_instance().GetDescriptor()));
866 #endif // GOOGLE_PROTOBUF_MESSAGE_H__
MessageFactory()
Definition: message.h:722
Definition: message.h:144
RepeatedPtrField< T > * MutableRepeatedPtrField(Message *, const FieldDescriptor *) const
Definition: message_lite.h:77
int64_t int64
Definition: Define.h:145
virtual const FieldDescriptor * GetOneofFieldDescriptor(const Message &, const OneofDescriptor *) const
Definition: message.h:402
Definition: unknown_field_set.h:74
#define DECLARE_GET_REPEATED_FIELD(TYPE)
Definition: message.h:783
Definition: descriptor.h:126
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: message.h:720
Definition: message.h:147
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
Definition: common.h:89
Definition: message.h:357
Definition: descriptor.h:780
virtual void * MutableRawRepeatedField(Message *message, const FieldDescriptor *field, FieldDescriptor::CppType, int ctype, const Descriptor *message_type) const =0
Definition: message.h:165
int32_t int32
Definition: common.h:172
virtual bool HasOneof(const Message &, const OneofDescriptor *) const
Definition: message.h:392
Definition: coded_stream.h:621
virtual void ClearOneof(Message *, const OneofDescriptor *) const
Definition: message.h:397
virtual const Reflection * GetReflection() const
Definition: message.h:301
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: common.h:177
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
uint64_t uint64
Definition: common.h:178
const RepeatedPtrField< T > & GetRepeatedPtrField(const Message &, const FieldDescriptor *) const
const Descriptor * GetDescriptor() const
Definition: message.h:292
Definition: descriptor.h:388
#define LIBPROTOBUF_EXPORT
Definition: common.h:105
CppType
Definition: descriptor.h:378
int64_t int64
Definition: common.h:173
Definition: descriptor.h:625
Definition: descriptor.h:342
Definition: BnetFileGenerator.h:47
const FieldDescriptor value
Definition: descriptor.h:1522
Message()
Definition: message.h:167
google::protobuf::Reflection Reflection
Definition: message.h:288
Reflection()
Definition: message.h:359