1{ Parsed from Foundation.framework NSArray.h }
2
3
4{ Types from NSExtendedArray }
5{$ifdef TYPES}
6
7type
8  NSBinarySearchingOptions = NSUInteger;
9type
10  NSBinarySearchingOptionsPtr = ^NSBinarySearchingOptions;
11
12const
13  NSBinarySearchingFirstEqual = 1 shl 8;
14  NSBinarySearchingLastEqual = 1 shl 9;
15  NSBinarySearchingInsertionIndex = 1 shl 10;
16{$endif}
17
18
19{ Callbacks }
20{$ifdef TYPES}
21type
22  NSArraySortedArrayUsingFunctionComparatorCallback = function (param1: id; param2: id; param3: pointer): NSInteger; cdecl;
23  NSArraySortUsingFunctionCompareCallback = function (param1: id; param2: id; param3: pointer): NSInteger; cdecl;
24{$endif}
25
26
27{$ifdef TYPES}
28type
29  NSArrayPtr = ^NSArray;
30  NSMutableArrayPtr = ^NSMutableArray;
31{$endif}
32
33{$ifdef CLASSES}
34
35type
36  NSArray = objcclass external (NSObject, NSCopyingProtocol, NSMutableCopyingProtocol, NSSecureCodingProtocol, NSFastEnumerationProtocol)
37  public
38    function count: NSUInteger; message 'count';
39    function objectAtIndex (index: NSUInteger): id; message 'objectAtIndex:';
40    function init: instancetype; message 'init'; { NS_DESIGNATED_INITIALIZER }
41    function initWithObjects_count (objects: idPtr { variable size array of id }; cnt: NSUInteger): instancetype; message 'initWithObjects:count:'; { NS_DESIGNATED_INITIALIZER }
42    function initWithCoder (aDecoder: NSCoder): instancetype; message 'initWithCoder:'; { NS_DESIGNATED_INITIALIZER }
43
44    { Adopted protocols }
45    function copyWithZone (zone: NSZonePtr): id; message 'copyWithZone:';
46    function countByEnumeratingWithState_objects_count (state: NSFastEnumerationStatePtr; buffer: idPtr { variable size array of id }; len: NSUInteger): NSUInteger; message 'countByEnumeratingWithState:objects:count:';
47    procedure encodeWithCoder (aCoder: NSCoder); message 'encodeWithCoder:';
48    function mutableCopyWithZone (zone: NSZonePtr): id; message 'mutableCopyWithZone:';
49    class function supportsSecureCoding: ObjCBOOL; message 'supportsSecureCoding';
50  end;
51
52
53type
54  NSExtendedArray = objccategory external (NSArray)
55    function arrayByAddingObject (anObject: id): NSArray; message 'arrayByAddingObject:';
56    function arrayByAddingObjectsFromArray (otherArray: NSArray): NSArray; message 'arrayByAddingObjectsFromArray:';
57    function componentsJoinedByString (separator: NSString): NSString; message 'componentsJoinedByString:';
58    function containsObject (anObject: id): ObjCBOOL; message 'containsObject:';
59    function description: NSString; message 'description';
60    function descriptionWithLocale (locale: id): NSString; message 'descriptionWithLocale:';
61    function descriptionWithLocale_indent (locale: id; level: NSUInteger): NSString; message 'descriptionWithLocale:indent:';
62    function firstObjectCommonWithArray (otherArray: NSArray): id; message 'firstObjectCommonWithArray:';
63    procedure getObjects_range (objects: idPtr { variable size array of id }; range: NSRange); message 'getObjects:range:';
64    function indexOfObject (anObject: id): NSUInteger; message 'indexOfObject:';
65    function indexOfObject_inRange (anObject: id; range: NSRange): NSUInteger; message 'indexOfObject:inRange:';
66    function indexOfObjectIdenticalTo (anObject: id): NSUInteger; message 'indexOfObjectIdenticalTo:';
67    function indexOfObjectIdenticalTo_inRange (anObject: id; range: NSRange): NSUInteger; message 'indexOfObjectIdenticalTo:inRange:';
68    function isEqualToArray (otherArray: NSArray): ObjCBOOL; message 'isEqualToArray:';
69    function firstObject: id; message 'firstObject';
70    function lastObject: id; message 'lastObject';
71    function objectEnumerator: NSEnumerator; message 'objectEnumerator';
72    function reverseObjectEnumerator: NSEnumerator; message 'reverseObjectEnumerator';
73    function sortedArrayHint: NSData; message 'sortedArrayHint';
74    function sortedArrayUsingFunction_context (comparator: NSArraySortedArrayUsingFunctionComparatorCallback; context: pointer): NSArray; message 'sortedArrayUsingFunction:context:';
75    function sortedArrayUsingFunction_context_hint (comparator: NSArraySortedArrayUsingFunctionComparatorCallback; context: pointer; hint: NSData): NSArray; message 'sortedArrayUsingFunction:context:hint:';
76    function sortedArrayUsingSelector (comparator: SEL): NSArray; message 'sortedArrayUsingSelector:';
77    function subarrayWithRange (range: NSRange): NSArray; message 'subarrayWithRange:';
78    function writeToFile_atomically (path: NSString; useAuxiliaryFile: ObjCBOOL): ObjCBOOL; message 'writeToFile:atomically:';
79    function writeToURL_atomically (url: NSURL; atomically: ObjCBOOL): ObjCBOOL; message 'writeToURL:atomically:';
80    procedure makeObjectsPerformSelector (aSelector: SEL); message 'makeObjectsPerformSelector:';
81    procedure makeObjectsPerformSelector_withObject (aSelector: SEL; argument: id); message 'makeObjectsPerformSelector:withObject:';
82    function objectsAtIndexes (indexes: NSIndexSet): NSArray; message 'objectsAtIndexes:';
83    function objectAtIndexedSubscript (idx: NSUInteger): id; message 'objectAtIndexedSubscript:'; { available in 10_8, 6_0 }
84    procedure enumerateObjectsUsingBlock (block: OpaqueCBlock); message 'enumerateObjectsUsingBlock:'; { available in 10_6, 4_0 }
85    procedure enumerateObjectsWithOptions_usingBlock (opts: NSEnumerationOptions; block: OpaqueCBlock); message 'enumerateObjectsWithOptions:usingBlock:'; { available in 10_6, 4_0 }
86    procedure enumerateObjectsAtIndexes_options_usingBlock (s: NSIndexSet; opts: NSEnumerationOptions; block: OpaqueCBlock); message 'enumerateObjectsAtIndexes:options:usingBlock:'; { available in 10_6, 4_0 }
87    function indexOfObjectPassingTest (predicate: OpaqueCBlock): NSUInteger; message 'indexOfObjectPassingTest:'; { available in 10_6, 4_0 }
88    function indexOfObjectWithOptions_passingTest (opts: NSEnumerationOptions; predicate: OpaqueCBlock): NSUInteger; message 'indexOfObjectWithOptions:passingTest:'; { available in 10_6, 4_0 }
89    function indexOfObjectAtIndexes_options_passingTest (s: NSIndexSet; opts: NSEnumerationOptions; predicate: OpaqueCBlock): NSUInteger; message 'indexOfObjectAtIndexes:options:passingTest:'; { available in 10_6, 4_0 }
90    function indexesOfObjectsPassingTest (predicate: OpaqueCBlock): NSIndexSet; message 'indexesOfObjectsPassingTest:'; { available in 10_6, 4_0 }
91    function indexesOfObjectsWithOptions_passingTest (opts: NSEnumerationOptions; predicate: OpaqueCBlock): NSIndexSet; message 'indexesOfObjectsWithOptions:passingTest:'; { available in 10_6, 4_0 }
92    function indexesOfObjectsAtIndexes_options_passingTest (s: NSIndexSet; opts: NSEnumerationOptions; predicate: OpaqueCBlock): NSIndexSet; message 'indexesOfObjectsAtIndexes:options:passingTest:'; { available in 10_6, 4_0 }
93    function sortedArrayUsingComparator (cmptr: NSComparator): NSArray; message 'sortedArrayUsingComparator:'; { available in 10_6, 4_0 }
94    function sortedArrayWithOptions_usingComparator (opts: NSSortOptions; cmptr: NSComparator): NSArray; message 'sortedArrayWithOptions:usingComparator:'; { available in 10_6, 4_0 }
95    function indexOfObject_inSortedRange_options_usingComparator (obj: id; r: NSRange; opts: NSBinarySearchingOptions; cmp: NSComparator): NSUInteger; message 'indexOfObject:inSortedRange:options:usingComparator:'; { available in 10_6, 4_0 }
96  end;
97
98type
99  NSArrayCreation = objccategory external (NSArray)
100    class function array_: instancetype; message 'array';
101    class function arrayWithObject (anObject: id): instancetype; message 'arrayWithObject:';
102    class function arrayWithObjects_count (objects: idPtr { variable size array of id }; cnt: NSUInteger): instancetype; message 'arrayWithObjects:count:';
103    class function arrayWithObjects (firstObj: id): instancetype; varargs; message 'arrayWithObjects:';
104    class function arrayWithArray (array__: NSArray): instancetype; message 'arrayWithArray:';
105    function initWithObjects (firstObj: id): instancetype; varargs; message 'initWithObjects:';
106    function initWithArray (array__: NSArray): instancetype; message 'initWithArray:';
107    function initWithArray_copyItems (array__: NSArray; flag: ObjCBOOL): instancetype; message 'initWithArray:copyItems:';
108    class function arrayWithContentsOfFile (path: NSString): NSArray; message 'arrayWithContentsOfFile:';
109    class function arrayWithContentsOfURL (url: NSURL): NSArray; message 'arrayWithContentsOfURL:';
110    function initWithContentsOfFile (path: NSString): NSArray; message 'initWithContentsOfFile:';
111    function initWithContentsOfURL (url: NSURL): NSArray; message 'initWithContentsOfURL:';
112  end;
113
114type
115  NSArray_NSDeprecated = objccategory external name 'NSDeprecated' (NSArray)
116    procedure getObjects (objects: idPtr { variable size array of id }); message 'getObjects:';
117  end;
118
119
120type
121  NSMutableArray = objcclass external (NSArray)
122  public
123    procedure addObject (anObject: id); message 'addObject:';
124    procedure insertObject_atIndex (anObject: id; index: NSUInteger); message 'insertObject:atIndex:';
125    procedure removeLastObject; message 'removeLastObject';
126    procedure removeObjectAtIndex (index: NSUInteger); message 'removeObjectAtIndex:';
127    procedure replaceObjectAtIndex_withObject (index: NSUInteger; anObject: id); message 'replaceObjectAtIndex:withObject:';
128    function init: instancetype; message 'init'; { NS_DESIGNATED_INITIALIZER }
129    function initWithCapacity (numItems: NSUInteger): instancetype; message 'initWithCapacity:'; { NS_DESIGNATED_INITIALIZER }
130    function initWithCoder (aDecoder: NSCoder): instancetype; message 'initWithCoder:'; { NS_DESIGNATED_INITIALIZER }
131  end;
132
133
134type
135  NSExtendedMutableArray = objccategory external (NSMutableArray)
136    procedure addObjectsFromArray (otherArray: NSArray); message 'addObjectsFromArray:';
137    procedure exchangeObjectAtIndex_withObjectAtIndex (idx1: NSUInteger; idx2: NSUInteger); message 'exchangeObjectAtIndex:withObjectAtIndex:';
138    procedure removeAllObjects; message 'removeAllObjects';
139    procedure removeObject_inRange (anObject: id; range: NSRange); message 'removeObject:inRange:';
140    procedure removeObject (anObject: id); message 'removeObject:';
141    procedure removeObjectIdenticalTo_inRange (anObject: id; range: NSRange); message 'removeObjectIdenticalTo:inRange:';
142    procedure removeObjectIdenticalTo (anObject: id); message 'removeObjectIdenticalTo:';
143    procedure removeObjectsFromIndices_numIndices (indices: NSUIntegerPtr; cnt: NSUInteger); message 'removeObjectsFromIndices:numIndices:'; deprecated 'in 10_0, 10_6, 2_0, 4_0';
144    procedure removeObjectsInArray (otherArray: NSArray); message 'removeObjectsInArray:';
145    procedure removeObjectsInRange (range: NSRange); message 'removeObjectsInRange:';
146    procedure replaceObjectsInRange_withObjectsFromArray_range (range: NSRange; otherArray: NSArray; otherRange: NSRange); message 'replaceObjectsInRange:withObjectsFromArray:range:';
147    procedure replaceObjectsInRange_withObjectsFromArray (range: NSRange; otherArray: NSArray); message 'replaceObjectsInRange:withObjectsFromArray:';
148    procedure setArray (otherArray: NSArray); message 'setArray:';
149    procedure sortUsingFunction_context (compare: NSArraySortUsingFunctionCompareCallback; context: pointer); message 'sortUsingFunction:context:';
150    procedure sortUsingSelector (comparator: SEL); message 'sortUsingSelector:';
151    procedure insertObjects_atIndexes (objects: NSArray; indexes: NSIndexSet); message 'insertObjects:atIndexes:';
152    procedure removeObjectsAtIndexes (indexes: NSIndexSet); message 'removeObjectsAtIndexes:';
153    procedure replaceObjectsAtIndexes_withObjects (indexes: NSIndexSet; objects: NSArray); message 'replaceObjectsAtIndexes:withObjects:';
154    procedure setObject_atIndexedSubscript (obj: id; idx: NSUInteger); message 'setObject:atIndexedSubscript:'; { available in 10_8, 6_0 }
155    procedure sortUsingComparator (cmptr: NSComparator); message 'sortUsingComparator:'; { available in 10_6, 4_0 }
156    procedure sortWithOptions_usingComparator (opts: NSSortOptions; cmptr: NSComparator); message 'sortWithOptions:usingComparator:'; { available in 10_6, 4_0 }
157  end;
158
159type
160  NSMutableArrayCreation = objccategory external (NSMutableArray)
161    class function arrayWithCapacity (numItems: NSUInteger): instancetype; message 'arrayWithCapacity:';
162    class function arrayWithContentsOfFile (path: NSString): NSMutableArray; message 'arrayWithContentsOfFile:';
163    class function arrayWithContentsOfURL (url: NSURL): NSMutableArray; message 'arrayWithContentsOfURL:';
164    function initWithContentsOfFile (path: NSString): NSMutableArray; message 'initWithContentsOfFile:';
165    function initWithContentsOfURL (url: NSURL): NSMutableArray; message 'initWithContentsOfURL:';
166  end;
167{$endif}
168
169