GPBCodedOutputStream_PackagePrivate.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2016 Google Inc. All rights reserved.
  3. // https://developers.google.com/protocol-buffers/
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. #import "GPBCodedOutputStream.h"
  31. NS_ASSUME_NONNULL_BEGIN
  32. CF_EXTERN_C_BEGIN
  33. size_t GPBComputeDoubleSize(int32_t fieldNumber, double value)
  34. __attribute__((const));
  35. size_t GPBComputeFloatSize(int32_t fieldNumber, float value)
  36. __attribute__((const));
  37. size_t GPBComputeUInt64Size(int32_t fieldNumber, uint64_t value)
  38. __attribute__((const));
  39. size_t GPBComputeInt64Size(int32_t fieldNumber, int64_t value)
  40. __attribute__((const));
  41. size_t GPBComputeInt32Size(int32_t fieldNumber, int32_t value)
  42. __attribute__((const));
  43. size_t GPBComputeFixed64Size(int32_t fieldNumber, uint64_t value)
  44. __attribute__((const));
  45. size_t GPBComputeFixed32Size(int32_t fieldNumber, uint32_t value)
  46. __attribute__((const));
  47. size_t GPBComputeBoolSize(int32_t fieldNumber, BOOL value)
  48. __attribute__((const));
  49. size_t GPBComputeStringSize(int32_t fieldNumber, NSString *value)
  50. __attribute__((const));
  51. size_t GPBComputeGroupSize(int32_t fieldNumber, GPBMessage *value)
  52. __attribute__((const));
  53. size_t GPBComputeUnknownGroupSize(int32_t fieldNumber,
  54. GPBUnknownFieldSet *value)
  55. __attribute__((const));
  56. size_t GPBComputeMessageSize(int32_t fieldNumber, GPBMessage *value)
  57. __attribute__((const));
  58. size_t GPBComputeBytesSize(int32_t fieldNumber, NSData *value)
  59. __attribute__((const));
  60. size_t GPBComputeUInt32Size(int32_t fieldNumber, uint32_t value)
  61. __attribute__((const));
  62. size_t GPBComputeSFixed32Size(int32_t fieldNumber, int32_t value)
  63. __attribute__((const));
  64. size_t GPBComputeSFixed64Size(int32_t fieldNumber, int64_t value)
  65. __attribute__((const));
  66. size_t GPBComputeSInt32Size(int32_t fieldNumber, int32_t value)
  67. __attribute__((const));
  68. size_t GPBComputeSInt64Size(int32_t fieldNumber, int64_t value)
  69. __attribute__((const));
  70. size_t GPBComputeTagSize(int32_t fieldNumber) __attribute__((const));
  71. size_t GPBComputeWireFormatTagSize(int field_number, GPBDataType dataType)
  72. __attribute__((const));
  73. size_t GPBComputeDoubleSizeNoTag(double value) __attribute__((const));
  74. size_t GPBComputeFloatSizeNoTag(float value) __attribute__((const));
  75. size_t GPBComputeUInt64SizeNoTag(uint64_t value) __attribute__((const));
  76. size_t GPBComputeInt64SizeNoTag(int64_t value) __attribute__((const));
  77. size_t GPBComputeInt32SizeNoTag(int32_t value) __attribute__((const));
  78. size_t GPBComputeFixed64SizeNoTag(uint64_t value) __attribute__((const));
  79. size_t GPBComputeFixed32SizeNoTag(uint32_t value) __attribute__((const));
  80. size_t GPBComputeBoolSizeNoTag(BOOL value) __attribute__((const));
  81. size_t GPBComputeStringSizeNoTag(NSString *value) __attribute__((const));
  82. size_t GPBComputeGroupSizeNoTag(GPBMessage *value) __attribute__((const));
  83. size_t GPBComputeUnknownGroupSizeNoTag(GPBUnknownFieldSet *value)
  84. __attribute__((const));
  85. size_t GPBComputeMessageSizeNoTag(GPBMessage *value) __attribute__((const));
  86. size_t GPBComputeBytesSizeNoTag(NSData *value) __attribute__((const));
  87. size_t GPBComputeUInt32SizeNoTag(int32_t value) __attribute__((const));
  88. size_t GPBComputeEnumSizeNoTag(int32_t value) __attribute__((const));
  89. size_t GPBComputeSFixed32SizeNoTag(int32_t value) __attribute__((const));
  90. size_t GPBComputeSFixed64SizeNoTag(int64_t value) __attribute__((const));
  91. size_t GPBComputeSInt32SizeNoTag(int32_t value) __attribute__((const));
  92. size_t GPBComputeSInt64SizeNoTag(int64_t value) __attribute__((const));
  93. // Note that this will calculate the size of 64 bit values truncated to 32.
  94. size_t GPBComputeSizeTSizeAsInt32NoTag(size_t value) __attribute__((const));
  95. size_t GPBComputeRawVarint32Size(int32_t value) __attribute__((const));
  96. size_t GPBComputeRawVarint64Size(int64_t value) __attribute__((const));
  97. // Note that this will calculate the size of 64 bit values truncated to 32.
  98. size_t GPBComputeRawVarint32SizeForInteger(NSInteger value)
  99. __attribute__((const));
  100. // Compute the number of bytes that would be needed to encode a
  101. // MessageSet extension to the stream. For historical reasons,
  102. // the wire format differs from normal fields.
  103. size_t GPBComputeMessageSetExtensionSize(int32_t fieldNumber, GPBMessage *value)
  104. __attribute__((const));
  105. // Compute the number of bytes that would be needed to encode an
  106. // unparsed MessageSet extension field to the stream. For
  107. // historical reasons, the wire format differs from normal fields.
  108. size_t GPBComputeRawMessageSetExtensionSize(int32_t fieldNumber, NSData *value)
  109. __attribute__((const));
  110. size_t GPBComputeEnumSize(int32_t fieldNumber, int32_t value)
  111. __attribute__((const));
  112. CF_EXTERN_C_END
  113. NS_ASSUME_NONNULL_END