2015-05-01 12:57:16 +00:00
|
|
|
// Protocol Buffers - Google's data interchange format
|
|
|
|
// Copyright 2015 Google Inc. All rights reserved.
|
|
|
|
// https://developers.google.com/protocol-buffers/
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following disclaimer
|
|
|
|
// in the documentation and/or other materials provided with the
|
|
|
|
// distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived from
|
|
|
|
// this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
2015-06-08 20:24:57 +00:00
|
|
|
#import "GPBRuntimeTypes.h"
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2015-06-16 20:45:14 +00:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2015-05-01 12:57:16 +00:00
|
|
|
//%PDDM-EXPAND DECLARE_ARRAYS()
|
|
|
|
// This block of code is generated, do not edit it directly.
|
2020-01-20 21:47:20 +00:00
|
|
|
// clang-format off
|
2015-05-01 12:57:16 +00:00
|
|
|
|
|
|
|
#pragma mark - Int32
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Class used for repeated fields of int32_t values. This performs better than
|
|
|
|
* boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBInt32Array : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBInt32Array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBInt32Array with the single element given.
|
|
|
|
*
|
|
|
|
* @param value The value to be placed in the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBInt32Array with value in it.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValue:(int32_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBInt32Array with the contents of the given
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
* @param array Array with the contents to be put into the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBInt32Array with the contents of array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBInt32Array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBInt32Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly initialized and empty GPBInt32Array.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBInt32Array with a copy of the values.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (instancetype)initWithValues:(const int32_t [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBInt32Array with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBInt32Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBInt32Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (int32_t)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(int32_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the values from the given array to this array.
|
|
|
|
*
|
|
|
|
* @param array The array containing the elements to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValuesFromArray:(GPBInt32Array *)array;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark - UInt32
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Class used for repeated fields of uint32_t values. This performs better than
|
|
|
|
* boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBUInt32Array : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBUInt32Array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBUInt32Array with the single element given.
|
|
|
|
*
|
|
|
|
* @param value The value to be placed in the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBUInt32Array with value in it.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValue:(uint32_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBUInt32Array with the contents of the given
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
* @param array Array with the contents to be put into the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBUInt32Array with the contents of array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBUInt32Array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBUInt32Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly initialized and empty GPBUInt32Array.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBUInt32Array with a copy of the values.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (instancetype)initWithValues:(const uint32_t [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBUInt32Array with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBUInt32Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBUInt32Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (uint32_t)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(uint32_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the values from the given array to this array.
|
|
|
|
*
|
|
|
|
* @param array The array containing the elements to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValuesFromArray:(GPBUInt32Array *)array;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark - Int64
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Class used for repeated fields of int64_t values. This performs better than
|
|
|
|
* boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBInt64Array : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBInt64Array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBInt64Array with the single element given.
|
|
|
|
*
|
|
|
|
* @param value The value to be placed in the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBInt64Array with value in it.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValue:(int64_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBInt64Array with the contents of the given
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
* @param array Array with the contents to be put into the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBInt64Array with the contents of array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBInt64Array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBInt64Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly initialized and empty GPBInt64Array.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBInt64Array with a copy of the values.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (instancetype)initWithValues:(const int64_t [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBInt64Array with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBInt64Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBInt64Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (int64_t)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(int64_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the values from the given array to this array.
|
|
|
|
*
|
|
|
|
* @param array The array containing the elements to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValuesFromArray:(GPBInt64Array *)array;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark - UInt64
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Class used for repeated fields of uint64_t values. This performs better than
|
|
|
|
* boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBUInt64Array : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBUInt64Array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBUInt64Array with the single element given.
|
|
|
|
*
|
|
|
|
* @param value The value to be placed in the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBUInt64Array with value in it.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValue:(uint64_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBUInt64Array with the contents of the given
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
* @param array Array with the contents to be put into the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBUInt64Array with the contents of array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBUInt64Array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBUInt64Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly initialized and empty GPBUInt64Array.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBUInt64Array with a copy of the values.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (instancetype)initWithValues:(const uint64_t [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBUInt64Array with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBUInt64Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBUInt64Array with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (uint64_t)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(uint64_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the values from the given array to this array.
|
|
|
|
*
|
|
|
|
* @param array The array containing the elements to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValuesFromArray:(GPBUInt64Array *)array;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark - Float
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Class used for repeated fields of float values. This performs better than
|
|
|
|
* boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBFloatArray : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBFloatArray.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBFloatArray with the single element given.
|
|
|
|
*
|
|
|
|
* @param value The value to be placed in the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBFloatArray with value in it.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValue:(float)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBFloatArray with the contents of the given
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
* @param array Array with the contents to be put into the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBFloatArray with the contents of array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBFloatArray with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBFloatArray with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly initialized and empty GPBFloatArray.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBFloatArray with a copy of the values.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (instancetype)initWithValues:(const float [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBFloatArray with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBFloatArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBFloatArray with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (float)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(float)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the values from the given array to this array.
|
|
|
|
*
|
|
|
|
* @param array The array containing the elements to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValuesFromArray:(GPBFloatArray *)array;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(float)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark - Double
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Class used for repeated fields of double values. This performs better than
|
|
|
|
* boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBDoubleArray : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBDoubleArray.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBDoubleArray with the single element given.
|
|
|
|
*
|
|
|
|
* @param value The value to be placed in the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBDoubleArray with value in it.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValue:(double)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBDoubleArray with the contents of the given
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
* @param array Array with the contents to be put into the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBDoubleArray with the contents of array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBDoubleArray with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBDoubleArray with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly initialized and empty GPBDoubleArray.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBDoubleArray with a copy of the values.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (instancetype)initWithValues:(const double [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBDoubleArray with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBDoubleArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBDoubleArray with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (double)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(double)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the values from the given array to this array.
|
|
|
|
*
|
|
|
|
* @param array The array containing the elements to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValuesFromArray:(GPBDoubleArray *)array;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(double)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark - Bool
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Class used for repeated fields of BOOL values. This performs better than
|
|
|
|
* boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBBoolArray : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBBoolArray.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBBoolArray with the single element given.
|
|
|
|
*
|
|
|
|
* @param value The value to be placed in the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBBoolArray with value in it.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValue:(BOOL)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBBoolArray with the contents of the given
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
* @param array Array with the contents to be put into the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBBoolArray with the contents of array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBBoolArray with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBBoolArray with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly initialized and empty GPBBoolArray.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBBoolArray with a copy of the values.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (instancetype)initWithValues:(const BOOL [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBBoolArray with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBBoolArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBBoolArray with a capacity of count.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (BOOL)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(BOOL)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const BOOL [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the values from the given array to this array.
|
|
|
|
*
|
|
|
|
* @param array The array containing the elements to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValuesFromArray:(GPBBoolArray *)array;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark - Enum
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* This class is used for repeated fields of int32_t values. This performs
|
|
|
|
* better than boxing into NSNumbers in NSArrays.
|
|
|
|
*
|
|
|
|
* @note This class is not meant to be subclassed.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
@interface GPBEnumArray : NSObject <NSCopying>
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger count;
|
2016-08-08 14:15:02 +00:00
|
|
|
/** The validation function to check if the enums are valid. */
|
2015-05-01 12:57:16 +00:00
|
|
|
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @return A newly instanced and empty GPBEnumArray.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBEnumArray with the enum validation function
|
|
|
|
* given.
|
|
|
|
*
|
|
|
|
* @param func The enum validation function for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBEnumArray.
|
|
|
|
**/
|
2015-06-16 20:45:14 +00:00
|
|
|
+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBEnumArray with the enum validation function
|
|
|
|
* given and the single raw value given.
|
|
|
|
*
|
|
|
|
* @param func The enum validation function for the array.
|
|
|
|
* @param value The raw value to add to this array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBEnumArray.
|
|
|
|
**/
|
2015-06-16 20:45:14 +00:00
|
|
|
+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2015-05-01 12:57:16 +00:00
|
|
|
rawValue:(int32_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBEnumArray that adds the elements from the
|
|
|
|
* given array.
|
|
|
|
*
|
|
|
|
* @param array Array containing the values to add to the new array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBEnumArray.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
+ (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates and initializes a GPBEnumArray with the given enum validation
|
|
|
|
* function and with the givencapacity.
|
|
|
|
*
|
|
|
|
* @param func The enum validation function for the array.
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly instanced GPBEnumArray with a capacity of count.
|
|
|
|
**/
|
2015-06-16 20:45:14 +00:00
|
|
|
+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2015-05-01 12:57:16 +00:00
|
|
|
capacity:(NSUInteger)count;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Initializes the array with the given enum validation function.
|
|
|
|
*
|
|
|
|
* @param func The enum validation function for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBEnumArray with a copy of the values.
|
|
|
|
**/
|
2016-05-10 14:28:09 +00:00
|
|
|
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
|
|
|
NS_DESIGNATED_INITIALIZER;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param func The enum validation function for the array.
|
|
|
|
* @param values An array with the values to put inside this array.
|
|
|
|
* @param count The number of elements to copy into the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBEnumArray with a copy of the values.
|
|
|
|
**/
|
2015-06-16 20:45:14 +00:00
|
|
|
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2017-01-25 16:51:54 +00:00
|
|
|
rawValues:(const int32_t [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array, copying the given values.
|
|
|
|
*
|
|
|
|
* @param array An array with the values to put inside this array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBEnumArray with a copy of the values.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (instancetype)initWithValueArray:(GPBEnumArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the array with the given capacity.
|
|
|
|
*
|
|
|
|
* @param func The enum validation function for the array.
|
|
|
|
* @param count The capacity needed for the array.
|
|
|
|
*
|
|
|
|
* @return A newly initialized GPBEnumArray with a capacity of count.
|
|
|
|
**/
|
2015-06-16 20:45:14 +00:00
|
|
|
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2015-05-01 12:57:16 +00:00
|
|
|
capacity:(NSUInteger)count;
|
|
|
|
|
|
|
|
// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
|
|
|
|
// valid enumerator as defined by validationFunc. If the actual value is
|
|
|
|
// desired, use "raw" version of the method.
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to get.
|
|
|
|
*
|
|
|
|
* @return The value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (int32_t)valueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
|
|
|
// These methods bypass the validationFunc to provide access to values that were not
|
|
|
|
// known at the time the binary was compiled.
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Gets the raw enum value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the raw enum value to get.
|
|
|
|
*
|
|
|
|
* @return The raw enum value at the given index.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (int32_t)rawValueAtIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2018-12-04 15:47:35 +00:00
|
|
|
- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumerates the values on this array with the given block.
|
|
|
|
*
|
|
|
|
* @param opts Options to control the enumeration.
|
|
|
|
* @param block The block to enumerate with.
|
|
|
|
* **value**: The current value being enumerated.
|
|
|
|
* **idx**: The index of the current value.
|
|
|
|
* **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
|
|
|
// If value is not a valid enumerator as defined by validationFunc, these
|
|
|
|
// methods will assert in debug, and will log in release and assign the value
|
|
|
|
// to the default value. Use the rawValue methods below to assign non enumerator
|
|
|
|
// values.
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this array.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addValue:(int32_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds values to this array.
|
|
|
|
*
|
|
|
|
* @param values The values to add to this array.
|
|
|
|
* @param count The number of elements to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Inserts a value into the given position.
|
|
|
|
*
|
|
|
|
* @param value The value to add to this array.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
|
|
|
|
|
|
|
|
// These methods bypass the validationFunc to provide setting of values that were not
|
|
|
|
// known at the time the binary was compiled.
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Adds a raw enum value to this array.
|
|
|
|
*
|
|
|
|
* @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
* were not known at the time the binary was compiled.
|
|
|
|
*
|
|
|
|
* @param value The raw enum value to add to the array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addRawValue:(int32_t)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds raw enum values to this array.
|
|
|
|
*
|
|
|
|
* @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
* were not known at the time the binary was compiled.
|
|
|
|
*
|
|
|
|
* @param array Array containing the raw enum values to add to this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)addRawValuesFromArray:(GPBEnumArray *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds raw enum values to this array.
|
|
|
|
*
|
|
|
|
* @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
* were not known at the time the binary was compiled.
|
|
|
|
*
|
|
|
|
* @param values Array containing the raw enum values to add to this array.
|
|
|
|
* @param count The number of raw values to add.
|
|
|
|
**/
|
2017-01-25 16:51:54 +00:00
|
|
|
- (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Inserts a raw enum value at the given index.
|
|
|
|
*
|
|
|
|
* @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
* were not known at the time the binary was compiled.
|
|
|
|
*
|
|
|
|
* @param value Raw enum value to add.
|
|
|
|
* @param index The index into which to insert the value.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Replaces the raw enum value at the given index with the given value.
|
|
|
|
*
|
|
|
|
* @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
* were not known at the time the binary was compiled.
|
|
|
|
*
|
|
|
|
* @param index The index for which to replace the value.
|
|
|
|
* @param value The raw enum value to replace with.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
|
|
|
|
|
|
|
|
// No validation applies to these methods.
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the value at the given index.
|
|
|
|
*
|
|
|
|
* @param index The index of the value to remove.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all the values from this array.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)removeAll;
|
|
|
|
|
2016-08-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Exchanges the values between the given indexes.
|
|
|
|
*
|
|
|
|
* @param idx1 The index of the first element to exchange.
|
|
|
|
* @param idx2 The index of the second element to exchange.
|
|
|
|
**/
|
2015-05-01 12:57:16 +00:00
|
|
|
- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2020-01-20 21:47:20 +00:00
|
|
|
// clang-format on
|
2015-05-01 12:57:16 +00:00
|
|
|
//%PDDM-EXPAND-END DECLARE_ARRAYS()
|
|
|
|
|
2015-06-16 20:45:14 +00:00
|
|
|
NS_ASSUME_NONNULL_END
|
|
|
|
|
2015-05-01 12:57:16 +00:00
|
|
|
//%PDDM-DEFINE DECLARE_ARRAYS()
|
|
|
|
//%ARRAY_INTERFACE_SIMPLE(Int32, int32_t)
|
|
|
|
//%ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t)
|
|
|
|
//%ARRAY_INTERFACE_SIMPLE(Int64, int64_t)
|
|
|
|
//%ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t)
|
|
|
|
//%ARRAY_INTERFACE_SIMPLE(Float, float)
|
|
|
|
//%ARRAY_INTERFACE_SIMPLE(Double, double)
|
|
|
|
//%ARRAY_INTERFACE_SIMPLE(Bool, BOOL)
|
|
|
|
//%ARRAY_INTERFACE_ENUM(Enum, int32_t)
|
|
|
|
|
|
|
|
//
|
|
|
|
// The common case (everything but Enum)
|
|
|
|
//
|
|
|
|
|
|
|
|
//%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
|
|
|
|
//%#pragma mark - NAME
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Class used for repeated fields of ##TYPE## values. This performs better than
|
|
|
|
//% * boxing into NSNumbers in NSArrays.
|
|
|
|
//% *
|
|
|
|
//% * @note This class is not meant to be subclassed.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%@interface GPB##NAME##Array : NSObject <NSCopying>
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
//%@property(nonatomic, readonly) NSUInteger count;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * @return A newly instanced and empty GPB##NAME##Array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Creates and initializes a GPB##NAME##Array with the single element given.
|
2017-02-07 16:57:53 +00:00
|
|
|
//% *
|
2016-08-08 14:15:02 +00:00
|
|
|
//% * @param value The value to be placed in the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly instanced GPB##NAME##Array with value in it.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%+ (instancetype)arrayWithValue:(TYPE)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Creates and initializes a GPB##NAME##Array with the contents of the given
|
|
|
|
//% * array.
|
|
|
|
//% *
|
|
|
|
//% * @param array Array with the contents to be put into the new array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly instanced GPB##NAME##Array with the contents of array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Creates and initializes a GPB##NAME##Array with the given capacity.
|
|
|
|
//% *
|
|
|
|
//% * @param count The capacity needed for the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly instanced GPB##NAME##Array with a capacity of count.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
|
|
|
|
//%
|
2017-02-07 16:57:53 +00:00
|
|
|
//%/**
|
2016-08-08 14:15:02 +00:00
|
|
|
//% * @return A newly initialized and empty GPB##NAME##Array.
|
|
|
|
//% **/
|
2016-05-10 14:28:09 +00:00
|
|
|
//%- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Initializes the array, copying the given values.
|
|
|
|
//% *
|
|
|
|
//% * @param values An array with the values to put inside this array.
|
|
|
|
//% * @param count The number of elements to copy into the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
|
|
|
|
//% **/
|
2017-01-25 16:51:54 +00:00
|
|
|
//%- (instancetype)initWithValues:(const TYPE [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
//% count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Initializes the array, copying the given values.
|
|
|
|
//% *
|
|
|
|
//% * @param array An array with the values to put inside this array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Initializes the array with the given capacity.
|
|
|
|
//% *
|
|
|
|
//% * @param count The capacity needed for the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly initialized GPB##NAME##Array with a capacity of count.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (instancetype)initWithCapacity:(NSUInteger)count;
|
|
|
|
//%
|
|
|
|
//%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
|
|
|
|
//%
|
|
|
|
//%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, Basic)
|
|
|
|
//%
|
|
|
|
//%@end
|
|
|
|
//%
|
|
|
|
|
|
|
|
//
|
|
|
|
// Macros specific to Enums (to tweak their interface).
|
|
|
|
//
|
|
|
|
|
|
|
|
//%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
|
|
|
|
//%#pragma mark - NAME
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * This class is used for repeated fields of ##TYPE## values. This performs
|
|
|
|
//% * better than boxing into NSNumbers in NSArrays.
|
|
|
|
//% *
|
|
|
|
//% * @note This class is not meant to be subclassed.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%@interface GPB##NAME##Array : NSObject <NSCopying>
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/** The number of elements contained in the array. */
|
2015-05-01 12:57:16 +00:00
|
|
|
//%@property(nonatomic, readonly) NSUInteger count;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/** The validation function to check if the enums are valid. */
|
2015-05-01 12:57:16 +00:00
|
|
|
//%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * @return A newly instanced and empty GPB##NAME##Array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%+ (instancetype)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Creates and initializes a GPB##NAME##Array with the enum validation function
|
|
|
|
//% * given.
|
|
|
|
//% *
|
|
|
|
//% * @param func The enum validation function for the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly instanced GPB##NAME##Array.
|
|
|
|
//% **/
|
2015-06-16 20:45:14 +00:00
|
|
|
//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Creates and initializes a GPB##NAME##Array with the enum validation function
|
|
|
|
//% * given and the single raw value given.
|
|
|
|
//% *
|
|
|
|
//% * @param func The enum validation function for the array.
|
|
|
|
//% * @param value The raw value to add to this array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly instanced GPB##NAME##Array.
|
|
|
|
//% **/
|
2015-06-16 20:45:14 +00:00
|
|
|
//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2015-05-01 12:57:16 +00:00
|
|
|
//% rawValue:(TYPE)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Creates and initializes a GPB##NAME##Array that adds the elements from the
|
|
|
|
//% * given array.
|
|
|
|
//% *
|
|
|
|
//% * @param array Array containing the values to add to the new array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly instanced GPB##NAME##Array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Creates and initializes a GPB##NAME##Array with the given enum validation
|
|
|
|
//% * function and with the givencapacity.
|
|
|
|
//% *
|
|
|
|
//% * @param func The enum validation function for the array.
|
|
|
|
//% * @param count The capacity needed for the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly instanced GPB##NAME##Array with a capacity of count.
|
|
|
|
//% **/
|
2015-06-16 20:45:14 +00:00
|
|
|
//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2015-05-01 12:57:16 +00:00
|
|
|
//% capacity:(NSUInteger)count;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Initializes the array with the given enum validation function.
|
|
|
|
//% *
|
|
|
|
//% * @param func The enum validation function for the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
|
|
|
|
//% **/
|
2016-05-10 14:28:09 +00:00
|
|
|
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
|
|
|
//% NS_DESIGNATED_INITIALIZER;
|
2015-05-01 12:57:16 +00:00
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Initializes the array, copying the given values.
|
|
|
|
//% *
|
|
|
|
//% * @param func The enum validation function for the array.
|
|
|
|
//% * @param values An array with the values to put inside this array.
|
|
|
|
//% * @param count The number of elements to copy into the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
|
|
|
|
//% **/
|
2015-06-16 20:45:14 +00:00
|
|
|
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2017-01-25 16:51:54 +00:00
|
|
|
//% rawValues:(const TYPE [__nullable])values
|
2016-05-10 14:28:09 +00:00
|
|
|
//% count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Initializes the array, copying the given values.
|
|
|
|
//% *
|
|
|
|
//% * @param array An array with the values to put inside this array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Initializes the array with the given capacity.
|
|
|
|
//% *
|
|
|
|
//% * @param func The enum validation function for the array.
|
|
|
|
//% * @param count The capacity needed for the array.
|
|
|
|
//% *
|
|
|
|
//% * @return A newly initialized GPB##NAME##Array with a capacity of count.
|
|
|
|
//% **/
|
2015-06-16 20:45:14 +00:00
|
|
|
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
|
2015-05-01 12:57:16 +00:00
|
|
|
//% capacity:(NSUInteger)count;
|
|
|
|
//%
|
|
|
|
//%// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
|
|
|
|
//%// valid enumerator as defined by validationFunc. If the actual value is
|
|
|
|
//%// desired, use "raw" version of the method.
|
|
|
|
//%
|
|
|
|
//%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, NAME)
|
|
|
|
//%
|
|
|
|
//%// These methods bypass the validationFunc to provide access to values that were not
|
|
|
|
//%// known at the time the binary was compiled.
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Gets the raw enum value at the given index.
|
|
|
|
//% *
|
|
|
|
//% * @param index The index of the raw enum value to get.
|
|
|
|
//% *
|
|
|
|
//% * @return The raw enum value at the given index.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (TYPE)rawValueAtIndex:(NSUInteger)index;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Enumerates the values on this array with the given block.
|
2017-02-07 16:57:53 +00:00
|
|
|
//% *
|
2016-08-08 14:15:02 +00:00
|
|
|
//% * @param block The block to enumerate with.
|
|
|
|
//% * **value**: The current value being enumerated.
|
|
|
|
//% * **idx**: The index of the current value.
|
|
|
|
//% * **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
//% **/
|
2018-12-04 15:47:35 +00:00
|
|
|
//%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Enumerates the values on this array with the given block.
|
|
|
|
//% *
|
|
|
|
//% * @param opts Options to control the enumeration.
|
|
|
|
//% * @param block The block to enumerate with.
|
|
|
|
//% * **value**: The current value being enumerated.
|
|
|
|
//% * **idx**: The index of the current value.
|
|
|
|
//% * **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
//% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
//%
|
|
|
|
//%// If value is not a valid enumerator as defined by validationFunc, these
|
|
|
|
//%// methods will assert in debug, and will log in release and assign the value
|
|
|
|
//%// to the default value. Use the rawValue methods below to assign non enumerator
|
|
|
|
//%// values.
|
|
|
|
//%
|
|
|
|
//%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, NAME)
|
|
|
|
//%
|
|
|
|
//%@end
|
|
|
|
//%
|
|
|
|
|
|
|
|
//%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Gets the value at the given index.
|
|
|
|
//% *
|
|
|
|
//% * @param index The index of the value to get.
|
|
|
|
//% *
|
|
|
|
//% * @return The value at the given index.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (TYPE)valueAtIndex:(NSUInteger)index;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Enumerates the values on this array with the given block.
|
|
|
|
//% *
|
|
|
|
//% * @param block The block to enumerate with.
|
|
|
|
//% * **value**: The current value being enumerated.
|
|
|
|
//% * **idx**: The index of the current value.
|
|
|
|
//% * **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
//% **/
|
2018-12-04 15:47:35 +00:00
|
|
|
//%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Enumerates the values on this array with the given block.
|
|
|
|
//% *
|
|
|
|
//% * @param opts Options to control the enumeration.
|
2017-02-07 16:57:53 +00:00
|
|
|
//% * @param block The block to enumerate with.
|
2016-08-08 14:15:02 +00:00
|
|
|
//% * **value**: The current value being enumerated.
|
|
|
|
//% * **idx**: The index of the current value.
|
|
|
|
//% * **stop**: A pointer to a boolean that when set stops the enumeration.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
|
2018-12-04 15:47:35 +00:00
|
|
|
//% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
|
2015-05-01 12:57:16 +00:00
|
|
|
|
|
|
|
//%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Adds a value to this array.
|
|
|
|
//% *
|
|
|
|
//% * @param value The value to add to this array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)addValue:(TYPE)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Adds values to this array.
|
|
|
|
//% *
|
|
|
|
//% * @param values The values to add to this array.
|
|
|
|
//% * @param count The number of elements to add.
|
|
|
|
//% **/
|
2017-01-25 16:51:54 +00:00
|
|
|
//%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
2015-05-01 12:57:16 +00:00
|
|
|
//%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Inserts a value into the given position.
|
|
|
|
//% *
|
|
|
|
//% * @param value The value to add to this array.
|
|
|
|
//% * @param index The index into which to insert the value.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Replaces the value at the given index with the given value.
|
|
|
|
//% *
|
|
|
|
//% * @param index The index for which to replace the value.
|
|
|
|
//% * @param value The value to replace with.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
|
|
|
|
//%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Removes the value at the given index.
|
|
|
|
//% *
|
|
|
|
//% * @param index The index of the value to remove.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)removeValueAtIndex:(NSUInteger)index;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Removes all the values from this array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)removeAll;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Exchanges the values between the given indexes.
|
|
|
|
//% *
|
|
|
|
//% * @param idx1 The index of the first element to exchange.
|
|
|
|
//% * @param idx2 The index of the second element to exchange.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)exchangeValueAtIndex:(NSUInteger)idx1
|
|
|
|
//% withValueAtIndex:(NSUInteger)idx2;
|
|
|
|
|
|
|
|
//
|
|
|
|
// These are hooks invoked by the above to do insert as needed.
|
|
|
|
//
|
|
|
|
|
|
|
|
//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Adds the values from the given array to this array.
|
|
|
|
//% *
|
|
|
|
//% * @param array The array containing the elements to add to this array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
|
|
|
|
//%
|
|
|
|
//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
|
|
|
|
// Empty
|
|
|
|
//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Enum(NAME, TYPE)
|
|
|
|
// Empty
|
|
|
|
//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Enum(NAME, TYPE)
|
|
|
|
//%
|
|
|
|
//%// These methods bypass the validationFunc to provide setting of values that were not
|
|
|
|
//%// known at the time the binary was compiled.
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Adds a raw enum value to this array.
|
|
|
|
//% *
|
|
|
|
//% * @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
//% * were not known at the time the binary was compiled.
|
|
|
|
//% *
|
|
|
|
//% * @param value The raw enum value to add to the array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)addRawValue:(TYPE)value;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Adds raw enum values to this array.
|
|
|
|
//% *
|
|
|
|
//% * @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
//% * were not known at the time the binary was compiled.
|
|
|
|
//% *
|
|
|
|
//% * @param array Array containing the raw enum values to add to this array.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
|
2016-08-08 14:15:02 +00:00
|
|
|
//%
|
|
|
|
//%/**
|
|
|
|
//% * Adds raw enum values to this array.
|
|
|
|
//% *
|
|
|
|
//% * @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
//% * were not known at the time the binary was compiled.
|
|
|
|
//% *
|
|
|
|
//% * @param values Array containing the raw enum values to add to this array.
|
|
|
|
//% * @param count The number of raw values to add.
|
|
|
|
//% **/
|
2017-01-25 16:51:54 +00:00
|
|
|
//%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
|
2015-05-01 12:57:16 +00:00
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Inserts a raw enum value at the given index.
|
|
|
|
//% *
|
|
|
|
//% * @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
//% * were not known at the time the binary was compiled.
|
|
|
|
//% *
|
|
|
|
//% * @param value Raw enum value to add.
|
|
|
|
//% * @param index The index into which to insert the value.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
|
|
|
|
//%
|
2016-08-08 14:15:02 +00:00
|
|
|
//%/**
|
|
|
|
//% * Replaces the raw enum value at the given index with the given value.
|
|
|
|
//% *
|
|
|
|
//% * @note This method bypass the validationFunc to enable the setting of values that
|
|
|
|
//% * were not known at the time the binary was compiled.
|
|
|
|
//% *
|
|
|
|
//% * @param index The index for which to replace the value.
|
|
|
|
//% * @param value The raw enum value to replace with.
|
|
|
|
//% **/
|
2015-05-01 12:57:16 +00:00
|
|
|
//%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
|
|
|
|
//%
|
|
|
|
//%// No validation applies to these methods.
|
|
|
|
//%
|