• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
33 NS_ASSUME_NONNULL_BEGIN
34 
35 CF_EXTERN_C_BEGIN
36 
37 size_t GPBComputeDoubleSize(int32_t fieldNumber, double value)
38     __attribute__((const));
39 size_t GPBComputeFloatSize(int32_t fieldNumber, float value)
40     __attribute__((const));
41 size_t GPBComputeUInt64Size(int32_t fieldNumber, uint64_t value)
42     __attribute__((const));
43 size_t GPBComputeInt64Size(int32_t fieldNumber, int64_t value)
44     __attribute__((const));
45 size_t GPBComputeInt32Size(int32_t fieldNumber, int32_t value)
46     __attribute__((const));
47 size_t GPBComputeFixed64Size(int32_t fieldNumber, uint64_t value)
48     __attribute__((const));
49 size_t GPBComputeFixed32Size(int32_t fieldNumber, uint32_t value)
50     __attribute__((const));
51 size_t GPBComputeBoolSize(int32_t fieldNumber, BOOL value)
52     __attribute__((const));
53 size_t GPBComputeStringSize(int32_t fieldNumber, NSString *value)
54     __attribute__((const));
55 size_t GPBComputeGroupSize(int32_t fieldNumber, GPBMessage *value)
56     __attribute__((const));
57 size_t GPBComputeUnknownGroupSize(int32_t fieldNumber,
58                                   GPBUnknownFieldSet *value)
59     __attribute__((const));
60 size_t GPBComputeMessageSize(int32_t fieldNumber, GPBMessage *value)
61     __attribute__((const));
62 size_t GPBComputeBytesSize(int32_t fieldNumber, NSData *value)
63     __attribute__((const));
64 size_t GPBComputeUInt32Size(int32_t fieldNumber, uint32_t value)
65     __attribute__((const));
66 size_t GPBComputeSFixed32Size(int32_t fieldNumber, int32_t value)
67     __attribute__((const));
68 size_t GPBComputeSFixed64Size(int32_t fieldNumber, int64_t value)
69     __attribute__((const));
70 size_t GPBComputeSInt32Size(int32_t fieldNumber, int32_t value)
71     __attribute__((const));
72 size_t GPBComputeSInt64Size(int32_t fieldNumber, int64_t value)
73     __attribute__((const));
74 size_t GPBComputeTagSize(int32_t fieldNumber) __attribute__((const));
75 size_t GPBComputeWireFormatTagSize(int field_number, GPBDataType dataType)
76     __attribute__((const));
77 
78 size_t GPBComputeDoubleSizeNoTag(double value) __attribute__((const));
79 size_t GPBComputeFloatSizeNoTag(float value) __attribute__((const));
80 size_t GPBComputeUInt64SizeNoTag(uint64_t value) __attribute__((const));
81 size_t GPBComputeInt64SizeNoTag(int64_t value) __attribute__((const));
82 size_t GPBComputeInt32SizeNoTag(int32_t value) __attribute__((const));
83 size_t GPBComputeFixed64SizeNoTag(uint64_t value) __attribute__((const));
84 size_t GPBComputeFixed32SizeNoTag(uint32_t value) __attribute__((const));
85 size_t GPBComputeBoolSizeNoTag(BOOL value) __attribute__((const));
86 size_t GPBComputeStringSizeNoTag(NSString *value) __attribute__((const));
87 size_t GPBComputeGroupSizeNoTag(GPBMessage *value) __attribute__((const));
88 size_t GPBComputeUnknownGroupSizeNoTag(GPBUnknownFieldSet *value)
89     __attribute__((const));
90 size_t GPBComputeMessageSizeNoTag(GPBMessage *value) __attribute__((const));
91 size_t GPBComputeBytesSizeNoTag(NSData *value) __attribute__((const));
92 size_t GPBComputeUInt32SizeNoTag(int32_t value) __attribute__((const));
93 size_t GPBComputeEnumSizeNoTag(int32_t value) __attribute__((const));
94 size_t GPBComputeSFixed32SizeNoTag(int32_t value) __attribute__((const));
95 size_t GPBComputeSFixed64SizeNoTag(int64_t value) __attribute__((const));
96 size_t GPBComputeSInt32SizeNoTag(int32_t value) __attribute__((const));
97 size_t GPBComputeSInt64SizeNoTag(int64_t value) __attribute__((const));
98 
99 // Note that this will calculate the size of 64 bit values truncated to 32.
100 size_t GPBComputeSizeTSizeAsInt32NoTag(size_t value) __attribute__((const));
101 
102 size_t GPBComputeRawVarint32Size(int32_t value) __attribute__((const));
103 size_t GPBComputeRawVarint64Size(int64_t value) __attribute__((const));
104 
105 // Note that this will calculate the size of 64 bit values truncated to 32.
106 size_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.
112 size_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.
118 size_t GPBComputeRawMessageSetExtensionSize(int32_t fieldNumber, NSData *value)
119     __attribute__((const));
120 
121 size_t GPBComputeEnumSize(int32_t fieldNumber, int32_t value)
122     __attribute__((const));
123 
124 CF_EXTERN_C_END
125 
126 NS_ASSUME_NONNULL_END
127