40 #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
41 #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
51 template <
typename T>
class RepeatedField;
57 class StringPieceField;
89 WIRETYPE_LENGTH_DELIMITED = 2,
90 WIRETYPE_START_GROUP = 3,
91 WIRETYPE_END_GROUP = 4,
129 CPPTYPE_MESSAGE = 10,
134 static CppType FieldTypeToCppType(
FieldType type);
139 return kWireTypeForFieldType[type];
143 static const int kTagTypeBits = 3;
145 static const uint32 kTagTypeMask = (1 << kTagTypeBits) - 1;
154 static int GetTagFieldNumber(
uint32 tag);
186 #define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \
187 static_cast<uint32>( \
188 ((FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \
198 static const int kMessageSetItemNumber = 1;
199 static const int kMessageSetTypeIdNumber = 2;
200 static const int kMessageSetMessageNumber = 3;
201 static const int kMessageSetItemStartTag =
204 static const int kMessageSetItemEndTag =
207 static const int kMessageSetTypeIdTag =
210 static const int kMessageSetMessageTag =
242 #define input io::CodedInputStream* input_arg
243 #define output io::CodedOutputStream* output_arg
244 #define field_number int field_number_arg
245 #define INL GOOGLE_ATTRIBUTE_ALWAYS_INLINE
253 template <
typename CType, enum FieldType DeclaredType>
259 template <
typename CType, enum FieldType DeclaredType>
260 static inline bool ReadRepeatedPrimitive(
int tag_size,
267 template <
typename CType, enum FieldType DeclaredType>
268 static bool ReadRepeatedPrimitiveNoInline(
int tag_size,
271 RepeatedField<CType>*
value);
278 template <
typename CType, enum FieldType DeclaredType>
279 static inline const uint8* ReadPrimitiveFromArray(
const uint8* buffer,
285 template <
typename CType, enum FieldType DeclaredType>
286 static inline bool ReadPackedPrimitive(
input,
291 template <
typename CType, enum FieldType DeclaredType>
292 static bool ReadPackedPrimitiveNoInline(
input, RepeatedField<CType>*
value);
296 static bool ReadPackedEnumNoInline(
input,
298 RepeatedField<int>*
value);
304 static inline bool ReadMessage(
input, MessageLite*
value);
309 template<
typename MessageType>
312 template<
typename MessageType>
313 static inline bool ReadMessageNoVirtual(
input, MessageType*
value);
322 static inline
void WriteInt64NoTag (
int64 value,
output) INL;
323 static inline
void WriteUInt32NoTag (
uint32 value,
output) INL;
324 static inline
void WriteUInt64NoTag (
uint64 value,
output) INL;
325 static inline
void WriteSInt32NoTag (
int32 value,
output) INL;
326 static inline
void WriteSInt64NoTag (
int64 value,
output) INL;
327 static inline
void WriteFixed32NoTag (
uint32 value,
output) INL;
328 static inline
void WriteFixed64NoTag (
uint64 value,
output) INL;
329 static inline
void WriteSFixed32NoTag(
int32 value,
output) INL;
330 static inline
void WriteSFixed64NoTag(
int64 value,
output) INL;
331 static inline
void WriteFloatNoTag (
float value,
output) INL;
332 static inline
void WriteDoubleNoTag (
double value,
output) INL;
333 static inline
void WriteBoolNoTag (
bool value,
output) INL;
334 static inline
void WriteEnumNoTag (
int value,
output) INL;
338 static
void WriteInt64 (field_number,
int64 value, output);
339 static
void WriteUInt32 (field_number,
uint32 value, output);
340 static
void WriteUInt64 (field_number,
uint64 value, output);
341 static
void WriteSInt32 (field_number,
int32 value, output);
342 static
void WriteSInt64 (field_number,
int64 value, output);
343 static
void WriteFixed32 (field_number,
uint32 value, output);
344 static
void WriteFixed64 (field_number,
uint64 value, output);
345 static
void WriteSFixed32(field_number,
int32 value, output);
346 static
void WriteSFixed64(field_number,
int64 value, output);
347 static
void WriteFloat (field_number,
float value, output);
348 static
void WriteDouble (field_number,
double value, output);
349 static
void WriteBool (field_number,
bool value, output);
350 static
void WriteEnum (field_number,
int value, output);
352 static
void WriteString(field_number,
const string& value, output);
353 static
void WriteBytes (field_number,
const string& value, output);
354 static
void WriteStringMaybeAliased(
355 field_number,
const string& value, output);
356 static
void WriteBytesMaybeAliased(
357 field_number,
const string& value, output);
359 static
void WriteGroup(
360 field_number,
const MessageLite& value, output);
361 static
void WriteMessage(
362 field_number,
const MessageLite& value, output);
365 static
void WriteGroupMaybeToArray(
366 field_number,
const MessageLite& value, output);
367 static
void WriteMessageMaybeToArray(
368 field_number,
const MessageLite& value, output);
373 template<typename MessageType>
374 static inline
void WriteGroupNoVirtual(
375 field_number,
const MessageType& value, output);
376 template<typename MessageType>
377 static inline
void WriteMessageNoVirtual(
378 field_number,
const MessageType& value, output);
381 #define output uint8* target
384 static inline uint8* WriteTagToArray(field_number, WireType type, output) INL;
387 static inline
uint8* WriteInt32NoTagToArray (
int32 value, output) INL;
388 static inline
uint8* WriteInt64NoTagToArray (
int64 value, output) INL;
389 static inline
uint8* WriteUInt32NoTagToArray (
uint32 value, output) INL;
390 static inline
uint8* WriteUInt64NoTagToArray (
uint64 value, output) INL;
391 static inline
uint8* WriteSInt32NoTagToArray (
int32 value, output) INL;
392 static inline
uint8* WriteSInt64NoTagToArray (
int64 value, output) INL;
393 static inline
uint8* WriteFixed32NoTagToArray (
uint32 value, output) INL;
394 static inline
uint8* WriteFixed64NoTagToArray (
uint64 value, output) INL;
395 static inline
uint8* WriteSFixed32NoTagToArray(
int32 value, output) INL;
396 static inline
uint8* WriteSFixed64NoTagToArray(
int64 value, output) INL;
397 static inline
uint8* WriteFloatNoTagToArray (
float value, output) INL;
398 static inline
uint8* WriteDoubleNoTagToArray (
double value, output) INL;
399 static inline
uint8* WriteBoolNoTagToArray (
bool value, output) INL;
400 static inline
uint8* WriteEnumNoTagToArray (
int value, output) INL;
403 static inline
uint8* WriteInt32ToArray(
404 field_number,
int32 value, output) INL;
405 static inline
uint8* WriteInt64ToArray(
406 field_number,
int64 value, output) INL;
407 static inline
uint8* WriteUInt32ToArray(
408 field_number,
uint32 value, output) INL;
409 static inline
uint8* WriteUInt64ToArray(
410 field_number,
uint64 value, output) INL;
411 static inline
uint8* WriteSInt32ToArray(
412 field_number,
int32 value, output) INL;
413 static inline
uint8* WriteSInt64ToArray(
414 field_number,
int64 value, output) INL;
415 static inline
uint8* WriteFixed32ToArray(
416 field_number,
uint32 value, output) INL;
417 static inline
uint8* WriteFixed64ToArray(
418 field_number,
uint64 value, output) INL;
419 static inline
uint8* WriteSFixed32ToArray(
420 field_number,
int32 value, output) INL;
421 static inline
uint8* WriteSFixed64ToArray(
422 field_number,
int64 value, output) INL;
423 static inline
uint8* WriteFloatToArray(
424 field_number,
float value, output) INL;
425 static inline
uint8* WriteDoubleToArray(
426 field_number,
double value, output) INL;
427 static inline
uint8* WriteBoolToArray(
428 field_number,
bool value, output) INL;
429 static inline
uint8* WriteEnumToArray(
430 field_number,
int value, output) INL;
432 static inline
uint8* WriteStringToArray(
433 field_number,
const string& value, output) INL;
434 static inline
uint8* WriteBytesToArray(
435 field_number,
const string& value, output) INL;
437 static inline
uint8* WriteGroupToArray(
438 field_number,
const MessageLite& value, output) INL;
439 static inline
uint8* WriteMessageToArray(
440 field_number,
const MessageLite& value, output) INL;
445 template<typename MessageType>
446 static inline
uint8* WriteGroupNoVirtualToArray(
447 field_number,
const MessageType& value, output) INL;
448 template<typename MessageType>
449 static inline
uint8* WriteMessageNoVirtualToArray(
450 field_number,
const MessageType& value, output) INL;
462 static inline int Int32Size (
int32 value);
463 static inline int Int64Size (
int64 value);
464 static inline int UInt32Size (
uint32 value);
465 static inline int UInt64Size (
uint64 value);
466 static inline int SInt32Size (
int32 value);
467 static inline int SInt64Size (
int64 value);
468 static inline int EnumSize (
int value);
471 static const int kFixed32Size = 4;
472 static const int kFixed64Size = 8;
473 static const int kSFixed32Size = 4;
474 static const int kSFixed64Size = 8;
475 static const int kFloatSize = 4;
476 static const int kDoubleSize = 8;
477 static const int kBoolSize = 1;
479 static inline int StringSize(
const string& value);
480 static inline int BytesSize (
const string& value);
482 static inline int GroupSize (
const MessageLite& value);
483 static inline int MessageSize(
const MessageLite& value);
488 template<
typename MessageType>
489 static inline int GroupSizeNoVirtual (
const MessageType& value);
490 template<
typename MessageType>
491 static inline int MessageSizeNoVirtual(
const MessageType& value);
495 static inline int LengthDelimitedSize(
int length);
501 template <
typename CType, enum FieldType DeclaredType>
502 static inline bool ReadRepeatedFixedSizePrimitive(
509 template <
typename CType, enum FieldType DeclaredType>
510 static inline bool ReadPackedFixedSizePrimitive(
514 static const CppType kFieldTypeToCppTypeMap[];
539 virtual void SkipUnknownEnum(
int field_number,
int value);
547 : unknown_fields_(unknown_fields) {}
553 virtual void SkipUnknownEnum(
int field_number,
int value);
582 field_number << kTagTypeBits);
592 union {
float f;
uint32 i;};
598 union {
float f;
uint32 i;};
604 union {
double f;
uint64 i;};
610 union {
double f;
uint64 i;};
641 return (n << 1) ^ (n >> 31);
645 return (n >> 1) ^ -
static_cast<int32>(n & 1);
650 return (n << 1) ^ (n >> 63);
654 return (n >> 1) ^ -
static_cast<int64>(n & 1);
661 #endif // GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
io::CodedOutputStream * unknown_fields_
Definition: wire_format_lite.h:556
Definition: message.h:144
Definition: message_lite.h:77
virtual ~FieldSkipper()
Definition: wire_format_lite.h:527
int64_t int64
Definition: Define.h:145
Definition: PreparedStatement.h:47
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
Definition: common.h:89
Definition: PreparedStatement.h:56
Definition: PreparedStatement.h:58
int32_t int32
Definition: common.h:172
Definition: coded_stream.h:621
bool is_valid(octet_iterator start, octet_iterator end)
Definition: core.h:300
FieldSkipper()
Definition: wire_format_lite.h:526
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
float length(float v)
Definition: vectorMath.h:208
Definition: document.h:390
#define LIBPROTOBUF_EXPORT
Definition: common.h:105
CodedOutputStreamFieldSkipper(io::CodedOutputStream *unknown_fields)
Definition: wire_format_lite.h:546
virtual ~CodedOutputStreamFieldSkipper()
Definition: wire_format_lite.h:548
int64_t int64
Definition: common.h:173
uint8_t uint8
Definition: Define.h:152
Definition: BnetFileGenerator.h:47
uint8 FieldType
Definition: extension_set.h:77
const FieldDescriptor value
Definition: descriptor.h:1522
#define const
Definition: zconf.h:217
Definition: PreparedStatement.h:57
Definition: wire_format_lite.h:544
Definition: wire_format_lite.h:524
static int VarintSize32(uint32 value)
Definition: coded_stream.h:1087
#define GOOGLE_ATTRIBUTE_ALWAYS_INLINE
Definition: common.h:217