OLD | NEW |
(Empty) | |
| 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 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 <Foundation/Foundation.h> |
| 32 |
| 33 #import "GPBArray.h" |
| 34 #import "GPBMessage.h" |
| 35 #import "GPBRuntimeTypes.h" |
| 36 |
| 37 CF_EXTERN_C_BEGIN |
| 38 |
| 39 NS_ASSUME_NONNULL_BEGIN |
| 40 |
| 41 // Generates a string that should be a valid "Text Format" for the C++ version |
| 42 // of Protocol Buffers. lineIndent can be nil if no additional line indent is |
| 43 // needed. The comments provide the names according to the ObjC library, they |
| 44 // most likely won't exactly match the original .proto file. |
| 45 NSString *GPBTextFormatForMessage(GPBMessage *message, |
| 46 NSString * __nullable lineIndent); |
| 47 NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet * __nullable unknow
nSet, |
| 48 NSString * __nullable lineIndent); |
| 49 |
| 50 // |
| 51 // Test if the given field is set on a message. |
| 52 // |
| 53 BOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber); |
| 54 BOOL GPBMessageHasFieldSet(GPBMessage *self, GPBFieldDescriptor *field); |
| 55 |
| 56 // |
| 57 // Clear the given field of a message. |
| 58 // |
| 59 void GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field); |
| 60 |
| 61 //%PDDM-EXPAND GPB_ACCESSORS() |
| 62 // This block of code is generated, do not edit it directly. |
| 63 |
| 64 |
| 65 // |
| 66 // Get/Set the given field of a message. |
| 67 // |
| 68 |
| 69 // Single Fields |
| 70 |
| 71 NSData *GPBGetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field); |
| 72 void GPBSetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field, NSData
*value); |
| 73 |
| 74 NSString *GPBGetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field); |
| 75 void GPBSetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field, NSStr
ing *value); |
| 76 |
| 77 GPBMessage *GPBGetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *fiel
d); |
| 78 void GPBSetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field, GPBM
essage *value); |
| 79 |
| 80 GPBMessage *GPBGetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field)
; |
| 81 void GPBSetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field, GPBMes
sage *value); |
| 82 |
| 83 BOOL GPBGetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field); |
| 84 void GPBSetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field, BOOL va
lue); |
| 85 |
| 86 int32_t GPBGetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field); |
| 87 void GPBSetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field, int32_
t value); |
| 88 |
| 89 uint32_t GPBGetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field); |
| 90 void GPBSetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field, uint3
2_t value); |
| 91 |
| 92 int64_t GPBGetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field); |
| 93 void GPBSetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field, int64_
t value); |
| 94 |
| 95 uint64_t GPBGetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field); |
| 96 void GPBSetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field, uint6
4_t value); |
| 97 |
| 98 float GPBGetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field); |
| 99 void GPBSetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field, float
value); |
| 100 |
| 101 double GPBGetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field); |
| 102 void GPBSetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field, doubl
e value); |
| 103 |
| 104 // Get/Set the given enum field of a message. You can only Set values that are |
| 105 // members of the enum. For proto3, when doing a Get, if the value isn't a |
| 106 // memeber of the enum, kGPBUnrecognizedEnumeratorValue will be returned. The |
| 107 // the functions with "Raw" in the will bypass all checks. |
| 108 int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); |
| 109 void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t
value); |
| 110 int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field); |
| 111 void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3
2_t value); |
| 112 |
| 113 // Repeated Fields |
| 114 |
| 115 // The object will/should be GPB*Array or NSMutableArray based on the field's |
| 116 // type. |
| 117 id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); |
| 118 void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id
array); |
| 119 |
| 120 // Map Fields |
| 121 |
| 122 // The object will/should be GPB*Dictionary or NSMutableDictionary based on the |
| 123 // field's type. |
| 124 id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); |
| 125 void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id dicti
onary); |
| 126 |
| 127 //%PDDM-EXPAND-END GPB_ACCESSORS() |
| 128 |
| 129 // Returns an empty NSData to assign to byte fields when you wish |
| 130 // to assign them to empty. Prevents allocating a lot of little [NSData data] |
| 131 // objects. |
| 132 NSData *GPBEmptyNSData(void) __attribute__((pure)); |
| 133 |
| 134 NS_ASSUME_NONNULL_END |
| 135 |
| 136 CF_EXTERN_C_END |
| 137 |
| 138 |
| 139 //%PDDM-DEFINE GPB_ACCESSORS() |
| 140 //% |
| 141 //%// |
| 142 //%// Get/Set the given field of a message. |
| 143 //%// |
| 144 //% |
| 145 //%// Single Fields |
| 146 //% |
| 147 //%GPB_ACCESSOR_SINGLE_FULL(Bytes, NSData, *) |
| 148 //%GPB_ACCESSOR_SINGLE_FULL(String, NSString, *) |
| 149 //%GPB_ACCESSOR_SINGLE_FULL(Message, GPBMessage, *) |
| 150 //%GPB_ACCESSOR_SINGLE_FULL(Group, GPBMessage, *) |
| 151 //%GPB_ACCESSOR_SINGLE(Bool, BOOL) |
| 152 //%GPB_ACCESSOR_SINGLE(Int32, int32_t) |
| 153 //%GPB_ACCESSOR_SINGLE(UInt32, uint32_t) |
| 154 //%GPB_ACCESSOR_SINGLE(Int64, int64_t) |
| 155 //%GPB_ACCESSOR_SINGLE(UInt64, uint64_t) |
| 156 //%GPB_ACCESSOR_SINGLE(Float, float) |
| 157 //%GPB_ACCESSOR_SINGLE(Double, double) |
| 158 //%// Get/Set the given enum field of a message. You can only Set values that a
re |
| 159 //%// members of the enum. For proto3, when doing a Get, if the value isn't a |
| 160 //%// memeber of the enum, kGPBUnrecognizedEnumeratorValue will be returned. The |
| 161 //%// the functions with "Raw" in the will bypass all checks. |
| 162 //%int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); |
| 163 //%void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3
2_t value); |
| 164 //%int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field
); |
| 165 //%void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, i
nt32_t value); |
| 166 //% |
| 167 //%// Repeated Fields |
| 168 //% |
| 169 //%// The object will/should be GPB*Array or NSMutableArray based on the field's |
| 170 //%// type. |
| 171 //%id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); |
| 172 //%void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field,
id array); |
| 173 //% |
| 174 //%// Map Fields |
| 175 //% |
| 176 //%// The object will/should be GPB*Dictionary or NSMutableDictionary based on t
he |
| 177 //%// field's type. |
| 178 //%id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); |
| 179 //%void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id di
ctionary); |
| 180 //% |
| 181 |
| 182 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE(NAME, TYPE) |
| 183 //%GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, ) |
| 184 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, TisP) |
| 185 //%TYPE TisP##GPBGetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *f
ield); |
| 186 //%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field,
TYPE TisP##value); |
| 187 //% |
OLD | NEW |