1ffe3c632Sopenharmony_ci// Protocol Buffers - Google's data interchange format 2ffe3c632Sopenharmony_ci// Copyright 2008 Google Inc. All rights reserved. 3ffe3c632Sopenharmony_ci// https://developers.google.com/protocol-buffers/ 4ffe3c632Sopenharmony_ci// 5ffe3c632Sopenharmony_ci// Redistribution and use in source and binary forms, with or without 6ffe3c632Sopenharmony_ci// modification, are permitted provided that the following conditions are 7ffe3c632Sopenharmony_ci// met: 8ffe3c632Sopenharmony_ci// 9ffe3c632Sopenharmony_ci// * Redistributions of source code must retain the above copyright 10ffe3c632Sopenharmony_ci// notice, this list of conditions and the following disclaimer. 11ffe3c632Sopenharmony_ci// * Redistributions in binary form must reproduce the above 12ffe3c632Sopenharmony_ci// copyright notice, this list of conditions and the following disclaimer 13ffe3c632Sopenharmony_ci// in the documentation and/or other materials provided with the 14ffe3c632Sopenharmony_ci// distribution. 15ffe3c632Sopenharmony_ci// * Neither the name of Google Inc. nor the names of its 16ffe3c632Sopenharmony_ci// contributors may be used to endorse or promote products derived from 17ffe3c632Sopenharmony_ci// this software without specific prior written permission. 18ffe3c632Sopenharmony_ci// 19ffe3c632Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20ffe3c632Sopenharmony_ci// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21ffe3c632Sopenharmony_ci// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22ffe3c632Sopenharmony_ci// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23ffe3c632Sopenharmony_ci// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24ffe3c632Sopenharmony_ci// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25ffe3c632Sopenharmony_ci// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26ffe3c632Sopenharmony_ci// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27ffe3c632Sopenharmony_ci// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28ffe3c632Sopenharmony_ci// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29ffe3c632Sopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30ffe3c632Sopenharmony_ci 31ffe3c632Sopenharmony_ci#import <Foundation/Foundation.h> 32ffe3c632Sopenharmony_ci 33ffe3c632Sopenharmony_ci#import "GPBArray.h" 34ffe3c632Sopenharmony_ci#import "GPBMessage.h" 35ffe3c632Sopenharmony_ci#import "GPBRuntimeTypes.h" 36ffe3c632Sopenharmony_ci 37ffe3c632Sopenharmony_ci@class GPBOneofDescriptor; 38ffe3c632Sopenharmony_ci 39ffe3c632Sopenharmony_ciCF_EXTERN_C_BEGIN 40ffe3c632Sopenharmony_ci 41ffe3c632Sopenharmony_ciNS_ASSUME_NONNULL_BEGIN 42ffe3c632Sopenharmony_ci 43ffe3c632Sopenharmony_ci/** 44ffe3c632Sopenharmony_ci * Generates a string that should be a valid "TextFormat" for the C++ version 45ffe3c632Sopenharmony_ci * of Protocol Buffers. 46ffe3c632Sopenharmony_ci * 47ffe3c632Sopenharmony_ci * @param message The message to generate from. 48ffe3c632Sopenharmony_ci * @param lineIndent A string to use as the prefix for all lines generated. Can 49ffe3c632Sopenharmony_ci * be nil if no extra indent is needed. 50ffe3c632Sopenharmony_ci * 51ffe3c632Sopenharmony_ci * @return An NSString with the TextFormat of the message. 52ffe3c632Sopenharmony_ci **/ 53ffe3c632Sopenharmony_ciNSString *GPBTextFormatForMessage(GPBMessage *message, 54ffe3c632Sopenharmony_ci NSString * __nullable lineIndent); 55ffe3c632Sopenharmony_ci 56ffe3c632Sopenharmony_ci/** 57ffe3c632Sopenharmony_ci * Generates a string that should be a valid "TextFormat" for the C++ version 58ffe3c632Sopenharmony_ci * of Protocol Buffers. 59ffe3c632Sopenharmony_ci * 60ffe3c632Sopenharmony_ci * @param unknownSet The unknown field set to generate from. 61ffe3c632Sopenharmony_ci * @param lineIndent A string to use as the prefix for all lines generated. Can 62ffe3c632Sopenharmony_ci * be nil if no extra indent is needed. 63ffe3c632Sopenharmony_ci * 64ffe3c632Sopenharmony_ci * @return An NSString with the TextFormat of the unknown field set. 65ffe3c632Sopenharmony_ci **/ 66ffe3c632Sopenharmony_ciNSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet * __nullable unknownSet, 67ffe3c632Sopenharmony_ci NSString * __nullable lineIndent); 68ffe3c632Sopenharmony_ci 69ffe3c632Sopenharmony_ci/** 70ffe3c632Sopenharmony_ci * Checks if the given field number is set on a message. 71ffe3c632Sopenharmony_ci * 72ffe3c632Sopenharmony_ci * @param self The message to check. 73ffe3c632Sopenharmony_ci * @param fieldNumber The field number to check. 74ffe3c632Sopenharmony_ci * 75ffe3c632Sopenharmony_ci * @return YES if the field number is set on the given message. 76ffe3c632Sopenharmony_ci **/ 77ffe3c632Sopenharmony_ciBOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber); 78ffe3c632Sopenharmony_ci 79ffe3c632Sopenharmony_ci/** 80ffe3c632Sopenharmony_ci * Checks if the given field is set on a message. 81ffe3c632Sopenharmony_ci * 82ffe3c632Sopenharmony_ci * @param self The message to check. 83ffe3c632Sopenharmony_ci * @param field The field to check. 84ffe3c632Sopenharmony_ci * 85ffe3c632Sopenharmony_ci * @return YES if the field is set on the given message. 86ffe3c632Sopenharmony_ci **/ 87ffe3c632Sopenharmony_ciBOOL GPBMessageHasFieldSet(GPBMessage *self, GPBFieldDescriptor *field); 88ffe3c632Sopenharmony_ci 89ffe3c632Sopenharmony_ci/** 90ffe3c632Sopenharmony_ci * Clears the given field for the given message. 91ffe3c632Sopenharmony_ci * 92ffe3c632Sopenharmony_ci * @param self The message for which to clear the field. 93ffe3c632Sopenharmony_ci * @param field The field to clear. 94ffe3c632Sopenharmony_ci **/ 95ffe3c632Sopenharmony_civoid GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field); 96ffe3c632Sopenharmony_ci 97ffe3c632Sopenharmony_ci/** 98ffe3c632Sopenharmony_ci * Clears the given oneof field for the given message. 99ffe3c632Sopenharmony_ci * 100ffe3c632Sopenharmony_ci * @param self The message for which to clear the field. 101ffe3c632Sopenharmony_ci * @param oneof The oneof to clear. 102ffe3c632Sopenharmony_ci **/ 103ffe3c632Sopenharmony_civoid GPBClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof); 104ffe3c632Sopenharmony_ci 105ffe3c632Sopenharmony_ci//%PDDM-EXPAND GPB_ACCESSORS() 106ffe3c632Sopenharmony_ci// This block of code is generated, do not edit it directly. 107ffe3c632Sopenharmony_ci// clang-format off 108ffe3c632Sopenharmony_ci 109ffe3c632Sopenharmony_ci 110ffe3c632Sopenharmony_ci// 111ffe3c632Sopenharmony_ci// Get/Set a given field from/to a message. 112ffe3c632Sopenharmony_ci// 113ffe3c632Sopenharmony_ci 114ffe3c632Sopenharmony_ci// Single Fields 115ffe3c632Sopenharmony_ci 116ffe3c632Sopenharmony_ci/** 117ffe3c632Sopenharmony_ci * Gets the value of a bytes field. 118ffe3c632Sopenharmony_ci * 119ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 120ffe3c632Sopenharmony_ci * @param field The field to get. 121ffe3c632Sopenharmony_ci **/ 122ffe3c632Sopenharmony_ciNSData *GPBGetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field); 123ffe3c632Sopenharmony_ci 124ffe3c632Sopenharmony_ci/** 125ffe3c632Sopenharmony_ci * Sets the value of a bytes field. 126ffe3c632Sopenharmony_ci * 127ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 128ffe3c632Sopenharmony_ci * @param field The field to set. 129ffe3c632Sopenharmony_ci * @param value The to set in the field. 130ffe3c632Sopenharmony_ci **/ 131ffe3c632Sopenharmony_civoid GPBSetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field, NSData *value); 132ffe3c632Sopenharmony_ci 133ffe3c632Sopenharmony_ci/** 134ffe3c632Sopenharmony_ci * Gets the value of a string field. 135ffe3c632Sopenharmony_ci * 136ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 137ffe3c632Sopenharmony_ci * @param field The field to get. 138ffe3c632Sopenharmony_ci **/ 139ffe3c632Sopenharmony_ciNSString *GPBGetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field); 140ffe3c632Sopenharmony_ci 141ffe3c632Sopenharmony_ci/** 142ffe3c632Sopenharmony_ci * Sets the value of a string field. 143ffe3c632Sopenharmony_ci * 144ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 145ffe3c632Sopenharmony_ci * @param field The field to set. 146ffe3c632Sopenharmony_ci * @param value The to set in the field. 147ffe3c632Sopenharmony_ci **/ 148ffe3c632Sopenharmony_civoid GPBSetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field, NSString *value); 149ffe3c632Sopenharmony_ci 150ffe3c632Sopenharmony_ci/** 151ffe3c632Sopenharmony_ci * Gets the value of a message field. 152ffe3c632Sopenharmony_ci * 153ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 154ffe3c632Sopenharmony_ci * @param field The field to get. 155ffe3c632Sopenharmony_ci **/ 156ffe3c632Sopenharmony_ciGPBMessage *GPBGetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field); 157ffe3c632Sopenharmony_ci 158ffe3c632Sopenharmony_ci/** 159ffe3c632Sopenharmony_ci * Sets the value of a message field. 160ffe3c632Sopenharmony_ci * 161ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 162ffe3c632Sopenharmony_ci * @param field The field to set. 163ffe3c632Sopenharmony_ci * @param value The to set in the field. 164ffe3c632Sopenharmony_ci **/ 165ffe3c632Sopenharmony_civoid GPBSetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field, GPBMessage *value); 166ffe3c632Sopenharmony_ci 167ffe3c632Sopenharmony_ci/** 168ffe3c632Sopenharmony_ci * Gets the value of a group field. 169ffe3c632Sopenharmony_ci * 170ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 171ffe3c632Sopenharmony_ci * @param field The field to get. 172ffe3c632Sopenharmony_ci **/ 173ffe3c632Sopenharmony_ciGPBMessage *GPBGetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field); 174ffe3c632Sopenharmony_ci 175ffe3c632Sopenharmony_ci/** 176ffe3c632Sopenharmony_ci * Sets the value of a group field. 177ffe3c632Sopenharmony_ci * 178ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 179ffe3c632Sopenharmony_ci * @param field The field to set. 180ffe3c632Sopenharmony_ci * @param value The to set in the field. 181ffe3c632Sopenharmony_ci **/ 182ffe3c632Sopenharmony_civoid GPBSetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field, GPBMessage *value); 183ffe3c632Sopenharmony_ci 184ffe3c632Sopenharmony_ci/** 185ffe3c632Sopenharmony_ci * Gets the value of a bool field. 186ffe3c632Sopenharmony_ci * 187ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 188ffe3c632Sopenharmony_ci * @param field The field to get. 189ffe3c632Sopenharmony_ci **/ 190ffe3c632Sopenharmony_ciBOOL GPBGetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field); 191ffe3c632Sopenharmony_ci 192ffe3c632Sopenharmony_ci/** 193ffe3c632Sopenharmony_ci * Sets the value of a bool field. 194ffe3c632Sopenharmony_ci * 195ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 196ffe3c632Sopenharmony_ci * @param field The field to set. 197ffe3c632Sopenharmony_ci * @param value The to set in the field. 198ffe3c632Sopenharmony_ci **/ 199ffe3c632Sopenharmony_civoid GPBSetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field, BOOL value); 200ffe3c632Sopenharmony_ci 201ffe3c632Sopenharmony_ci/** 202ffe3c632Sopenharmony_ci * Gets the value of an int32 field. 203ffe3c632Sopenharmony_ci * 204ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 205ffe3c632Sopenharmony_ci * @param field The field to get. 206ffe3c632Sopenharmony_ci **/ 207ffe3c632Sopenharmony_ciint32_t GPBGetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field); 208ffe3c632Sopenharmony_ci 209ffe3c632Sopenharmony_ci/** 210ffe3c632Sopenharmony_ci * Sets the value of an int32 field. 211ffe3c632Sopenharmony_ci * 212ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 213ffe3c632Sopenharmony_ci * @param field The field to set. 214ffe3c632Sopenharmony_ci * @param value The to set in the field. 215ffe3c632Sopenharmony_ci **/ 216ffe3c632Sopenharmony_civoid GPBSetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field, int32_t value); 217ffe3c632Sopenharmony_ci 218ffe3c632Sopenharmony_ci/** 219ffe3c632Sopenharmony_ci * Gets the value of an uint32 field. 220ffe3c632Sopenharmony_ci * 221ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 222ffe3c632Sopenharmony_ci * @param field The field to get. 223ffe3c632Sopenharmony_ci **/ 224ffe3c632Sopenharmony_ciuint32_t GPBGetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field); 225ffe3c632Sopenharmony_ci 226ffe3c632Sopenharmony_ci/** 227ffe3c632Sopenharmony_ci * Sets the value of an uint32 field. 228ffe3c632Sopenharmony_ci * 229ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 230ffe3c632Sopenharmony_ci * @param field The field to set. 231ffe3c632Sopenharmony_ci * @param value The to set in the field. 232ffe3c632Sopenharmony_ci **/ 233ffe3c632Sopenharmony_civoid GPBSetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field, uint32_t value); 234ffe3c632Sopenharmony_ci 235ffe3c632Sopenharmony_ci/** 236ffe3c632Sopenharmony_ci * Gets the value of an int64 field. 237ffe3c632Sopenharmony_ci * 238ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 239ffe3c632Sopenharmony_ci * @param field The field to get. 240ffe3c632Sopenharmony_ci **/ 241ffe3c632Sopenharmony_ciint64_t GPBGetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field); 242ffe3c632Sopenharmony_ci 243ffe3c632Sopenharmony_ci/** 244ffe3c632Sopenharmony_ci * Sets the value of an int64 field. 245ffe3c632Sopenharmony_ci * 246ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 247ffe3c632Sopenharmony_ci * @param field The field to set. 248ffe3c632Sopenharmony_ci * @param value The to set in the field. 249ffe3c632Sopenharmony_ci **/ 250ffe3c632Sopenharmony_civoid GPBSetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field, int64_t value); 251ffe3c632Sopenharmony_ci 252ffe3c632Sopenharmony_ci/** 253ffe3c632Sopenharmony_ci * Gets the value of an uint64 field. 254ffe3c632Sopenharmony_ci * 255ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 256ffe3c632Sopenharmony_ci * @param field The field to get. 257ffe3c632Sopenharmony_ci **/ 258ffe3c632Sopenharmony_ciuint64_t GPBGetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field); 259ffe3c632Sopenharmony_ci 260ffe3c632Sopenharmony_ci/** 261ffe3c632Sopenharmony_ci * Sets the value of an uint64 field. 262ffe3c632Sopenharmony_ci * 263ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 264ffe3c632Sopenharmony_ci * @param field The field to set. 265ffe3c632Sopenharmony_ci * @param value The to set in the field. 266ffe3c632Sopenharmony_ci **/ 267ffe3c632Sopenharmony_civoid GPBSetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field, uint64_t value); 268ffe3c632Sopenharmony_ci 269ffe3c632Sopenharmony_ci/** 270ffe3c632Sopenharmony_ci * Gets the value of a float field. 271ffe3c632Sopenharmony_ci * 272ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 273ffe3c632Sopenharmony_ci * @param field The field to get. 274ffe3c632Sopenharmony_ci **/ 275ffe3c632Sopenharmony_cifloat GPBGetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field); 276ffe3c632Sopenharmony_ci 277ffe3c632Sopenharmony_ci/** 278ffe3c632Sopenharmony_ci * Sets the value of a float field. 279ffe3c632Sopenharmony_ci * 280ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 281ffe3c632Sopenharmony_ci * @param field The field to set. 282ffe3c632Sopenharmony_ci * @param value The to set in the field. 283ffe3c632Sopenharmony_ci **/ 284ffe3c632Sopenharmony_civoid GPBSetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field, float value); 285ffe3c632Sopenharmony_ci 286ffe3c632Sopenharmony_ci/** 287ffe3c632Sopenharmony_ci * Gets the value of a double field. 288ffe3c632Sopenharmony_ci * 289ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 290ffe3c632Sopenharmony_ci * @param field The field to get. 291ffe3c632Sopenharmony_ci **/ 292ffe3c632Sopenharmony_cidouble GPBGetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field); 293ffe3c632Sopenharmony_ci 294ffe3c632Sopenharmony_ci/** 295ffe3c632Sopenharmony_ci * Sets the value of a double field. 296ffe3c632Sopenharmony_ci * 297ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 298ffe3c632Sopenharmony_ci * @param field The field to set. 299ffe3c632Sopenharmony_ci * @param value The to set in the field. 300ffe3c632Sopenharmony_ci **/ 301ffe3c632Sopenharmony_civoid GPBSetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field, double value); 302ffe3c632Sopenharmony_ci 303ffe3c632Sopenharmony_ci/** 304ffe3c632Sopenharmony_ci * Gets the given enum field of a message. For proto3, if the value isn't a 305ffe3c632Sopenharmony_ci * member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned. 306ffe3c632Sopenharmony_ci * GPBGetMessageRawEnumField will bypass the check and return whatever value 307ffe3c632Sopenharmony_ci * was set. 308ffe3c632Sopenharmony_ci * 309ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 310ffe3c632Sopenharmony_ci * @param field The field to get. 311ffe3c632Sopenharmony_ci * 312ffe3c632Sopenharmony_ci * @return The enum value for the given field. 313ffe3c632Sopenharmony_ci **/ 314ffe3c632Sopenharmony_ciint32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); 315ffe3c632Sopenharmony_ci 316ffe3c632Sopenharmony_ci/** 317ffe3c632Sopenharmony_ci * Set the given enum field of a message. You can only set values that are 318ffe3c632Sopenharmony_ci * members of the enum. 319ffe3c632Sopenharmony_ci * 320ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 321ffe3c632Sopenharmony_ci * @param field The field to set. 322ffe3c632Sopenharmony_ci * @param value The enum value to set in the field. 323ffe3c632Sopenharmony_ci **/ 324ffe3c632Sopenharmony_civoid GPBSetMessageEnumField(GPBMessage *self, 325ffe3c632Sopenharmony_ci GPBFieldDescriptor *field, 326ffe3c632Sopenharmony_ci int32_t value); 327ffe3c632Sopenharmony_ci 328ffe3c632Sopenharmony_ci/** 329ffe3c632Sopenharmony_ci * Get the given enum field of a message. No check is done to ensure the value 330ffe3c632Sopenharmony_ci * was defined in the enum. 331ffe3c632Sopenharmony_ci * 332ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 333ffe3c632Sopenharmony_ci * @param field The field to get. 334ffe3c632Sopenharmony_ci * 335ffe3c632Sopenharmony_ci * @return The raw enum value for the given field. 336ffe3c632Sopenharmony_ci **/ 337ffe3c632Sopenharmony_ciint32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field); 338ffe3c632Sopenharmony_ci 339ffe3c632Sopenharmony_ci/** 340ffe3c632Sopenharmony_ci * Set the given enum field of a message. You can set the value to anything, 341ffe3c632Sopenharmony_ci * even a value that is not a member of the enum. 342ffe3c632Sopenharmony_ci * 343ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 344ffe3c632Sopenharmony_ci * @param field The field to set. 345ffe3c632Sopenharmony_ci * @param value The raw enum value to set in the field. 346ffe3c632Sopenharmony_ci **/ 347ffe3c632Sopenharmony_civoid GPBSetMessageRawEnumField(GPBMessage *self, 348ffe3c632Sopenharmony_ci GPBFieldDescriptor *field, 349ffe3c632Sopenharmony_ci int32_t value); 350ffe3c632Sopenharmony_ci 351ffe3c632Sopenharmony_ci// Repeated Fields 352ffe3c632Sopenharmony_ci 353ffe3c632Sopenharmony_ci/** 354ffe3c632Sopenharmony_ci * Gets the value of a repeated field. 355ffe3c632Sopenharmony_ci * 356ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 357ffe3c632Sopenharmony_ci * @param field The repeated field to get. 358ffe3c632Sopenharmony_ci * 359ffe3c632Sopenharmony_ci * @return A GPB*Array or an NSMutableArray based on the field's type. 360ffe3c632Sopenharmony_ci **/ 361ffe3c632Sopenharmony_ciid GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); 362ffe3c632Sopenharmony_ci 363ffe3c632Sopenharmony_ci/** 364ffe3c632Sopenharmony_ci * Sets the value of a repeated field. 365ffe3c632Sopenharmony_ci * 366ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 367ffe3c632Sopenharmony_ci * @param field The field to set. 368ffe3c632Sopenharmony_ci * @param array A GPB*Array or NSMutableArray based on the field's type. 369ffe3c632Sopenharmony_ci **/ 370ffe3c632Sopenharmony_civoid GPBSetMessageRepeatedField(GPBMessage *self, 371ffe3c632Sopenharmony_ci GPBFieldDescriptor *field, 372ffe3c632Sopenharmony_ci id array); 373ffe3c632Sopenharmony_ci 374ffe3c632Sopenharmony_ci// Map Fields 375ffe3c632Sopenharmony_ci 376ffe3c632Sopenharmony_ci/** 377ffe3c632Sopenharmony_ci * Gets the value of a map<> field. 378ffe3c632Sopenharmony_ci * 379ffe3c632Sopenharmony_ci * @param self The message from which to get the field. 380ffe3c632Sopenharmony_ci * @param field The repeated field to get. 381ffe3c632Sopenharmony_ci * 382ffe3c632Sopenharmony_ci * @return A GPB*Dictionary or NSMutableDictionary based on the field's type. 383ffe3c632Sopenharmony_ci **/ 384ffe3c632Sopenharmony_ciid GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); 385ffe3c632Sopenharmony_ci 386ffe3c632Sopenharmony_ci/** 387ffe3c632Sopenharmony_ci * Sets the value of a map<> field. 388ffe3c632Sopenharmony_ci * 389ffe3c632Sopenharmony_ci * @param self The message into which to set the field. 390ffe3c632Sopenharmony_ci * @param field The field to set. 391ffe3c632Sopenharmony_ci * @param dictionary A GPB*Dictionary or NSMutableDictionary based on the 392ffe3c632Sopenharmony_ci * field's type. 393ffe3c632Sopenharmony_ci **/ 394ffe3c632Sopenharmony_civoid GPBSetMessageMapField(GPBMessage *self, 395ffe3c632Sopenharmony_ci GPBFieldDescriptor *field, 396ffe3c632Sopenharmony_ci id dictionary); 397ffe3c632Sopenharmony_ci 398ffe3c632Sopenharmony_ci// clang-format on 399ffe3c632Sopenharmony_ci//%PDDM-EXPAND-END GPB_ACCESSORS() 400ffe3c632Sopenharmony_ci 401ffe3c632Sopenharmony_ci/** 402ffe3c632Sopenharmony_ci * Returns an empty NSData to assign to byte fields when you wish to assign them 403ffe3c632Sopenharmony_ci * to empty. Prevents allocating a lot of little [NSData data] objects. 404ffe3c632Sopenharmony_ci **/ 405ffe3c632Sopenharmony_ciNSData *GPBEmptyNSData(void) __attribute__((pure)); 406ffe3c632Sopenharmony_ci 407ffe3c632Sopenharmony_ci/** 408ffe3c632Sopenharmony_ci * Drops the `unknownFields` from the given message and from all sub message. 409ffe3c632Sopenharmony_ci **/ 410ffe3c632Sopenharmony_civoid GPBMessageDropUnknownFieldsRecursively(GPBMessage *message); 411ffe3c632Sopenharmony_ci 412ffe3c632Sopenharmony_ciNS_ASSUME_NONNULL_END 413ffe3c632Sopenharmony_ci 414ffe3c632Sopenharmony_ciCF_EXTERN_C_END 415ffe3c632Sopenharmony_ci 416ffe3c632Sopenharmony_ci 417ffe3c632Sopenharmony_ci//%PDDM-DEFINE GPB_ACCESSORS() 418ffe3c632Sopenharmony_ci//% 419ffe3c632Sopenharmony_ci//%// 420ffe3c632Sopenharmony_ci//%// Get/Set a given field from/to a message. 421ffe3c632Sopenharmony_ci//%// 422ffe3c632Sopenharmony_ci//% 423ffe3c632Sopenharmony_ci//%// Single Fields 424ffe3c632Sopenharmony_ci//% 425ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE_FULL(Bytes, NSData, , *) 426ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE_FULL(String, NSString, , *) 427ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE_FULL(Message, GPBMessage, , *) 428ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE_FULL(Group, GPBMessage, , *) 429ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE(Bool, BOOL, ) 430ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE(Int32, int32_t, n) 431ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE(UInt32, uint32_t, n) 432ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE(Int64, int64_t, n) 433ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE(UInt64, uint64_t, n) 434ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE(Float, float, ) 435ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE(Double, double, ) 436ffe3c632Sopenharmony_ci//%/** 437ffe3c632Sopenharmony_ci//% * Gets the given enum field of a message. For proto3, if the value isn't a 438ffe3c632Sopenharmony_ci//% * member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned. 439ffe3c632Sopenharmony_ci//% * GPBGetMessageRawEnumField will bypass the check and return whatever value 440ffe3c632Sopenharmony_ci//% * was set. 441ffe3c632Sopenharmony_ci//% * 442ffe3c632Sopenharmony_ci//% * @param self The message from which to get the field. 443ffe3c632Sopenharmony_ci//% * @param field The field to get. 444ffe3c632Sopenharmony_ci//% * 445ffe3c632Sopenharmony_ci//% * @return The enum value for the given field. 446ffe3c632Sopenharmony_ci//% **/ 447ffe3c632Sopenharmony_ci//%int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field); 448ffe3c632Sopenharmony_ci//% 449ffe3c632Sopenharmony_ci//%/** 450ffe3c632Sopenharmony_ci//% * Set the given enum field of a message. You can only set values that are 451ffe3c632Sopenharmony_ci//% * members of the enum. 452ffe3c632Sopenharmony_ci//% * 453ffe3c632Sopenharmony_ci//% * @param self The message into which to set the field. 454ffe3c632Sopenharmony_ci//% * @param field The field to set. 455ffe3c632Sopenharmony_ci//% * @param value The enum value to set in the field. 456ffe3c632Sopenharmony_ci//% **/ 457ffe3c632Sopenharmony_ci//%void GPBSetMessageEnumField(GPBMessage *self, 458ffe3c632Sopenharmony_ci//% GPBFieldDescriptor *field, 459ffe3c632Sopenharmony_ci//% int32_t value); 460ffe3c632Sopenharmony_ci//% 461ffe3c632Sopenharmony_ci//%/** 462ffe3c632Sopenharmony_ci//% * Get the given enum field of a message. No check is done to ensure the value 463ffe3c632Sopenharmony_ci//% * was defined in the enum. 464ffe3c632Sopenharmony_ci//% * 465ffe3c632Sopenharmony_ci//% * @param self The message from which to get the field. 466ffe3c632Sopenharmony_ci//% * @param field The field to get. 467ffe3c632Sopenharmony_ci//% * 468ffe3c632Sopenharmony_ci//% * @return The raw enum value for the given field. 469ffe3c632Sopenharmony_ci//% **/ 470ffe3c632Sopenharmony_ci//%int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field); 471ffe3c632Sopenharmony_ci//% 472ffe3c632Sopenharmony_ci//%/** 473ffe3c632Sopenharmony_ci//% * Set the given enum field of a message. You can set the value to anything, 474ffe3c632Sopenharmony_ci//% * even a value that is not a member of the enum. 475ffe3c632Sopenharmony_ci//% * 476ffe3c632Sopenharmony_ci//% * @param self The message into which to set the field. 477ffe3c632Sopenharmony_ci//% * @param field The field to set. 478ffe3c632Sopenharmony_ci//% * @param value The raw enum value to set in the field. 479ffe3c632Sopenharmony_ci//% **/ 480ffe3c632Sopenharmony_ci//%void GPBSetMessageRawEnumField(GPBMessage *self, 481ffe3c632Sopenharmony_ci//% GPBFieldDescriptor *field, 482ffe3c632Sopenharmony_ci//% int32_t value); 483ffe3c632Sopenharmony_ci//% 484ffe3c632Sopenharmony_ci//%// Repeated Fields 485ffe3c632Sopenharmony_ci//% 486ffe3c632Sopenharmony_ci//%/** 487ffe3c632Sopenharmony_ci//% * Gets the value of a repeated field. 488ffe3c632Sopenharmony_ci//% * 489ffe3c632Sopenharmony_ci//% * @param self The message from which to get the field. 490ffe3c632Sopenharmony_ci//% * @param field The repeated field to get. 491ffe3c632Sopenharmony_ci//% * 492ffe3c632Sopenharmony_ci//% * @return A GPB*Array or an NSMutableArray based on the field's type. 493ffe3c632Sopenharmony_ci//% **/ 494ffe3c632Sopenharmony_ci//%id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field); 495ffe3c632Sopenharmony_ci//% 496ffe3c632Sopenharmony_ci//%/** 497ffe3c632Sopenharmony_ci//% * Sets the value of a repeated field. 498ffe3c632Sopenharmony_ci//% * 499ffe3c632Sopenharmony_ci//% * @param self The message into which to set the field. 500ffe3c632Sopenharmony_ci//% * @param field The field to set. 501ffe3c632Sopenharmony_ci//% * @param array A GPB*Array or NSMutableArray based on the field's type. 502ffe3c632Sopenharmony_ci//% **/ 503ffe3c632Sopenharmony_ci//%void GPBSetMessageRepeatedField(GPBMessage *self, 504ffe3c632Sopenharmony_ci//% GPBFieldDescriptor *field, 505ffe3c632Sopenharmony_ci//% id array); 506ffe3c632Sopenharmony_ci//% 507ffe3c632Sopenharmony_ci//%// Map Fields 508ffe3c632Sopenharmony_ci//% 509ffe3c632Sopenharmony_ci//%/** 510ffe3c632Sopenharmony_ci//% * Gets the value of a map<> field. 511ffe3c632Sopenharmony_ci//% * 512ffe3c632Sopenharmony_ci//% * @param self The message from which to get the field. 513ffe3c632Sopenharmony_ci//% * @param field The repeated field to get. 514ffe3c632Sopenharmony_ci//% * 515ffe3c632Sopenharmony_ci//% * @return A GPB*Dictionary or NSMutableDictionary based on the field's type. 516ffe3c632Sopenharmony_ci//% **/ 517ffe3c632Sopenharmony_ci//%id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field); 518ffe3c632Sopenharmony_ci//% 519ffe3c632Sopenharmony_ci//%/** 520ffe3c632Sopenharmony_ci//% * Sets the value of a map<> field. 521ffe3c632Sopenharmony_ci//% * 522ffe3c632Sopenharmony_ci//% * @param self The message into which to set the field. 523ffe3c632Sopenharmony_ci//% * @param field The field to set. 524ffe3c632Sopenharmony_ci//% * @param dictionary A GPB*Dictionary or NSMutableDictionary based on the 525ffe3c632Sopenharmony_ci//% * field's type. 526ffe3c632Sopenharmony_ci//% **/ 527ffe3c632Sopenharmony_ci//%void GPBSetMessageMapField(GPBMessage *self, 528ffe3c632Sopenharmony_ci//% GPBFieldDescriptor *field, 529ffe3c632Sopenharmony_ci//% id dictionary); 530ffe3c632Sopenharmony_ci//% 531ffe3c632Sopenharmony_ci 532ffe3c632Sopenharmony_ci//%PDDM-DEFINE GPB_ACCESSOR_SINGLE(NAME, TYPE, AN) 533ffe3c632Sopenharmony_ci//%GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, ) 534ffe3c632Sopenharmony_ci//%PDDM-DEFINE GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, TisP) 535ffe3c632Sopenharmony_ci//%/** 536ffe3c632Sopenharmony_ci//% * Gets the value of a##AN NAME$L field. 537ffe3c632Sopenharmony_ci//% * 538ffe3c632Sopenharmony_ci//% * @param self The message from which to get the field. 539ffe3c632Sopenharmony_ci//% * @param field The field to get. 540ffe3c632Sopenharmony_ci//% **/ 541ffe3c632Sopenharmony_ci//%TYPE TisP##GPBGetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field); 542ffe3c632Sopenharmony_ci//% 543ffe3c632Sopenharmony_ci//%/** 544ffe3c632Sopenharmony_ci//% * Sets the value of a##AN NAME$L field. 545ffe3c632Sopenharmony_ci//% * 546ffe3c632Sopenharmony_ci//% * @param self The message into which to set the field. 547ffe3c632Sopenharmony_ci//% * @param field The field to set. 548ffe3c632Sopenharmony_ci//% * @param value The to set in the field. 549ffe3c632Sopenharmony_ci//% **/ 550ffe3c632Sopenharmony_ci//%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field, TYPE TisP##value); 551ffe3c632Sopenharmony_ci//% 552