~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/univint/ABAddressBook.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
//  ABAddressBookC.h
 
3
//  AddressBook Framework
 
4
//
 
5
//  Copyright (c) 2002-2003 Apple Computer. All rights reserved.
 
6
//
 
7
 
 
8
{         Pascal Translation:  Peter N Lewis, <peter@stairways.com.au>, 2004 }
 
9
 
 
10
 
 
11
{
 
12
    Modified for use with Free Pascal
 
13
    Version 200
 
14
    Please report any bugs to <gpc@microbizz.nl>
 
15
}
 
16
 
 
17
{$mode macpas}
 
18
{$packenum 1}
 
19
{$macro on}
 
20
{$inline on}
 
21
{$CALLING MWPASCAL}
 
22
 
 
23
unit ABAddressBook;
 
24
interface
 
25
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
 
26
{$setc GAP_INTERFACES_VERSION := $0200}
 
27
 
 
28
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
 
29
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
 
30
{$endc}
 
31
 
 
32
{$ifc defined CPUPOWERPC and defined CPUI386}
 
33
        {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
 
34
{$endc}
 
35
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
 
36
        {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
 
37
{$endc}
 
38
 
 
39
{$ifc not defined __ppc__ and defined CPUPOWERPC}
 
40
        {$setc __ppc__ := 1}
 
41
{$elsec}
 
42
        {$setc __ppc__ := 0}
 
43
{$endc}
 
44
{$ifc not defined __i386__ and defined CPUI386}
 
45
        {$setc __i386__ := 1}
 
46
{$elsec}
 
47
        {$setc __i386__ := 0}
 
48
{$endc}
 
49
 
 
50
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
 
51
        {$error Conflicting definitions for __ppc__ and __i386__}
 
52
{$endc}
 
53
 
 
54
{$ifc defined __ppc__ and __ppc__}
 
55
        {$setc TARGET_CPU_PPC := TRUE}
 
56
        {$setc TARGET_CPU_X86 := FALSE}
 
57
{$elifc defined __i386__ and __i386__}
 
58
        {$setc TARGET_CPU_PPC := FALSE}
 
59
        {$setc TARGET_CPU_X86 := TRUE}
 
60
{$elsec}
 
61
        {$error Neither __ppc__ nor __i386__ is defined.}
 
62
{$endc}
 
63
{$setc TARGET_CPU_PPC_64 := FALSE}
 
64
 
 
65
{$ifc defined FPC_BIG_ENDIAN}
 
66
        {$setc TARGET_RT_BIG_ENDIAN := TRUE}
 
67
        {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
 
68
{$elifc defined FPC_LITTLE_ENDIAN}
 
69
        {$setc TARGET_RT_BIG_ENDIAN := FALSE}
 
70
        {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
 
71
{$elsec}
 
72
        {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
 
73
{$endc}
 
74
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
 
75
{$setc CALL_NOT_IN_CARBON := FALSE}
 
76
{$setc OLDROUTINENAMES := FALSE}
 
77
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
 
78
{$setc OPAQUE_UPP_TYPES := TRUE}
 
79
{$setc OTCARBONAPPLICATION := TRUE}
 
80
{$setc OTKERNEL := FALSE}
 
81
{$setc PM_USE_SESSION_APIS := TRUE}
 
82
{$setc TARGET_API_MAC_CARBON := TRUE}
 
83
{$setc TARGET_API_MAC_OS8 := FALSE}
 
84
{$setc TARGET_API_MAC_OSX := TRUE}
 
85
{$setc TARGET_CARBON := TRUE}
 
86
{$setc TARGET_CPU_68K := FALSE}
 
87
{$setc TARGET_CPU_MIPS := FALSE}
 
88
{$setc TARGET_CPU_SPARC := FALSE}
 
89
{$setc TARGET_OS_MAC := TRUE}
 
90
{$setc TARGET_OS_UNIX := FALSE}
 
91
{$setc TARGET_OS_WIN32 := FALSE}
 
92
{$setc TARGET_RT_MAC_68881 := FALSE}
 
93
{$setc TARGET_RT_MAC_CFM := FALSE}
 
94
{$setc TARGET_RT_MAC_MACHO := TRUE}
 
95
{$setc TYPED_FUNCTION_POINTERS := TRUE}
 
96
{$setc TYPE_BOOL := FALSE}
 
97
{$setc TYPE_EXTENDED := FALSE}
 
98
{$setc TYPE_LONGLONG := TRUE}
 
99
uses MacTypes,ABTypedefs,ABGlobals,CFBase,CFArray,CFDictionary,CFData;
 
100
{$ALIGN MAC68K}
 
101
 
 
102
type
 
103
        ABRecordRef    = ^SInt32; { an opaque 32-bit type }
 
104
        ABPersonRef    = ^SInt32; { an opaque 32-bit type }
 
105
        ABGroupRef    = ^SInt32; { an opaque 32-bit type }
 
106
        ABSearchElementRef    = ^SInt32; { an opaque 32-bit type }
 
107
        ABAddressBookRef    = ^SInt32; { an opaque 32-bit type }
 
108
        ABMultiValueRef    = ^SInt32; { an opaque 32-bit type }
 
109
        ABMutableMultiValueRef    = ^SInt32; { an opaque 32-bit type }
 
110
 
 
111
// --------------------------------------------------------------------------------
 
112
//      LSOpenCFURLRef support
 
113
// --------------------------------------------------------------------------------
 
114
// An application can open the AddressBook app and select (and edit) a specific
 
115
// person by using the LSOpenCFURLRef API.
 
116
//
 
117
// To launch (or bring to front) the Address Book app and select a given person
 
118
//
 
119
// CFStringRef uniqueId = ABRecordCopyUniqueId(aPerson);
 
120
// CFStringRef urlString = CFStringCreateWithFormat(NULL, CFSTR(addressbook://%@), uniqueId);
 
121
// CFURLRef urlRef = CFURLCreateWithString(NULL, urlString, NULL);
 
122
// LSOpenCFURLRef(urlRef, NULL);
 
123
// CFRelease(uniqueId);
 
124
// CFRelease(urlRef);
 
125
// CFRelease(urlString);
 
126
//
 
127
// To launch (or bring to front) the Address Book app and edit a given person
 
128
//
 
129
// CFStringRef uniqueId = ABRecordCopyUniqueId(aPerson);
 
130
// CFStringRef urlString = CFStringCreateWithFormat(NULL, CFSTR(addressbook://%@?edit), uniqueId);
 
131
// CFURLRef urlRef = CFURLCreateWithString(NULL, urlString, NULL);
 
132
// LSOpenCFURLRef(urlRef, NULL);
 
133
// CFRelease(uniqueId);
 
134
// CFRelease(urlRef);
 
135
// CFRelease(urlString);
 
136
 
 
137
// --------------------------------------------------------------------------------
 
138
//      AddressBook
 
139
// --------------------------------------------------------------------------------
 
140
 
 
141
    // --- There is only one Address Book
 
142
function ABGetSharedAddressBook: ABAddressBookRef; external name '_ABGetSharedAddressBook';
 
143
 
 
144
    // --- Searching
 
145
function ABCopyArrayOfMatchingRecords( addressBook: ABAddressBookRef; search: ABSearchElementRef ): CFArrayRef; external name '_ABCopyArrayOfMatchingRecords';
 
146
 
 
147
    // --- Saving
 
148
function ABSave( addressBook: ABAddressBookRef ): Boolean; external name '_ABSave';
 
149
function ABHasUnsavedChanges( addressBook: ABAddressBookRef ): Boolean; external name '_ABHasUnsavedChanges';
 
150
 
 
151
    // --- Me
 
152
function ABGetMe( addressBook: ABAddressBookRef ): ABPersonRef; external name '_ABGetMe'; // Not retain???
 
153
procedure ABSetMe( addressBook: ABAddressBookRef; moi: ABPersonRef ); external name '_ABSetMe';
 
154
 
 
155
    // Returns the record class Name for a particular uniqueId
 
156
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
 
157
function ABCopyRecordTypeFromUniqueId( addressBook: ABAddressBookRef; uniqueId: CFStringRef ): CFStringRef; external name '_ABCopyRecordTypeFromUniqueId';
 
158
 
 
159
    // --- Properties
 
160
    // Property names must be unique for a record type
 
161
function ABAddPropertiesAndTypes( addressBook: ABAddressBookRef; recordType: CFStringRef; propertiesAnTypes: CFDictionaryRef ): SInt32; external name '_ABAddPropertiesAndTypes';
 
162
function ABRemoveProperties( addressBook: ABAddressBookRef; recordType: CFStringRef; properties: CFArrayRef ): SInt32; external name '_ABRemoveProperties';
 
163
function ABCopyArrayOfPropertiesForRecordType( addressBook: ABAddressBookRef; recordType: CFStringRef ): CFArrayRef; external name '_ABCopyArrayOfPropertiesForRecordType';
 
164
function ABTypeOfProperty( addressBook: ABAddressBookRef; recordType: CFStringRef; proprty: CFStringRef ): ABPropertyType; external name '_ABTypeOfProperty';
 
165
 
 
166
    // --- Records (Person, Group)
 
167
function ABCopyRecordForUniqueId( addressBook: ABAddressBookRef; uniqueId: CFStringRef ): ABRecordRef; external name '_ABCopyRecordForUniqueId';
 
168
function ABAddRecord( addressBook: ABAddressBookRef; recrd: ABRecordRef ): Boolean; external name '_ABAddRecord';
 
169
function ABRemoveRecord( addressBook: ABAddressBookRef; recrd: ABRecordRef ): Boolean; external name '_ABRemoveRecord';
 
170
 
 
171
    // --- People
 
172
function ABCopyArrayOfAllPeople( addressBook: ABAddressBookRef ): CFArrayRef; external name '_ABCopyArrayOfAllPeople';                  // Array of ABPerson
 
173
 
 
174
    // --- Groups
 
175
function ABCopyArrayOfAllGroups( addressBook: ABAddressBookRef ): CFArrayRef; external name '_ABCopyArrayOfAllGroups';                  // Array of ABGroup
 
176
 
 
177
// --------------------------------------------------------------------------------
 
178
//      ABRecord
 
179
// --------------------------------------------------------------------------------
 
180
 
 
181
function ABRecordCopyRecordType( recrd: ABRecordRef ): CFStringRef; external name '_ABRecordCopyRecordType';
 
182
 
 
183
    // --- Property value
 
184
function ABRecordCopyValue( recrd: ABRecordRef; proprty: CFStringRef ): CFTypeRef; external name '_ABRecordCopyValue';
 
185
    // returns a CFDictionary for multi-value properties
 
186
function ABRecordSetValue( recrd: ABRecordRef; proprty: CFStringRef; value: CFTypeRef ): Boolean; external name '_ABRecordSetValue';
 
187
    // takes a CFDictionary for multi-value properties
 
188
function ABRecordRemoveValue( recrd: ABRecordRef; proprty: CFStringRef ): Boolean; external name '_ABRecordRemoveValue';
 
189
 
 
190
    // ---- Unique ID access convenience
 
191
function ABRecordCopyUniqueId( recrd: ABRecordRef ): CFStringRef; external name '_ABRecordCopyUniqueId';
 
192
 
 
193
// --------------------------------------------------------------------------------
 
194
//      ABPerson
 
195
// --------------------------------------------------------------------------------
 
196
 
 
197
function ABPersonCreate: ABPersonRef; external name '_ABPersonCreate';
 
198
 
 
199
function ABPersonCreateWithVCardRepresentation( vCard: CFDataRef ): ABPersonRef; external name '_ABPersonCreateWithVCardRepresentation';
 
200
function ABPersonCopyVCardRepresentation( person: ABPersonRef ): CFDataRef; external name '_ABPersonCopyVCardRepresentation';
 
201
 
 
202
function ABPersonCopyParentGroups( person: ABPersonRef ): CFArrayRef; external name '_ABPersonCopyParentGroups'; // Groups this person belongs to
 
203
 
 
204
    // --- Search elements
 
205
function ABPersonCreateSearchElement( proprty: CFStringRef; labl: CFStringRef; key: CFStringRef; value: CFTypeRef; comparison: ABSearchComparison ): ABSearchElementRef; external name '_ABPersonCreateSearchElement';
 
206
 
 
207
// --------------------------------------------------------------------------------
 
208
//      ABGroups
 
209
// --------------------------------------------------------------------------------
 
210
 
 
211
function ABGroupCreate: ABGroupRef; external name '_ABGroupCreate';
 
212
 
 
213
    // --- Dealing with Persons
 
214
function ABGroupCopyArrayOfAllMembers( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyArrayOfAllMembers';
 
215
function ABGroupAddMember( group: ABGroupRef; personToAdd: ABPersonRef ): Boolean; external name '_ABGroupAddMember';
 
216
function ABGroupRemoveMember( group: ABGroupRef; personToRemove: ABPersonRef ): Boolean; external name '_ABGroupRemoveMember';
 
217
 
 
218
    // --- Dealing with Groups
 
219
function ABGroupCopyArrayOfAllSubgroups( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyArrayOfAllSubgroups';
 
220
function ABGroupAddGroup( group: ABGroupRef; groupToAdd: ABGroupRef ): Boolean; external name '_ABGroupAddGroup';
 
221
function ABGroupRemoveGroup( group: ABGroupRef; groupToRemove: ABGroupRef ): Boolean; external name '_ABGroupRemoveGroup';
 
222
 
 
223
    // --- Dealong with Parents
 
224
function ABGroupCopyParentGroups( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyParentGroups';
 
225
 
 
226
    // --- Distribution list
 
227
function ABGroupSetDistributionIdentifier( group: ABGroupRef; person: ABPersonRef; proprty: CFStringRef; identifier: CFStringRef ): Boolean; external name '_ABGroupSetDistributionIdentifier';
 
228
function ABGroupCopyDistributionIdentifier( group: ABGroupRef; person: ABPersonRef; proprty: CFStringRef ): CFStringRef; external name '_ABGroupCopyDistributionIdentifier';
 
229
 
 
230
    // --- Search elements
 
231
function ABGroupCreateSearchElement( proprty: CFStringRef; labl: CFStringRef; key: CFStringRef; value: CFTypeRef; comparison: ABSearchComparison ): ABSearchElementRef; external name '_ABGroupCreateSearchElement';
 
232
 
 
233
// --------------------------------------------------------------------------------
 
234
//      ABSearchElement
 
235
// --------------------------------------------------------------------------------
 
236
 
 
237
function ABSearchElementCreateWithConjunction( conjunction: ABSearchConjunction; childrenSearchElement: CFArrayRef ): ABSearchElementRef; external name '_ABSearchElementCreateWithConjunction';
 
238
 
 
239
function ABSearchElementMatchesRecord( searchElement: ABSearchElementRef; recrd: ABRecordRef ): Boolean; external name '_ABSearchElementMatchesRecord';
 
240
 
 
241
// --------------------------------------------------------------------------------
 
242
//      ABMultiValue
 
243
// --------------------------------------------------------------------------------
 
244
 
 
245
function ABMultiValueCreate: ABMultiValueRef; external name '_ABMultiValueCreate';
 
246
function ABMultiValueCount( multiValue: ABMultiValueRef ): UInt32; external name '_ABMultiValueCount';
 
247
function ABMultiValueCopyValueAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFTypeRef; external name '_ABMultiValueCopyValueAtIndex';
 
248
function ABMultiValueCopyLabelAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFStringRef; external name '_ABMultiValueCopyLabelAtIndex';
 
249
function ABMultiValueCopyPrimaryIdentifier( multiValue: ABMultiValueRef ): CFStringRef; external name '_ABMultiValueCopyPrimaryIdentifier';
 
250
function ABMultiValueIndexForIdentifier( multiValue: ABMultiValueRef; identifier: CFStringRef ): SInt32; external name '_ABMultiValueIndexForIdentifier';
 
251
function ABMultiValueCopyIdentifierAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFStringRef; external name '_ABMultiValueCopyIdentifierAtIndex';
 
252
function ABMultiValuePropertyType( multiValue: ABMultiValueRef ): ABPropertyType; external name '_ABMultiValuePropertyType';
 
253
function ABMultiValueCreateCopy( multiValue: ABMultiValueRef ): ABMultiValueRef; external name '_ABMultiValueCreateCopy';
 
254
 
 
255
// --------------------------------------------------------------------------------
 
256
//      ABMutableMultiValue
 
257
// --------------------------------------------------------------------------------
 
258
 
 
259
function ABMultiValueCreateMutable: ABMutableMultiValueRef; external name '_ABMultiValueCreateMutable';
 
260
function ABMultiValueAdd( multiValue: ABMutableMultiValueRef; value: CFTypeRef; labl: CFStringRef; var outIdentifier: CFStringRef ): Boolean; external name '_ABMultiValueAdd';
 
261
function ABMultiValueInsert( multiValue: ABMutableMultiValueRef; value: CFTypeRef; labl: CFStringRef; index: SInt32; var outIdentifier: CFStringRef ): Boolean; external name '_ABMultiValueInsert';
 
262
function ABMultiValueRemove( multiValue: ABMutableMultiValueRef; index: SInt32 ): Boolean; external name '_ABMultiValueRemove';
 
263
function ABMultiValueReplaceValue( multiValue: ABMutableMultiValueRef; value: CFTypeRef; index: SInt32 ): Boolean; external name '_ABMultiValueReplaceValue';
 
264
function ABMultiValueReplaceLabel( multiValue: ABMutableMultiValueRef; labl: CFStringRef; index: SInt32 ): Boolean; external name '_ABMultiValueReplaceLabel';
 
265
function ABMultiValueSetPrimaryIdentifier( multiValue: ABMutableMultiValueRef; identifier: CFStringRef ): Boolean; external name '_ABMultiValueSetPrimaryIdentifier';
 
266
function ABMultiValueCreateMutableCopy( multiValue: ABMultiValueRef ): ABMutableMultiValueRef; external name '_ABMultiValueCreateMutableCopy';
 
267
 
 
268
// --------------------------------------------------------------------------------
 
269
//      Localization of properties or labels
 
270
// --------------------------------------------------------------------------------
 
271
 
 
272
function ABCopyLocalizedPropertyOrLabel( labelOrProperty: CFStringRef ): CFStringRef; external name '_ABCopyLocalizedPropertyOrLabel';
 
273
 
 
274
// --- Address formatting
 
275
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
 
276
function ABCreateFormattedAddressFromDictionary( addressBook: ABAddressBookRef; address: CFDictionaryRef ): CFStringRef; external name '_ABCreateFormattedAddressFromDictionary';
 
277
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
 
278
function ABCopyDefaultCountryCode( addressBook: ABAddressBookRef ): CFStringRef; external name '_ABCopyDefaultCountryCode';
 
279
 
 
280
// --------------------------------------------------------------------------------
 
281
//      Person Image Loading
 
282
// --------------------------------------------------------------------------------
 
283
 
 
284
function ABPersonSetImageData( person: ABPersonRef; imageData: CFDataRef ): Boolean; external name '_ABPersonSetImageData';
 
285
function ABPersonCopyImageData( person: ABPersonRef ): CFDataRef; external name '_ABPersonCopyImageData';
 
286
 
 
287
type ABImageClientCallback = procedure ( imageData: CFDataRef; tag: SInt32; refcon: UnivPtr );
 
288
 
 
289
function ABBeginLoadingImageDataForClient( person: ABPersonRef; callback: ABImageClientCallback; refcon: UnivPtr ): SInt32; external name '_ABBeginLoadingImageDataForClient';
 
290
procedure ABCancelLoadingImageDataForTag( tag: SInt32 ); external name '_ABCancelLoadingImageDataForTag';
 
291
 
 
292
end.