OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 20 matching lines...) Expand all Loading... |
31 #import <Foundation/Foundation.h> | 31 #import <Foundation/Foundation.h> |
32 | 32 |
33 #import "GPBArray.h" | 33 #import "GPBArray.h" |
34 #import "GPBMessage.h" | 34 #import "GPBMessage.h" |
35 #import "GPBRuntimeTypes.h" | 35 #import "GPBRuntimeTypes.h" |
36 | 36 |
37 CF_EXTERN_C_BEGIN | 37 CF_EXTERN_C_BEGIN |
38 | 38 |
39 NS_ASSUME_NONNULL_BEGIN | 39 NS_ASSUME_NONNULL_BEGIN |
40 | 40 |
41 /// Generates a string that should be a valid "Text Format" for the C++ version | 41 /** |
42 /// of Protocol Buffers. | 42 * Generates a string that should be a valid "TextFormat" for the C++ version |
43 /// | 43 * of Protocol Buffers. |
44 /// @param message The message to generate from. | 44 * |
45 /// @param lineIndent A string to use as the prefix for all lines generated. Ca
n | 45 * @param message The message to generate from. |
46 /// be nil if no extra indent is needed. | 46 * @param lineIndent A string to use as the prefix for all lines generated. Can |
47 /// | 47 * be nil if no extra indent is needed. |
48 /// @return A @c NSString with the Text Format of the message. | 48 * |
| 49 * @return An NSString with the TextFormat of the message. |
| 50 **/ |
49 NSString *GPBTextFormatForMessage(GPBMessage *message, | 51 NSString *GPBTextFormatForMessage(GPBMessage *message, |
50 NSString * __nullable lineIndent); | 52 NSString * __nullable lineIndent); |
51 | 53 |
52 /// Generates a string that should be a valid "Text Format" for the C++ version | 54 /** |
53 /// of Protocol Buffers. | 55 * Generates a string that should be a valid "TextFormat" for the C++ version |
54 /// | 56 * of Protocol Buffers. |
55 /// @param unknownSet The unknown field set to generate from. | 57 * |
56 /// @param lineIndent A string to use as the prefix for all lines generated. Ca
n | 58 * @param unknownSet The unknown field set to generate from. |
57 /// be nil if no extra indent is needed. | 59 * @param lineIndent A string to use as the prefix for all lines generated. Can |
58 /// | 60 * be nil if no extra indent is needed. |
59 /// @return A @c NSString with the Text Format of the unknown field set. | 61 * |
| 62 * @return An NSString with the TextFormat of the unknown field set. |
| 63 **/ |
60 NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet * __nullable unknow
nSet, | 64 NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet * __nullable unknow
nSet, |
61 NSString * __nullable lineIndent); | 65 NSString * __nullable lineIndent); |
62 | 66 |
63 /// Test if the given field is set on a message. | 67 /** |
| 68 * Checks if the given field number is set on a message. |
| 69 * |
| 70 * @param self The message to check. |
| 71 * @param fieldNumber The field number to check. |
| 72 * |
| 73 * @return YES if the field number is set on the given message. |
| 74 **/ |
64 BOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber); | 75 BOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber); |
65 /// Test if the given field is set on a message. | 76 |
| 77 /** |
| 78 * Checks if the given field is set on a message. |
| 79 * |
| 80 * @param self The message to check. |
| 81 * @param field The field to check. |
| 82 * |
| 83 * @return YES if the field is set on the given message. |
| 84 **/ |
66 BOOL GPBMessageHasFieldSet(GPBMessage *self, GPBFieldDescriptor *field); | 85 BOOL GPBMessageHasFieldSet(GPBMessage *self, GPBFieldDescriptor *field); |
67 | 86 |
68 /// Clear the given field of a message. | 87 /** |
| 88 * Clears the given field for the given message. |
| 89 * |
| 90 * @param self The message for which to clear the field. |
| 91 * @param field The field to clear. |
| 92 **/ |
69 void GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field); | 93 void GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field); |
70 | 94 |
71 //%PDDM-EXPAND GPB_ACCESSORS() | 95 //%PDDM-EXPAND GPB_ACCESSORS() |
72 // This block of code is generated, do not edit it directly. | 96 // This block of code is generated, do not edit it directly. |
73 | 97 |
74 | 98 |
75 // | 99 // |
76 // Get/Set the given field of a message. | 100 // Get/Set a given field from/to a message. |
77 // | 101 // |
78 | 102 |
79 // Single Fields | 103 // Single Fields |
80 | 104 |
81 /// Gets the value of a bytes field. | 105 /** |
| 106 * Gets the value of a bytes field. |
| 107 * |
| 108 * @param self The message from which to get the field. |
| 109 * @param field The field to get. |
| 110 **/ |
82 NSData *GPBGetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field); | 111 NSData *GPBGetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field); |
83 /// Sets the value of a bytes field. | 112 |
| 113 /** |
| 114 * Sets the value of a bytes field. |
| 115 * |
| 116 * @param self The message into which to set the field. |
| 117 * @param field The field to set. |
| 118 * @param value The to set in the field. |
| 119 **/ |
84 void GPBSetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field, NSData
*value); | 120 void GPBSetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field, NSData
*value); |
85 | 121 |
86 /// Gets the value of a string field. | 122 /** |
| 123 * Gets the value of a string field. |
| 124 * |
| 125 * @param self The message from which to get the field. |
| 126 * @param field The field to get. |
| 127 **/ |
87 NSString *GPBGetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field); | 128 NSString *GPBGetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field); |
88 /// Sets the value of a string field. | 129 |
| 130 /** |
| 131 * Sets the value of a string field. |
| 132 * |
| 133 * @param self The message into which to set the field. |
| 134 * @param field The field to set. |
| 135 * @param value The to set in the field. |
| 136 **/ |
89 void GPBSetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field, NSStr
ing *value); | 137 void GPBSetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field, NSStr
ing *value); |
90 | 138 |
91 /// Gets the value of a message field. | 139 /** |
| 140 * Gets the value of a message field. |
| 141 * |
| 142 * @param self The message from which to get the field. |
| 143 * @param field The field to get. |
| 144 **/ |
92 GPBMessage *GPBGetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *fiel
d); | 145 GPBMessage *GPBGetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *fiel
d); |
93 /// Sets the value of a message field. | 146 |
| 147 /** |
| 148 * Sets the value of a message field. |
| 149 * |
| 150 * @param self The message into which to set the field. |
| 151 * @param field The field to set. |
| 152 * @param value The to set in the field. |
| 153 **/ |
94 void GPBSetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field, GPBM
essage *value); | 154 void GPBSetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field, GPBM
essage *value); |
95 | 155 |
96 /// Gets the value of a group field. | 156 /** |
| 157 * Gets the value of a group field. |
| 158 * |
| 159 * @param self The message from which to get the field. |
| 160 * @param field The field to get. |
| 161 **/ |
97 GPBMessage *GPBGetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field)
; | 162 GPBMessage *GPBGetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field)
; |
98 /// Sets the value of a group field. | 163 |
| 164 /** |
| 165 * Sets the value of a group field. |
| 166 * |
| 167 * @param self The message into which to set the field. |
| 168 * @param field The field to set. |
| 169 * @param value The to set in the field. |
| 170 **/ |
99 void GPBSetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field, GPBMes
sage *value); | 171 void GPBSetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field, GPBMes
sage *value); |
100 | 172 |
101 /// Gets the value of a bool field. | 173 /** |
| 174 * Gets the value of a bool field. |
| 175 * |
| 176 * @param self The message from which to get the field. |
| 177 * @param field The field to get. |
| 178 **/ |
102 BOOL GPBGetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field); | 179 BOOL GPBGetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field); |
103 /// Sets the value of a bool field. | 180 |
| 181 /** |
| 182 * Sets the value of a bool field. |
| 183 * |
| 184 * @param self The message into which to set the field. |
| 185 * @param field The field to set. |
| 186 * @param value The to set in the field. |
| 187 **/ |
104 void GPBSetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field, BOOL va
lue); | 188 void GPBSetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field, BOOL va
lue); |
105 | 189 |
106 /// Gets the value of an int32 field. | 190 /** |
| 191 * Gets the value of an int32 field. |
| 192 * |
| 193 * @param self The message from which to get the field. |
| 194 * @param field The field to get. |
| 195 **/ |
107 int32_t GPBGetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field); | 196 int32_t GPBGetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field); |
108 /// Sets the value of an int32 field. | 197 |
| 198 /** |
| 199 * Sets the value of an int32 field. |
| 200 * |
| 201 * @param self The message into which to set the field. |
| 202 * @param field The field to set. |
| 203 * @param value The to set in the field. |
| 204 **/ |
109 void GPBSetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field, int32_
t value); | 205 void GPBSetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field, int32_
t value); |
110 | 206 |
111 /// Gets the value of an uint32 field. | 207 /** |
| 208 * Gets the value of an uint32 field. |
| 209 * |
| 210 * @param self The message from which to get the field. |
| 211 * @param field The field to get. |
| 212 **/ |
112 uint32_t GPBGetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field); | 213 uint32_t GPBGetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field); |
113 /// Sets the value of an uint32 field. | 214 |
| 215 /** |
| 216 * Sets the value of an uint32 field. |
| 217 * |
| 218 * @param self The message into which to set the field. |
| 219 * @param field The field to set. |
| 220 * @param value The to set in the field. |
| 221 **/ |
114 void GPBSetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field, uint3
2_t value); | 222 void GPBSetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field, uint3
2_t value); |
115 | 223 |
116 /// Gets the value of an int64 field. | 224 /** |
| 225 * Gets the value of an int64 field. |
| 226 * |
| 227 * @param self The message from which to get the field. |
| 228 * @param field The field to get. |
| 229 **/ |
117 int64_t GPBGetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field); | 230 int64_t GPBGetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field); |
118 /// Sets the value of an int64 field. | 231 |
| 232 /** |
| 233 * Sets the value of an int64 field. |
| 234 * |
| 235 * @param self The message into which to set the field. |
| 236 * @param field The field to set. |
| 237 * @param value The to set in the field. |
| 238 **/ |
119 void GPBSetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field, int64_
t value); | 239 void GPBSetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field, int64_
t value); |
120 | 240 |
121 /// Gets the value of an uint64 field. | 241 /** |
| 242 * Gets the value of an uint64 field. |
| 243 * |
| 244 * @param self The message from which to get the field. |
| 245 * @param field The field to get. |
| 246 **/ |
122 uint64_t GPBGetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field); | 247 uint64_t GPBGetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field); |
123 /// Sets the value of an uint64 field. | 248 |
| 249 /** |
| 250 * Sets the value of an uint64 field. |
| 251 * |
| 252 * @param self The message into which to set the field. |
| 253 * @param field The field to set. |
| 254 * @param value The to set in the field. |
| 255 **/ |
124 void GPBSetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field, uint6
4_t value); | 256 void GPBSetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field, uint6
4_t value); |
125 | 257 |
126 /// Gets the value of a float field. | 258 /** |
| 259 * Gets the value of a float field. |
| 260 * |
| 261 * @param self The message from which to get the field. |
| 262 * @param field The field to get. |
| 263 **/ |
127 float GPBGetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field); | 264 float GPBGetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field); |
128 /// Sets the value of a float field. | 265 |
| 266 /** |
| 267 * Sets the value of a float field. |
| 268 * |
| 269 * @param self The message into which to set the field. |
| 270 * @param field The field to set. |
| 271 * @param value The to set in the field. |
| 272 **/ |
129 void GPBSetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field, float
value); | 273 void GPBSetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field, float
value); |
130 | 274 |
131 /// Gets the value of a double field. | 275 /** |
| 276 * Gets the value of a double field. |
| 277 * |
| 278 * @param self The message from which to get the field. |
| 279 * @param field The field to get. |
| 280 **/ |
132 double GPBGetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field); | 281 double GPBGetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field); |
133 /// Sets the value of a double field. | 282 |
| 283 /** |
| 284 * Sets the value of a double field. |
| 285 * |
| 286 * @param self The message into which to set the field. |
| 287 * @param field The field to set. |
| 288 * @param value The to set in the field. |
| 289 **/ |
134 void GPBSetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field, doubl
e value); | 290 void GPBSetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field, doubl
e value); |
135 | 291 |
136 /// Get the given enum field of a message. For proto3, if the value isn't a | 292 /** |
137 /// member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned. | 293 * Gets the given enum field of a message. For proto3, if the value isn't a |
138 /// GPBGetMessageRawEnumField will bypass the check and return whatever value | 294 * member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned. |
139 /// was set. | 295 * GPBGetMessageRawEnumField will bypass the check and return whatever value |
| 296 * was set. |
| 297 * |
| 298 * @param self The message from which to get the field. |
| 299 * @param field The field to get. |
| 300 * |
| 301 * @return The enum value for the given field. |
| 302 **/ |
140 int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); | 303 int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); |
141 /// Set the given enum field of a message. You can only set values that are | 304 |
142 /// members of the enum. | 305 /** |
143 void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t
value); | 306 * Set the given enum field of a message. You can only set values that are |
144 /// Get the given enum field of a message. No check is done to ensure the value | 307 * members of the enum. |
145 /// was defined in the enum. | 308 * |
| 309 * @param self The message into which to set the field. |
| 310 * @param field The field to set. |
| 311 * @param value The enum value to set in the field. |
| 312 **/ |
| 313 void GPBSetMessageEnumField(GPBMessage *self, |
| 314 GPBFieldDescriptor *field, |
| 315 int32_t value); |
| 316 |
| 317 /** |
| 318 * Get the given enum field of a message. No check is done to ensure the value |
| 319 * was defined in the enum. |
| 320 * |
| 321 * @param self The message from which to get the field. |
| 322 * @param field The field to get. |
| 323 * |
| 324 * @return The raw enum value for the given field. |
| 325 **/ |
146 int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field); | 326 int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field); |
147 /// Set the given enum field of a message. You can set the value to anything, | 327 |
148 /// even a value that is not a member of the enum. | 328 /** |
149 void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3
2_t value); | 329 * Set the given enum field of a message. You can set the value to anything, |
| 330 * even a value that is not a member of the enum. |
| 331 * |
| 332 * @param self The message into which to set the field. |
| 333 * @param field The field to set. |
| 334 * @param value The raw enum value to set in the field. |
| 335 **/ |
| 336 void GPBSetMessageRawEnumField(GPBMessage *self, |
| 337 GPBFieldDescriptor *field, |
| 338 int32_t value); |
150 | 339 |
151 // Repeated Fields | 340 // Repeated Fields |
152 | 341 |
153 /// Gets the value of a repeated field. | 342 /** |
154 /// | 343 * Gets the value of a repeated field. |
155 /// The result will be @c GPB*Array or @c NSMutableArray based on the | 344 * |
156 /// field's type. | 345 * @param self The message from which to get the field. |
| 346 * @param field The repeated field to get. |
| 347 * |
| 348 * @return A GPB*Array or an NSMutableArray based on the field's type. |
| 349 **/ |
157 id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); | 350 id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); |
158 /// Sets the value of a repeated field. | 351 |
159 /// | 352 /** |
160 /// The value should be @c GPB*Array or @c NSMutableArray based on the | 353 * Sets the value of a repeated field. |
161 /// field's type. | 354 * |
162 void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id
array); | 355 * @param self The message into which to set the field. |
| 356 * @param field The field to set. |
| 357 * @param array A GPB*Array or NSMutableArray based on the field's type. |
| 358 **/ |
| 359 void GPBSetMessageRepeatedField(GPBMessage *self, |
| 360 GPBFieldDescriptor *field, |
| 361 id array); |
163 | 362 |
164 // Map Fields | 363 // Map Fields |
165 | 364 |
166 /// Gets the value of a map<> field. | 365 /** |
167 /// | 366 * Gets the value of a map<> field. |
168 /// The result will be @c GPB*Dictionary or @c NSMutableDictionary based on | 367 * |
169 /// the field's type. | 368 * @param self The message from which to get the field. |
| 369 * @param field The repeated field to get. |
| 370 * |
| 371 * @return A GPB*Dictionary or NSMutableDictionary based on the field's type. |
| 372 **/ |
170 id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); | 373 id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); |
171 /// Sets the value of a map<> field. | 374 |
172 /// | 375 /** |
173 /// The object should be @c GPB*Dictionary or @c NSMutableDictionary based | 376 * Sets the value of a map<> field. |
174 /// on the field's type. | 377 * |
175 void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id dicti
onary); | 378 * @param self The message into which to set the field. |
| 379 * @param field The field to set. |
| 380 * @param dictionary A GPB*Dictionary or NSMutableDictionary based on the |
| 381 * field's type. |
| 382 **/ |
| 383 void GPBSetMessageMapField(GPBMessage *self, |
| 384 GPBFieldDescriptor *field, |
| 385 id dictionary); |
176 | 386 |
177 //%PDDM-EXPAND-END GPB_ACCESSORS() | 387 //%PDDM-EXPAND-END GPB_ACCESSORS() |
178 | 388 |
179 // Returns an empty NSData to assign to byte fields when you wish | 389 /** |
180 // to assign them to empty. Prevents allocating a lot of little [NSData data] | 390 * Returns an empty NSData to assign to byte fields when you wish to assign them |
181 // objects. | 391 * to empty. Prevents allocating a lot of little [NSData data] objects. |
| 392 **/ |
182 NSData *GPBEmptyNSData(void) __attribute__((pure)); | 393 NSData *GPBEmptyNSData(void) __attribute__((pure)); |
183 | 394 |
184 NS_ASSUME_NONNULL_END | 395 NS_ASSUME_NONNULL_END |
185 | 396 |
186 CF_EXTERN_C_END | 397 CF_EXTERN_C_END |
187 | 398 |
188 | 399 |
189 //%PDDM-DEFINE GPB_ACCESSORS() | 400 //%PDDM-DEFINE GPB_ACCESSORS() |
190 //% | 401 //% |
191 //%// | 402 //%// |
192 //%// Get/Set the given field of a message. | 403 //%// Get/Set a given field from/to a message. |
193 //%// | 404 //%// |
194 //% | 405 //% |
195 //%// Single Fields | 406 //%// Single Fields |
196 //% | 407 //% |
197 //%GPB_ACCESSOR_SINGLE_FULL(Bytes, NSData, , *) | 408 //%GPB_ACCESSOR_SINGLE_FULL(Bytes, NSData, , *) |
198 //%GPB_ACCESSOR_SINGLE_FULL(String, NSString, , *) | 409 //%GPB_ACCESSOR_SINGLE_FULL(String, NSString, , *) |
199 //%GPB_ACCESSOR_SINGLE_FULL(Message, GPBMessage, , *) | 410 //%GPB_ACCESSOR_SINGLE_FULL(Message, GPBMessage, , *) |
200 //%GPB_ACCESSOR_SINGLE_FULL(Group, GPBMessage, , *) | 411 //%GPB_ACCESSOR_SINGLE_FULL(Group, GPBMessage, , *) |
201 //%GPB_ACCESSOR_SINGLE(Bool, BOOL, ) | 412 //%GPB_ACCESSOR_SINGLE(Bool, BOOL, ) |
202 //%GPB_ACCESSOR_SINGLE(Int32, int32_t, n) | 413 //%GPB_ACCESSOR_SINGLE(Int32, int32_t, n) |
203 //%GPB_ACCESSOR_SINGLE(UInt32, uint32_t, n) | 414 //%GPB_ACCESSOR_SINGLE(UInt32, uint32_t, n) |
204 //%GPB_ACCESSOR_SINGLE(Int64, int64_t, n) | 415 //%GPB_ACCESSOR_SINGLE(Int64, int64_t, n) |
205 //%GPB_ACCESSOR_SINGLE(UInt64, uint64_t, n) | 416 //%GPB_ACCESSOR_SINGLE(UInt64, uint64_t, n) |
206 //%GPB_ACCESSOR_SINGLE(Float, float, ) | 417 //%GPB_ACCESSOR_SINGLE(Float, float, ) |
207 //%GPB_ACCESSOR_SINGLE(Double, double, ) | 418 //%GPB_ACCESSOR_SINGLE(Double, double, ) |
208 //%/// Get the given enum field of a message. For proto3, if the value isn't a | 419 //%/** |
209 //%/// member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned. | 420 //% * Gets the given enum field of a message. For proto3, if the value isn't a |
210 //%/// GPBGetMessageRawEnumField will bypass the check and return whatever value | 421 //% * member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned. |
211 //%/// was set. | 422 //% * GPBGetMessageRawEnumField will bypass the check and return whatever value |
| 423 //% * was set. |
| 424 //% * |
| 425 //% * @param self The message from which to get the field. |
| 426 //% * @param field The field to get. |
| 427 //% * |
| 428 //% * @return The enum value for the given field. |
| 429 //% **/ |
212 //%int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); | 430 //%int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); |
213 //%/// Set the given enum field of a message. You can only set values that are | 431 //% |
214 //%/// members of the enum. | 432 //%/** |
215 //%void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int3
2_t value); | 433 //% * Set the given enum field of a message. You can only set values that are |
216 //%/// Get the given enum field of a message. No check is done to ensure the val
ue | 434 //% * members of the enum. |
217 //%/// was defined in the enum. | 435 //% * |
| 436 //% * @param self The message into which to set the field. |
| 437 //% * @param field The field to set. |
| 438 //% * @param value The enum value to set in the field. |
| 439 //% **/ |
| 440 //%void GPBSetMessageEnumField(GPBMessage *self, |
| 441 //% GPBFieldDescriptor *field, |
| 442 //% int32_t value); |
| 443 //% |
| 444 //%/** |
| 445 //% * Get the given enum field of a message. No check is done to ensure the valu
e |
| 446 //% * was defined in the enum. |
| 447 //% * |
| 448 //% * @param self The message from which to get the field. |
| 449 //% * @param field The field to get. |
| 450 //% * |
| 451 //% * @return The raw enum value for the given field. |
| 452 //% **/ |
218 //%int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field
); | 453 //%int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field
); |
219 //%/// Set the given enum field of a message. You can set the value to anything, | 454 //% |
220 //%/// even a value that is not a member of the enum. | 455 //%/** |
221 //%void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, i
nt32_t value); | 456 //% * Set the given enum field of a message. You can set the value to anything, |
| 457 //% * even a value that is not a member of the enum. |
| 458 //% * |
| 459 //% * @param self The message into which to set the field. |
| 460 //% * @param field The field to set. |
| 461 //% * @param value The raw enum value to set in the field. |
| 462 //% **/ |
| 463 //%void GPBSetMessageRawEnumField(GPBMessage *self, |
| 464 //% GPBFieldDescriptor *field, |
| 465 //% int32_t value); |
222 //% | 466 //% |
223 //%// Repeated Fields | 467 //%// Repeated Fields |
224 //% | 468 //% |
225 //%/// Gets the value of a repeated field. | 469 //%/** |
226 //%/// | 470 //% * Gets the value of a repeated field. |
227 //%/// The result will be @c GPB*Array or @c NSMutableArray based on the | 471 //% * |
228 //%/// field's type. | 472 //% * @param self The message from which to get the field. |
| 473 //% * @param field The repeated field to get. |
| 474 //% * |
| 475 //% * @return A GPB*Array or an NSMutableArray based on the field's type. |
| 476 //% **/ |
229 //%id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); | 477 //%id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); |
230 //%/// Sets the value of a repeated field. | 478 //% |
231 //%/// | 479 //%/** |
232 //%/// The value should be @c GPB*Array or @c NSMutableArray based on the | 480 //% * Sets the value of a repeated field. |
233 //%/// field's type. | 481 //% * |
234 //%void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field,
id array); | 482 //% * @param self The message into which to set the field. |
| 483 //% * @param field The field to set. |
| 484 //% * @param array A GPB*Array or NSMutableArray based on the field's type. |
| 485 //% **/ |
| 486 //%void GPBSetMessageRepeatedField(GPBMessage *self, |
| 487 //% GPBFieldDescriptor *field, |
| 488 //% id array); |
235 //% | 489 //% |
236 //%// Map Fields | 490 //%// Map Fields |
237 //% | 491 //% |
238 //%/// Gets the value of a map<> field. | 492 //%/** |
239 //%/// | 493 //% * Gets the value of a map<> field. |
240 //%/// The result will be @c GPB*Dictionary or @c NSMutableDictionary based on | 494 //% * |
241 //%/// the field's type. | 495 //% * @param self The message from which to get the field. |
| 496 //% * @param field The repeated field to get. |
| 497 //% * |
| 498 //% * @return A GPB*Dictionary or NSMutableDictionary based on the field's type. |
| 499 //% **/ |
242 //%id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); | 500 //%id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); |
243 //%/// Sets the value of a map<> field. | 501 //% |
244 //%/// | 502 //%/** |
245 //%/// The object should be @c GPB*Dictionary or @c NSMutableDictionary based | 503 //% * Sets the value of a map<> field. |
246 //%/// on the field's type. | 504 //% * |
247 //%void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id di
ctionary); | 505 //% * @param self The message into which to set the field. |
| 506 //% * @param field The field to set. |
| 507 //% * @param dictionary A GPB*Dictionary or NSMutableDictionary based on the |
| 508 //% * field's type. |
| 509 //% **/ |
| 510 //%void GPBSetMessageMapField(GPBMessage *self, |
| 511 //% GPBFieldDescriptor *field, |
| 512 //% id dictionary); |
248 //% | 513 //% |
249 | 514 |
250 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE(NAME, TYPE, AN) | 515 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE(NAME, TYPE, AN) |
251 //%GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, ) | 516 //%GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, ) |
252 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, TisP) | 517 //%PDDM-DEFINE GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, TisP) |
253 //%/// Gets the value of a##AN NAME$L field. | 518 //%/** |
| 519 //% * Gets the value of a##AN NAME$L field. |
| 520 //% * |
| 521 //% * @param self The message from which to get the field. |
| 522 //% * @param field The field to get. |
| 523 //% **/ |
254 //%TYPE TisP##GPBGetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *f
ield); | 524 //%TYPE TisP##GPBGetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *f
ield); |
255 //%/// Sets the value of a##AN NAME$L field. | 525 //% |
| 526 //%/** |
| 527 //% * Sets the value of a##AN NAME$L field. |
| 528 //% * |
| 529 //% * @param self The message into which to set the field. |
| 530 //% * @param field The field to set. |
| 531 //% * @param value The to set in the field. |
| 532 //% **/ |
256 //%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field,
TYPE TisP##value); | 533 //%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field,
TYPE TisP##value); |
257 //% | 534 //% |
OLD | NEW |