• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2016 Google Inc.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 #import <Foundation/Foundation.h>
9 
10 #import "GPBCodedOutputStream.h"
11 
12 #import "GPBMessage.h"
13 
14 NS_ASSUME_NONNULL_BEGIN
15 
16 CF_EXTERN_C_BEGIN
17 
18 size_t GPBComputeDoubleSize(int32_t fieldNumber, double value) __attribute__((const));
19 size_t GPBComputeFloatSize(int32_t fieldNumber, float value) __attribute__((const));
20 size_t GPBComputeUInt64Size(int32_t fieldNumber, uint64_t value) __attribute__((const));
21 size_t GPBComputeInt64Size(int32_t fieldNumber, int64_t value) __attribute__((const));
22 size_t GPBComputeInt32Size(int32_t fieldNumber, int32_t value) __attribute__((const));
23 size_t GPBComputeFixed64Size(int32_t fieldNumber, uint64_t value) __attribute__((const));
24 size_t GPBComputeFixed32Size(int32_t fieldNumber, uint32_t value) __attribute__((const));
25 size_t GPBComputeBoolSize(int32_t fieldNumber, BOOL value) __attribute__((const));
26 size_t GPBComputeStringSize(int32_t fieldNumber, NSString *value) __attribute__((const));
27 size_t GPBComputeGroupSize(int32_t fieldNumber, GPBMessage *value) __attribute__((const));
28 #pragma clang diagnostic push
29 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
30 size_t GPBComputeUnknownGroupSize(int32_t fieldNumber, GPBUnknownFieldSet *value)
31     __attribute__((const));
32 #pragma clang diagnostic pop
33 size_t GPBComputeMessageSize(int32_t fieldNumber, GPBMessage *value) __attribute__((const));
34 size_t GPBComputeBytesSize(int32_t fieldNumber, NSData *value) __attribute__((const));
35 size_t GPBComputeUInt32Size(int32_t fieldNumber, uint32_t value) __attribute__((const));
36 size_t GPBComputeSFixed32Size(int32_t fieldNumber, int32_t value) __attribute__((const));
37 size_t GPBComputeSFixed64Size(int32_t fieldNumber, int64_t value) __attribute__((const));
38 size_t GPBComputeSInt32Size(int32_t fieldNumber, int32_t value) __attribute__((const));
39 size_t GPBComputeSInt64Size(int32_t fieldNumber, int64_t value) __attribute__((const));
40 size_t GPBComputeTagSize(int32_t fieldNumber) __attribute__((const));
41 size_t GPBComputeWireFormatTagSize(int field_number, GPBDataType dataType) __attribute__((const));
42 
43 size_t GPBComputeDoubleSizeNoTag(double value) __attribute__((const));
44 size_t GPBComputeFloatSizeNoTag(float value) __attribute__((const));
45 size_t GPBComputeUInt64SizeNoTag(uint64_t value) __attribute__((const));
46 size_t GPBComputeInt64SizeNoTag(int64_t value) __attribute__((const));
47 size_t GPBComputeInt32SizeNoTag(int32_t value) __attribute__((const));
48 size_t GPBComputeFixed64SizeNoTag(uint64_t value) __attribute__((const));
49 size_t GPBComputeFixed32SizeNoTag(uint32_t value) __attribute__((const));
50 size_t GPBComputeBoolSizeNoTag(BOOL value) __attribute__((const));
51 size_t GPBComputeStringSizeNoTag(NSString *value) __attribute__((const));
52 size_t GPBComputeGroupSizeNoTag(GPBMessage *value) __attribute__((const));
53 #pragma clang diagnostic push
54 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
55 size_t GPBComputeUnknownGroupSizeNoTag(GPBUnknownFieldSet *value) __attribute__((const));
56 #pragma clang diagnostic pop
57 size_t GPBComputeMessageSizeNoTag(GPBMessage *value) __attribute__((const));
58 size_t GPBComputeBytesSizeNoTag(NSData *value) __attribute__((const));
59 size_t GPBComputeUInt32SizeNoTag(int32_t value) __attribute__((const));
60 size_t GPBComputeEnumSizeNoTag(int32_t value) __attribute__((const));
61 size_t GPBComputeSFixed32SizeNoTag(int32_t value) __attribute__((const));
62 size_t GPBComputeSFixed64SizeNoTag(int64_t value) __attribute__((const));
63 size_t GPBComputeSInt32SizeNoTag(int32_t value) __attribute__((const));
64 size_t GPBComputeSInt64SizeNoTag(int64_t value) __attribute__((const));
65 
66 // Note that this will calculate the size of 64 bit values truncated to 32.
67 size_t GPBComputeSizeTSizeAsInt32NoTag(size_t value) __attribute__((const));
68 
69 size_t GPBComputeRawVarint32Size(int32_t value) __attribute__((const));
70 size_t GPBComputeRawVarint64Size(int64_t value) __attribute__((const));
71 
72 // Note that this will calculate the size of 64 bit values truncated to 32.
73 size_t GPBComputeRawVarint32SizeForInteger(NSInteger value) __attribute__((const));
74 
75 // Compute the number of bytes that would be needed to encode a
76 // MessageSet extension to the stream.  For historical reasons,
77 // the wire format differs from normal fields.
78 size_t GPBComputeMessageSetExtensionSize(int32_t fieldNumber, GPBMessage *value)
79     __attribute__((const));
80 
81 // Compute the number of bytes that would be needed to encode an
82 // unparsed MessageSet extension field to the stream.  For
83 // historical reasons, the wire format differs from normal fields.
84 size_t GPBComputeRawMessageSetExtensionSize(int32_t fieldNumber, NSData *value)
85     __attribute__((const));
86 
87 size_t GPBComputeEnumSize(int32_t fieldNumber, int32_t value) __attribute__((const));
88 
89 CF_EXTERN_C_END
90 
91 NS_ASSUME_NONNULL_END
92