WireFormat.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Protocol Buffers for Objective C
  2. //
  3. // Copyright 2010 Booyah Inc.
  4. // Copyright 2008 Cyrus Najmabadi
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. typedef enum {
  18. PBWireFormatVarint = 0,
  19. PBWireFormatFixed64 = 1,
  20. PBWireFormatLengthDelimited = 2,
  21. PBWireFormatStartGroup = 3,
  22. PBWireFormatEndGroup = 4,
  23. PBWireFormatFixed32 = 5,
  24. PBWireFormatTagTypeBits = 3,
  25. PBWireFormatTagTypeMask = 7 /* = (1 << PBWireFormatTagTypeBits) - 1*/,
  26. PBWireFormatMessageSetItem = 1,
  27. PBWireFormatMessageSetTypeId = 2,
  28. PBWireFormatMessageSetMessage = 3
  29. } PBWireFormat;
  30. #ifdef __cplusplus
  31. extern "C"{
  32. #endif
  33. SInt32 PBWireFormatMakeTag(SInt32 fieldNumber, SInt32 wireType);
  34. SInt32 PBWireFormatGetTagWireType(SInt32 tag);
  35. SInt32 PBWireFormatGetTagFieldNumber(SInt32 tag);
  36. #define PBWireFormatMessageSetItemTag (PBWireFormatMakeTag(PBWireFormatMessageSetItem, PBWireFormatStartGroup))
  37. #define PBWireFormatMessageSetItemEndTag (PBWireFormatMakeTag(PBWireFormatMessageSetItem, PBWireFormatEndGroup))
  38. #define PBWireFormatMessageSetTypeIdTag (PBWireFormatMakeTag(PBWireFormatMessageSetTypeId, PBWireFormatVarint))
  39. #define PBWireFormatMessageSetMessageTag (PBWireFormatMakeTag(PBWireFormatMessageSetMessage, PBWireFormatLengthDelimited))
  40. #ifdef __cplusplus
  41. }
  42. #endif