summaryrefslogtreecommitdiff
path: root/packages/cocoaint/src/foundation/NSHashTable.inc
blob: 86399e9bb8ec7f0af301626cfdfed558538be382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{ Parsed from Foundation.framework NSHashTable.h }


{ Types from NSHashTable }
{$ifdef TYPES}

{$endif}


{$ifdef TYPES}
type
  NSHashTablePtr = ^NSHashTable;
{$endif}

{$if  not (defined(__FOUNDATION_NSHASHTABLE__))}
{$ifdef TYPES}
const
  __FOUNDATION_NSHASHTABLE__ = 1;

const
  NSHashTableStrongMemory = 0 { available in 10_5, 6_0 };
  {$if (defined(TARGET_OS_MAC) and not (defined(TARGET_OS_EMBEDDED) or defined(TARGET_OS_IPHONE))) or defined(TARGET_OS_WIN32)}
  NSHashTableZeroingWeakMemory = NSPointerFunctionsZeroingWeakMemory deprecated 'in 10_5, 10_8';
  {$endif}
  NSHashTableCopyIn = NSPointerFunctionsCopyIn { available in 10_5, 6_0 };
  NSHashTableObjectPointerPersonality = NSPointerFunctionsObjectPointerPersonality { available in 10_5, 6_0 };
  NSHashTableWeakMemory = NSPointerFunctionsWeakMemory { available in 10_8, 6_0 };

type
  NSHashTableOptions = NSUInteger;
  NSHashTableOptionsPtr = ^NSHashTableOptions;
{$endif}

{$ifdef CLASSES}

type
  NSHashTable = objcclass external (NSObject, NSCopyingProtocol, NSCodingProtocol, NSFastEnumerationProtocol)
  public
    function initWithOptions_capacity (options: NSPointerFunctionsOptions; initialCapacity: NSUInteger): instancetype; message 'initWithOptions:capacity:'; { NS_DESIGNATED_INITIALIZER }
    function initWithPointerFunctions_capacity (functions: NSPointerFunctions; initialCapacity: NSUInteger): instancetype; message 'initWithPointerFunctions:capacity:'; { NS_DESIGNATED_INITIALIZER }
    class function hashTableWithOptions (options: NSPointerFunctionsOptions): NSHashTable; message 'hashTableWithOptions:';
    {$if (defined(TARGET_OS_MAC) and not (defined(TARGET_OS_EMBEDDED) or defined(TARGET_OS_IPHONE))) or defined(TARGET_OS_WIN32)}
    class function hashTableWithWeakObjects: id; message 'hashTableWithWeakObjects'; deprecated 'in 10_5, 10_8';
    {$endif}
    class function weakObjectsHashTable: NSHashTable; message 'weakObjectsHashTable'; { available in 10_8, 6_0 }
    function pointerFunctions: NSPointerFunctions; message 'pointerFunctions';
    function count: NSUInteger; message 'count';
    function member (object_: id): id; message 'member:';
    function objectEnumerator: NSEnumerator; message 'objectEnumerator';
    procedure addObject (object_: id); message 'addObject:';
    procedure removeObject (object_: id); message 'removeObject:';
    procedure removeAllObjects; message 'removeAllObjects';
    function allObjects: NSArray; message 'allObjects';
    function anyObject: id; message 'anyObject';
    function containsObject (anObject: id): ObjCBOOL; message 'containsObject:';
    function intersectsHashTable (other: NSHashTable): ObjCBOOL; message 'intersectsHashTable:';
    function isEqualToHashTable (other: NSHashTable): ObjCBOOL; message 'isEqualToHashTable:';
    function isSubsetOfHashTable (other: NSHashTable): ObjCBOOL; message 'isSubsetOfHashTable:';
    procedure intersectHashTable (other: NSHashTable); message 'intersectHashTable:';
    procedure unionHashTable (other: NSHashTable); message 'unionHashTable:';
    procedure minusHashTable (other: NSHashTable); message 'minusHashTable:';
    function setRepresentation: NSSet; message 'setRepresentation';

    { Adopted protocols }
    function copyWithZone (zone: NSZonePtr): id; message 'copyWithZone:';
    function countByEnumeratingWithState_objects_count (state: NSFastEnumerationStatePtr; buffer: idPtr { variable size array of id }; len: NSUInteger): NSUInteger; message 'countByEnumeratingWithState:objects:count:';
    procedure encodeWithCoder (aCoder: NSCoder); message 'encodeWithCoder:';
    function initWithCoder (aDecoder: NSCoder): id; message 'initWithCoder:';
  end;
{$endif}

{$if (defined(TARGET_OS_MAC) and not (defined(TARGET_OS_EMBEDDED) or defined(TARGET_OS_IPHONE))) or defined(TARGET_OS_WIN32)}
{$ifdef TYPES}
type
  NSHashEnumerator = record
    _pi: NSUInteger;
    _si: NSUInteger;
    _bs: pointer;
  end;
type
  NSHashEnumeratorPtr = ^NSHashEnumerator;
{$endif}

{$ifdef FUNCTIONS}
procedure NSFreeHashTable(table: NSHashTable); cdecl; external;
procedure NSResetHashTable(table: NSHashTable); cdecl; external;
function NSCompareHashTables(table1: NSHashTable; table2: NSHashTable): ObjCBOOL; cdecl; external;
function NSCopyHashTableWithZone(table: NSHashTable; zone: NSZonePtr): NSHashTable; cdecl; external;
function NSHashGet(table: NSHashTable; pointer_: pointer): pointer; cdecl; external;
procedure NSHashInsert(table: NSHashTable; pointer_: pointer); cdecl; external;
procedure NSHashInsertKnownAbsent(table: NSHashTable; pointer_: pointer); cdecl; external;
function NSHashInsertIfAbsent(table: NSHashTable; pointer_: pointer): pointer; cdecl; external;
procedure NSHashRemove(table: NSHashTable; pointer_: pointer); cdecl; external;
function NSEnumerateHashTable(table: NSHashTable): NSHashEnumerator; cdecl; external;
function NSNextHashEnumeratorItem(enumerator: NSHashEnumeratorPtr): pointer; cdecl; external;
procedure NSEndHashTableEnumeration(enumerator: NSHashEnumeratorPtr); cdecl; external;
function NSCountHashTable(table: NSHashTable): NSUInteger; cdecl; external;
function NSStringFromHashTable(table: NSHashTable): NSString; cdecl; external;
function NSAllHashTableObjects(table: NSHashTable): NSArray; cdecl; external;
{$endif}

{$ifdef TYPES}
type
  NSHashTableCallBacks = record
    hash: function (table: NSHashTable; param2: pointer): NSUInteger; cdecl;
    isEqual: function (table: NSHashTable; param2: pointer; param3: pointer): ObjCBOOL; cdecl;
    retain: procedure (table: NSHashTable; param2: pointer); cdecl;
    release: procedure (table: NSHashTable; param2: pointer); cdecl;
    describe: function (table: NSHashTable; param2: pointer): NSString; cdecl;
  end;
type
  NSHashTableCallBacksPtr = ^NSHashTableCallBacks;
{$endif}

{$ifdef FUNCTIONS}
function NSCreateHashTableWithZone(callBacks: NSHashTableCallBacks; capacity: NSUInteger; zone: NSZonePtr): NSHashTable; cdecl; external;
function NSCreateHashTable(callBacks: NSHashTableCallBacks; capacity: NSUInteger): NSHashTable; cdecl; external;
{$endif}

{$ifdef EXTERNAL_SYMBOLS}
var
  NSIntegerHashCallBacks: NSHashTableCallBacks { available in 10_5 }; cvar; external;
  NSNonOwnedPointerHashCallBacks: NSHashTableCallBacks; cvar; external;
  NSNonRetainedObjectHashCallBacks: NSHashTableCallBacks; cvar; external;
  NSObjectHashCallBacks: NSHashTableCallBacks; cvar; external;
  NSOwnedObjectIdentityHashCallBacks: NSHashTableCallBacks; cvar; external;
  NSOwnedPointerHashCallBacks: NSHashTableCallBacks; cvar; external;
  NSPointerToStructHashCallBacks: NSHashTableCallBacks; cvar; external;
  NSIntHashCallBacks: NSHashTableCallBacks deprecated 'in 10_0, 10_5'; cvar; external;
{$endif}

{$else}

{$endif}
{$endif}