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 31#import "GPBCodedOutputStream.h" 32 33NS_ASSUME_NONNULL_BEGIN 34 35CF_EXTERN_C_BEGIN 36 37size_t GPBComputeDoubleSize(int32_t fieldNumber, double value) 38 __attribute__((const)); 39size_t GPBComputeFloatSize(int32_t fieldNumber, float value) 40 __attribute__((const)); 41size_t GPBComputeUInt64Size(int32_t fieldNumber, uint64_t value) 42 __attribute__((const)); 43size_t GPBComputeInt64Size(int32_t fieldNumber, int64_t value) 44 __attribute__((const)); 45size_t GPBComputeInt32Size(int32_t fieldNumber, int32_t value) 46 __attribute__((const)); 47size_t GPBComputeFixed64Size(int32_t fieldNumber, uint64_t value) 48 __attribute__((const)); 49size_t GPBComputeFixed32Size(int32_t fieldNumber, uint32_t value) 50 __attribute__((const)); 51size_t GPBComputeBoolSize(int32_t fieldNumber, BOOL value) 52 __attribute__((const)); 53size_t GPBComputeStringSize(int32_t fieldNumber, NSString *value) 54 __attribute__((const)); 55size_t GPBComputeGroupSize(int32_t fieldNumber, GPBMessage *value) 56 __attribute__((const)); 57size_t GPBComputeUnknownGroupSize(int32_t fieldNumber, 58 GPBUnknownFieldSet *value) 59 __attribute__((const)); 60size_t GPBComputeMessageSize(int32_t fieldNumber, GPBMessage *value) 61 __attribute__((const)); 62size_t GPBComputeBytesSize(int32_t fieldNumber, NSData *value) 63 __attribute__((const)); 64size_t GPBComputeUInt32Size(int32_t fieldNumber, uint32_t value) 65 __attribute__((const)); 66size_t GPBComputeSFixed32Size(int32_t fieldNumber, int32_t value) 67 __attribute__((const)); 68size_t GPBComputeSFixed64Size(int32_t fieldNumber, int64_t value) 69 __attribute__((const)); 70size_t GPBComputeSInt32Size(int32_t fieldNumber, int32_t value) 71 __attribute__((const)); 72size_t GPBComputeSInt64Size(int32_t fieldNumber, int64_t value) 73 __attribute__((const)); 74size_t GPBComputeTagSize(int32_t fieldNumber) __attribute__((const)); 75size_t GPBComputeWireFormatTagSize(int field_number, GPBDataType dataType) 76 __attribute__((const)); 77 78size_t GPBComputeDoubleSizeNoTag(double value) __attribute__((const)); 79size_t GPBComputeFloatSizeNoTag(float value) __attribute__((const)); 80size_t GPBComputeUInt64SizeNoTag(uint64_t value) __attribute__((const)); 81size_t GPBComputeInt64SizeNoTag(int64_t value) __attribute__((const)); 82size_t GPBComputeInt32SizeNoTag(int32_t value) __attribute__((const)); 83size_t GPBComputeFixed64SizeNoTag(uint64_t value) __attribute__((const)); 84size_t GPBComputeFixed32SizeNoTag(uint32_t value) __attribute__((const)); 85size_t GPBComputeBoolSizeNoTag(BOOL value) __attribute__((const)); 86size_t GPBComputeStringSizeNoTag(NSString *value) __attribute__((const)); 87size_t GPBComputeGroupSizeNoTag(GPBMessage *value) __attribute__((const)); 88size_t GPBComputeUnknownGroupSizeNoTag(GPBUnknownFieldSet *value) 89 __attribute__((const)); 90size_t GPBComputeMessageSizeNoTag(GPBMessage *value) __attribute__((const)); 91size_t GPBComputeBytesSizeNoTag(NSData *value) __attribute__((const)); 92size_t GPBComputeUInt32SizeNoTag(int32_t value) __attribute__((const)); 93size_t GPBComputeEnumSizeNoTag(int32_t value) __attribute__((const)); 94size_t GPBComputeSFixed32SizeNoTag(int32_t value) __attribute__((const)); 95size_t GPBComputeSFixed64SizeNoTag(int64_t value) __attribute__((const)); 96size_t GPBComputeSInt32SizeNoTag(int32_t value) __attribute__((const)); 97size_t GPBComputeSInt64SizeNoTag(int64_t value) __attribute__((const)); 98 99// Note that this will calculate the size of 64 bit values truncated to 32. 100size_t GPBComputeSizeTSizeAsInt32NoTag(size_t value) __attribute__((const)); 101 102size_t GPBComputeRawVarint32Size(int32_t value) __attribute__((const)); 103size_t GPBComputeRawVarint64Size(int64_t value) __attribute__((const)); 104 105// Note that this will calculate the size of 64 bit values truncated to 32. 106size_t GPBComputeRawVarint32SizeForInteger(NSInteger value) 107 __attribute__((const)); 108 109// Compute the number of bytes that would be needed to encode a 110// MessageSet extension to the stream. For historical reasons, 111// the wire format differs from normal fields. 112size_t GPBComputeMessageSetExtensionSize(int32_t fieldNumber, GPBMessage *value) 113 __attribute__((const)); 114 115// Compute the number of bytes that would be needed to encode an 116// unparsed MessageSet extension field to the stream. For 117// historical reasons, the wire format differs from normal fields. 118size_t GPBComputeRawMessageSetExtensionSize(int32_t fieldNumber, NSData *value) 119 __attribute__((const)); 120 121size_t GPBComputeEnumSize(int32_t fieldNumber, int32_t value) 122 __attribute__((const)); 123 124CF_EXTERN_C_END 125 126NS_ASSUME_NONNULL_END 127