HIArchive.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. {
  2. File: HIToolbox/HIArchive.h
  3. Contains: HIArchive Interfaces.
  4. Version: HIToolbox-624~3
  5. Copyright: © 2004-2008 by Apple Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://bugs.freepascal.org
  9. }
  10. { Pascal Translation: Peter N Lewis, <[email protected]>, August 2005 }
  11. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  12. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  13. {
  14. Modified for use with Free Pascal
  15. Version 308
  16. Please report any bugs to <[email protected]>
  17. }
  18. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  19. {$mode macpas}
  20. {$modeswitch cblocks}
  21. {$packenum 1}
  22. {$macro on}
  23. {$inline on}
  24. {$calling mwpascal}
  25. {$IFNDEF FPC_DOTTEDUNITS}
  26. unit HIArchive;
  27. {$ENDIF FPC_DOTTEDUNITS}
  28. interface
  29. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  30. {$setc GAP_INTERFACES_VERSION := $0308}
  31. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  32. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  33. {$endc}
  34. {$ifc defined CPUPOWERPC and defined CPUI386}
  35. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  36. {$endc}
  37. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  38. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  39. {$endc}
  40. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  41. {$setc __ppc__ := 1}
  42. {$elsec}
  43. {$setc __ppc__ := 0}
  44. {$endc}
  45. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  46. {$setc __ppc64__ := 1}
  47. {$elsec}
  48. {$setc __ppc64__ := 0}
  49. {$endc}
  50. {$ifc not defined __i386__ and defined CPUI386}
  51. {$setc __i386__ := 1}
  52. {$elsec}
  53. {$setc __i386__ := 0}
  54. {$endc}
  55. {$ifc not defined __x86_64__ and defined CPUX86_64}
  56. {$setc __x86_64__ := 1}
  57. {$elsec}
  58. {$setc __x86_64__ := 0}
  59. {$endc}
  60. {$ifc not defined __arm__ and defined CPUARM}
  61. {$setc __arm__ := 1}
  62. {$elsec}
  63. {$setc __arm__ := 0}
  64. {$endc}
  65. {$ifc not defined __arm64__ and defined CPUAARCH64}
  66. {$setc __arm64__ := 1}
  67. {$elsec}
  68. {$setc __arm64__ := 0}
  69. {$endc}
  70. {$ifc defined cpu64}
  71. {$setc __LP64__ := 1}
  72. {$elsec}
  73. {$setc __LP64__ := 0}
  74. {$endc}
  75. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  76. {$error Conflicting definitions for __ppc__ and __i386__}
  77. {$endc}
  78. {$ifc defined __ppc__ and __ppc__}
  79. {$setc TARGET_CPU_PPC := TRUE}
  80. {$setc TARGET_CPU_PPC64 := FALSE}
  81. {$setc TARGET_CPU_X86 := FALSE}
  82. {$setc TARGET_CPU_X86_64 := FALSE}
  83. {$setc TARGET_CPU_ARM := FALSE}
  84. {$setc TARGET_CPU_ARM64 := FALSE}
  85. {$setc TARGET_OS_MAC := TRUE}
  86. {$setc TARGET_OS_IPHONE := FALSE}
  87. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  88. {$setc TARGET_OS_EMBEDDED := FALSE}
  89. {$elifc defined __ppc64__ and __ppc64__}
  90. {$setc TARGET_CPU_PPC := FALSE}
  91. {$setc TARGET_CPU_PPC64 := TRUE}
  92. {$setc TARGET_CPU_X86 := FALSE}
  93. {$setc TARGET_CPU_X86_64 := FALSE}
  94. {$setc TARGET_CPU_ARM := FALSE}
  95. {$setc TARGET_CPU_ARM64 := FALSE}
  96. {$setc TARGET_OS_MAC := TRUE}
  97. {$setc TARGET_OS_IPHONE := FALSE}
  98. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  99. {$setc TARGET_OS_EMBEDDED := FALSE}
  100. {$elifc defined __i386__ and __i386__}
  101. {$setc TARGET_CPU_PPC := FALSE}
  102. {$setc TARGET_CPU_PPC64 := FALSE}
  103. {$setc TARGET_CPU_X86 := TRUE}
  104. {$setc TARGET_CPU_X86_64 := FALSE}
  105. {$setc TARGET_CPU_ARM := FALSE}
  106. {$setc TARGET_CPU_ARM64 := FALSE}
  107. {$ifc defined iphonesim}
  108. {$setc TARGET_OS_MAC := FALSE}
  109. {$setc TARGET_OS_IPHONE := TRUE}
  110. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  111. {$elsec}
  112. {$setc TARGET_OS_MAC := TRUE}
  113. {$setc TARGET_OS_IPHONE := FALSE}
  114. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  115. {$endc}
  116. {$setc TARGET_OS_EMBEDDED := FALSE}
  117. {$elifc defined __x86_64__ and __x86_64__}
  118. {$setc TARGET_CPU_PPC := FALSE}
  119. {$setc TARGET_CPU_PPC64 := FALSE}
  120. {$setc TARGET_CPU_X86 := FALSE}
  121. {$setc TARGET_CPU_X86_64 := TRUE}
  122. {$setc TARGET_CPU_ARM := FALSE}
  123. {$setc TARGET_CPU_ARM64 := FALSE}
  124. {$ifc defined iphonesim}
  125. {$setc TARGET_OS_MAC := FALSE}
  126. {$setc TARGET_OS_IPHONE := TRUE}
  127. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  128. {$elsec}
  129. {$setc TARGET_OS_MAC := TRUE}
  130. {$setc TARGET_OS_IPHONE := FALSE}
  131. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  132. {$endc}
  133. {$setc TARGET_OS_EMBEDDED := FALSE}
  134. {$elifc defined __arm__ and __arm__}
  135. {$setc TARGET_CPU_PPC := FALSE}
  136. {$setc TARGET_CPU_PPC64 := FALSE}
  137. {$setc TARGET_CPU_X86 := FALSE}
  138. {$setc TARGET_CPU_X86_64 := FALSE}
  139. {$setc TARGET_CPU_ARM := TRUE}
  140. {$setc TARGET_CPU_ARM64 := FALSE}
  141. {$setc TARGET_OS_MAC := FALSE}
  142. {$setc TARGET_OS_IPHONE := TRUE}
  143. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  144. {$setc TARGET_OS_EMBEDDED := TRUE}
  145. {$elifc defined __arm64__ and __arm64__}
  146. {$setc TARGET_CPU_PPC := FALSE}
  147. {$setc TARGET_CPU_PPC64 := FALSE}
  148. {$setc TARGET_CPU_X86 := FALSE}
  149. {$setc TARGET_CPU_X86_64 := FALSE}
  150. {$setc TARGET_CPU_ARM := FALSE}
  151. {$setc TARGET_CPU_ARM64 := TRUE}
  152. {$ifc defined ios}
  153. {$setc TARGET_OS_MAC := FALSE}
  154. {$setc TARGET_OS_IPHONE := TRUE}
  155. {$setc TARGET_OS_EMBEDDED := TRUE}
  156. {$elsec}
  157. {$setc TARGET_OS_MAC := TRUE}
  158. {$setc TARGET_OS_IPHONE := FALSE}
  159. {$setc TARGET_OS_EMBEDDED := FALSE}
  160. {$endc}
  161. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  162. {$elsec}
  163. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  164. {$endc}
  165. {$ifc defined __LP64__ and __LP64__ }
  166. {$setc TARGET_CPU_64 := TRUE}
  167. {$elsec}
  168. {$setc TARGET_CPU_64 := FALSE}
  169. {$endc}
  170. {$ifc defined FPC_BIG_ENDIAN}
  171. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  172. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  173. {$elifc defined FPC_LITTLE_ENDIAN}
  174. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  175. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  176. {$elsec}
  177. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  178. {$endc}
  179. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  180. {$setc CALL_NOT_IN_CARBON := FALSE}
  181. {$setc OLDROUTINENAMES := FALSE}
  182. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  183. {$setc OPAQUE_UPP_TYPES := TRUE}
  184. {$setc OTCARBONAPPLICATION := TRUE}
  185. {$setc OTKERNEL := FALSE}
  186. {$setc PM_USE_SESSION_APIS := TRUE}
  187. {$setc TARGET_API_MAC_CARBON := TRUE}
  188. {$setc TARGET_API_MAC_OS8 := FALSE}
  189. {$setc TARGET_API_MAC_OSX := TRUE}
  190. {$setc TARGET_CARBON := TRUE}
  191. {$setc TARGET_CPU_68K := FALSE}
  192. {$setc TARGET_CPU_MIPS := FALSE}
  193. {$setc TARGET_CPU_SPARC := FALSE}
  194. {$setc TARGET_OS_UNIX := FALSE}
  195. {$setc TARGET_OS_WIN32 := FALSE}
  196. {$setc TARGET_RT_MAC_68881 := FALSE}
  197. {$setc TARGET_RT_MAC_CFM := FALSE}
  198. {$setc TARGET_RT_MAC_MACHO := TRUE}
  199. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  200. {$setc TYPE_BOOL := FALSE}
  201. {$setc TYPE_EXTENDED := FALSE}
  202. {$setc TYPE_LONGLONG := TRUE}
  203. {$IFDEF FPC_DOTTEDUNITS}
  204. uses MacOsApi.MacTypes,MacOsApi.CFBase,MacOsApi.CFData,MacOsApi.CFNumber,MacOsApi.HIObject;
  205. {$ELSE FPC_DOTTEDUNITS}
  206. uses MacTypes,CFBase,CFData,CFNumber,HIObject;
  207. {$ENDIF FPC_DOTTEDUNITS}
  208. {$endc} {not MACOSALLINCLUDE}
  209. {$ifc TARGET_OS_MAC}
  210. {$ALIGN POWER}
  211. {
  212. * HIArchive
  213. *
  214. * Discussion:
  215. * HIArchive provides a standard, extensible mechanism to flatten
  216. * objects for storage in memory or on disk for later retrieval or
  217. * transfer to another application. The archive is encoded using the
  218. * binary property list format. The binary plist can be converted to
  219. * text XML with /usr/bin/plutil for development purposes. Details
  220. * on how to create an object that supports the HIArchive protocol
  221. * are provided in HIToolbox/HIObject.h.
  222. *
  223. * When writing data out to an archive, the client must first use
  224. * HIArchiveCreateForEncoding to generate the archive into which the
  225. * data will be encoded. From there, data may be added to the
  226. * archive by calling HIArchiveEncodeBoolean, HIArchiveEncodeNumber,
  227. * and HIArchiveEncodeCFType. If HIArchiveEncodeCFType is being
  228. * called on one of your custom HIObjects, HIToolbox will send it
  229. * the kEventHIObjectEncode event (see HIObject.h). In order to
  230. * receive this event your HIObject must first have set its
  231. * archiving-ignored value to false via HIObjectSetArchivingIgnored.
  232. * This lets HIToolbox know your object supports archiving. The
  233. * kEventParamHIArchive parameter contains the HIArchiveRef into
  234. * which it should encode all of its relevant state information. All
  235. * information added to the archive is written with a key. This key
  236. * is used later during the unarchiving process to pull the encoded
  237. * data from the archive. System supplied HIObjects namespace their
  238. * keys with an HI prefix. Subclasses of system supplied HIObjects
  239. * should only use this namespace if explicitly overriding a value
  240. * written to the archive by the superclass. Take care to mantain
  241. * the same data format when overriding the default to avoid
  242. * incompatibilities. When your archiving process is complete,
  243. * HIArchiveCopyEncodedData will compress the data into the archive
  244. * and return it in a CFDataRef. This CFDataRef can be sent to
  245. * another application or written out to disk for later retrieval.
  246. * Once the encoded data is compressed, no more data may be added to
  247. * the archive. At this point, the HIArchiveRef must be released via
  248. * CFRelease.
  249. *
  250. * When retrieving data from an archive, the client must first use
  251. * HIArchiveCreateForDecoding to create an archive reference capable
  252. * of decoding the data from the provided CFDataRef. Given the
  253. * HIArchiveRef, data may be pulled from the archive via
  254. * HIArchiveDecodeBoolean, HIArchiveDecodeNumber, and
  255. * HIArchiveCopyDecodedCFType. If HIArchiveCopyDecodedCFType is
  256. * called on one of your custom HIObjects, HIToolbox will send it
  257. * the kEventHIObjectInitialize event (see HIOject.h). The
  258. * kEventParamHIArchive parameter contains the HIArchiveRef from
  259. * which it should decode all of its relevant state information.
  260. * Because these data values were written by key, they can be read
  261. * in any order regardless of how they were written. This also means
  262. * new keyed values can be added without breaking existing decoding
  263. * routines. Once all data has been read from the archive, it may
  264. * simply be released via CFRelease.
  265. *
  266. * For those clients who wish to provide HIArchive editing features
  267. * there are a few tricks necessary to achieve the desired behavior.
  268. * A generic HIArchive editor will likely be used by clients to edit
  269. * objects for which it has no direct knowledge (or which have not
  270. * yet been designed). For instance, it may provide users with the
  271. * ability to edit custom HIViews, including generic functionality
  272. * to set the view's class identifier, title, frame, etc. In this
  273. * case, it is necessary to instantiate the superclass
  274. * ("com.apple.hiview") of the custom view object because the custom
  275. * view class itself hasn't been registered within the editor.
  276. *
  277. *
  278. * After the user has completed editing the object and desires to
  279. * write out the archive, the editor must set the custom archive
  280. * data to the object with HIObjectSetCustomArchiveData as a
  281. * CFDictionary. Standard keys for initialization parameter types,
  282. * names and values, class and superclass identifiers and CDEF
  283. * procID are provided in HIToolbox/HIObject.h. Of particular
  284. * importance are the object's class and superclass identifier.
  285. * HIArchive uses these values to instantiate the proper object when
  286. * loading the archive within the client's application. The
  287. * parameter types, names and values are then automatically passed
  288. * to the client object through its initialization event.
  289. *
  290. * At this point, the object can simply be written into the archive
  291. * with HIArchiveCreateForEncoding and HIArchiveEncodeCFType.
  292. * HIArchive will handle writing the appropriate classID based on
  293. * the custom data that was assigned earlier.
  294. *
  295. * Generic HIArchive editing applications will also need to handle
  296. * loading client archives. In this case, the archive is decoded in
  297. * editing mode by passing the
  298. * kHIArchiveDecodeSuperclassForUnregisteredObjects proxy bit in
  299. * HIArchiveCreateForDecoding. When objects not registered in the
  300. * current application are decoded, HIArchive will notice this and
  301. * look into the custom data for the object's superclass identifier,
  302. * instantiate an object of that type instead and attach the custom
  303. * data to the newly created object. The editor can then look at the
  304. * attached custom data with HIObjectCopyCustomArchiveData and
  305. * provide it in the UI for the user to edit.
  306. }
  307. type
  308. HIArchiveRef = ^OpaqueHIArchiveRef; { an opaque type }
  309. OpaqueHIArchiveRef = record end;
  310. {
  311. * Discussion:
  312. * HIArchive errors
  313. }
  314. const
  315. {
  316. * The archive was created specifically for encoding or decoding but
  317. * passed into a non-corresponding routine.
  318. }
  319. hiArchiveTypeMismatchErr = -6780;
  320. {
  321. * The keyed value requested does not exist in the archive.
  322. }
  323. hiArchiveKeyNotAvailableErr = -6781;
  324. {
  325. * HIArchiveCopyEncodedData has been called and no more data may be
  326. * encoded.
  327. }
  328. hiArchiveEncodingCompleteErr = -6782;
  329. {
  330. * The HIObject does not support the archiving protocol.
  331. }
  332. hiArchiveHIObjectIgnoresArchivingErr = -6783;
  333. {
  334. * Discussion:
  335. * HIArchiveCreateForDecoding options
  336. }
  337. const
  338. {
  339. * kDecodeSuperclassForUnregisteredObjects is passed to
  340. * HIArchiveCreateForDecoding indicating that if an HIObject's class
  341. * has not been registered before it is pulled from the archive,
  342. * HIArchiveCopyDecodedCFType will automatically instantiate the
  343. * unarchived object as its superclass if it exists. For instance, a
  344. * custom HIView of class "com.myco.customview" being unarchived will
  345. * be instantiated as class "com.apple.hiview" if your app has not
  346. * yet registered "com.myco.customview". This is useful for archive
  347. * editors that do not implement all objects contained in a client
  348. * archive. Note that only data written to the archive by the
  349. * superclass will be decoded. All data unique to the unregistered
  350. * subclass will be ignored. This option also signals the HIObject to
  351. * load its custom archive data so it can be accessed via
  352. * HIObjectCopyCustomArchiveData. HIArchive is unable to instantiate
  353. * unregistered objects whose superclasses are also unregistered.
  354. }
  355. kHIArchiveDecodeSuperclassForUnregisteredObjects = 1 shl 0;
  356. {
  357. * Indicates that an archive is being decoded by an archive editor.
  358. * This information is passed to the object being decoded via the
  359. * kEventParamDecodingForEditor parameter in the
  360. * kEventHIObjectInitialize and kEventHIObjectCreatedFromArchive
  361. * event. This option may be used in Mac OS X 10.5 and later.
  362. }
  363. kHIArchiveDecodingForEditor = 1 shl 1;
  364. {$ifc not TARGET_CPU_64}
  365. {
  366. * HIArchiveGetTypeID()
  367. *
  368. * Summary:
  369. * Returns the CFType identifier for an HIArchive object.
  370. *
  371. * Mac OS X threading:
  372. * Not thread safe
  373. *
  374. * Result:
  375. * A CFTypeID unique to HIArchive instances.
  376. *
  377. * Availability:
  378. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  379. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  380. * Non-Carbon CFM: not available
  381. }
  382. function HIArchiveGetTypeID: CFTypeID; external name '_HIArchiveGetTypeID';
  383. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  384. {
  385. * HIArchiveCreateForEncoding()
  386. *
  387. * Summary:
  388. * Creates an HIArchive for use in encoding object information.
  389. *
  390. * Discussion:
  391. * The created HIArchiveRef is a CFType and must be released via
  392. * CFRelease.
  393. *
  394. * Mac OS X threading:
  395. * Not thread safe
  396. *
  397. * Parameters:
  398. *
  399. * outEncoder:
  400. * An HIArchive reference which receives the created HIArchive on
  401. * return.
  402. *
  403. * Result:
  404. * An operating system result code.
  405. *
  406. * Availability:
  407. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  408. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  409. * Non-Carbon CFM: not available
  410. }
  411. function HIArchiveCreateForEncoding( var outEncoder: HIArchiveRef ): OSStatus; external name '_HIArchiveCreateForEncoding';
  412. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  413. {
  414. * HIArchiveEncodeBoolean()
  415. *
  416. * Summary:
  417. * Adds a keyed boolean value to the provided archive.
  418. *
  419. * Mac OS X threading:
  420. * Not thread safe
  421. *
  422. * Parameters:
  423. *
  424. * inEncoder:
  425. * An HIArchiveRef to which the boolean value is added.
  426. *
  427. * inKey:
  428. * The key associated with the boolean value used for later
  429. * decoding.
  430. *
  431. * inBoolean:
  432. * The boolean value to be encoded.
  433. *
  434. * Result:
  435. * An operating system result code.
  436. *
  437. * Availability:
  438. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  439. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  440. * Non-Carbon CFM: not available
  441. }
  442. function HIArchiveEncodeBoolean( inEncoder: HIArchiveRef; inKey: CFStringRef; inBoolean: Boolean ): OSStatus; external name '_HIArchiveEncodeBoolean';
  443. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  444. {
  445. * HIArchiveEncodeNumber()
  446. *
  447. * Summary:
  448. * Adds a keyed number value to the provided archive.
  449. *
  450. * Mac OS X threading:
  451. * Not thread safe
  452. *
  453. * Parameters:
  454. *
  455. * inEncoder:
  456. * An HIArchiveRef to which the number value is added.
  457. *
  458. * inKey:
  459. * The key associated with the number value used for later
  460. * decoding.
  461. *
  462. * inNumberType:
  463. * A CFNumberType describing the type of number value being
  464. * encoded.
  465. *
  466. * inNumberValue:
  467. * The number value to be encoded.
  468. *
  469. * Result:
  470. * An operating system result code.
  471. *
  472. * Availability:
  473. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  474. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  475. * Non-Carbon CFM: not available
  476. }
  477. function HIArchiveEncodeNumber( inEncoder: HIArchiveRef; inKey: CFStringRef; inNumberType: CFNumberType; inNumberValue: {const} UnivPtr ): OSStatus; external name '_HIArchiveEncodeNumber';
  478. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  479. {
  480. * HIArchiveEncodeCFType()
  481. *
  482. * Summary:
  483. * Adds a keyed CFType to the provided archive.
  484. *
  485. * Discussion:
  486. * Encodes basic and property list based CFTypes including HIObjects
  487. * supporting the archiving protocol. If the HIObject supports the
  488. * archiving protocol, it will receive the kEventHIObjectEncode
  489. * event during which it should encode all relevant state
  490. * information. The kEventParamHIArchive parameter contains the
  491. * archive into which data should be added.
  492. *
  493. * Mac OS X threading:
  494. * Not thread safe
  495. *
  496. * Parameters:
  497. *
  498. * inEncoder:
  499. * An HIArchiveRef to which the CFType is added.
  500. *
  501. * inKey:
  502. * The key associated with the CFType used for later decoding.
  503. *
  504. * inCFType:
  505. * The CFType to be encoded.
  506. *
  507. * Result:
  508. * An operating system result code.
  509. *
  510. * Availability:
  511. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  512. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  513. * Non-Carbon CFM: not available
  514. }
  515. function HIArchiveEncodeCFType( inEncoder: HIArchiveRef; inKey: CFStringRef; inCFType: CFTypeRef ): OSStatus; external name '_HIArchiveEncodeCFType';
  516. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  517. {
  518. * HIArchiveCopyEncodedData()
  519. *
  520. * Summary:
  521. * Returns the encoded archive as a CFDataRef.
  522. *
  523. * Discussion:
  524. * Compresses the archived data for storage and returns it as a
  525. * CFDataRef. After the archived data is compressed, no further
  526. * information may be encoded. Do not call this routine until the
  527. * encoding process is complete.
  528. *
  529. * Mac OS X threading:
  530. * Not thread safe
  531. *
  532. * Parameters:
  533. *
  534. * inEncoder:
  535. * An HIArchiveRef into which the archived data was compiled.
  536. *
  537. * outData:
  538. * A CFData reference which receives the compressed archive data
  539. * on return.
  540. *
  541. * Result:
  542. * An operating system result code.
  543. *
  544. * Availability:
  545. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  546. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  547. * Non-Carbon CFM: not available
  548. }
  549. function HIArchiveCopyEncodedData( inEncoder: HIArchiveRef; var outData: CFDataRef ): OSStatus; external name '_HIArchiveCopyEncodedData';
  550. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  551. {
  552. * HIArchiveCreateForDecoding()
  553. *
  554. * Summary:
  555. * Creates an HIArchive for use in decoding the object information
  556. * contained in the provided CFData reference.
  557. *
  558. * Discussion:
  559. * The created HIArchiveRef is a CFType and must be released via
  560. * CFRelease.
  561. *
  562. * Mac OS X threading:
  563. * Not thread safe
  564. *
  565. * Parameters:
  566. *
  567. * inData:
  568. * A CFDataRef containing a previously encoded archive.
  569. *
  570. * inOptions:
  571. * The only option supported by this routine at present is
  572. * kHIArchiveDecodeSuperclassForUnregisteredObjects. You may also
  573. * pass zero for this parameter to get the default behavior.
  574. *
  575. * outDecoder:
  576. * An HIArchive reference which receives the created HIArchive on
  577. * return.
  578. *
  579. * Result:
  580. * An operating system result code.
  581. *
  582. * Availability:
  583. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  584. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  585. * Non-Carbon CFM: not available
  586. }
  587. function HIArchiveCreateForDecoding( inData: CFDataRef; inOptions: OptionBits; var outDecoder: HIArchiveRef ): OSStatus; external name '_HIArchiveCreateForDecoding';
  588. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  589. {
  590. * HIArchiveDecodeBoolean()
  591. *
  592. * Summary:
  593. * Pulls a keyed boolean value from the provided archive.
  594. *
  595. * Mac OS X threading:
  596. * Not thread safe
  597. *
  598. * Parameters:
  599. *
  600. * inDecoder:
  601. * An HIArchiveRef from which the boolean value is pulled.
  602. *
  603. * inKey:
  604. * The key associated with the boolean value used while encoding.
  605. *
  606. * outBoolean:
  607. * The boolean value to be decoded.
  608. *
  609. * Result:
  610. * An operating system result code.
  611. *
  612. * Availability:
  613. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  614. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  615. * Non-Carbon CFM: not available
  616. }
  617. function HIArchiveDecodeBoolean( inDecoder: HIArchiveRef; inKey: CFStringRef; var outBoolean: Boolean ): OSStatus; external name '_HIArchiveDecodeBoolean';
  618. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  619. {
  620. * HIArchiveDecodeNumber()
  621. *
  622. * Summary:
  623. * Pulls a keyed number value from the provided archive.
  624. *
  625. * Mac OS X threading:
  626. * Not thread safe
  627. *
  628. * Parameters:
  629. *
  630. * inDecoder:
  631. * An HIArchiveRef from which the number value is pulled.
  632. *
  633. * inKey:
  634. * The key associated with the number value used while encoding.
  635. *
  636. * inNumberType:
  637. * A CFNumberType describing the type of number value being
  638. * encoded.
  639. *
  640. * outNumberValue:
  641. * The number value to be decoded.
  642. *
  643. * Result:
  644. * An operating system result code.
  645. *
  646. * Availability:
  647. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  648. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  649. * Non-Carbon CFM: not available
  650. }
  651. function HIArchiveDecodeNumber( inDecoder: HIArchiveRef; inKey: CFStringRef; inNumberType: CFNumberType; outNumberValue: UnivPtr ): OSStatus; external name '_HIArchiveDecodeNumber';
  652. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  653. {
  654. * HIArchiveCopyDecodedCFType()
  655. *
  656. * Summary:
  657. * Pulls a keyed CFType from the provided archive.
  658. *
  659. * Discussion:
  660. * Decodes basic and property list based CFTypes and HIObjects. If
  661. * the CFType is an HIObject, it will be constructed and receive the
  662. * kEventHIObjectInitialize event. The kEventParamHIArchive
  663. * parameter contains the archive from which data should be
  664. * retrieved.
  665. *
  666. * Mac OS X threading:
  667. * Not thread safe
  668. *
  669. * Parameters:
  670. *
  671. * inDecoder:
  672. * An HIArchiveRef from which the CFType value is pulled.
  673. *
  674. * inKey:
  675. * The key associated with the CFType used while encoding.
  676. *
  677. * outCFType:
  678. * The CFType to be decoded.
  679. *
  680. * Result:
  681. * An operating system result code.
  682. *
  683. * Availability:
  684. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  685. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  686. * Non-Carbon CFM: not available
  687. }
  688. function HIArchiveCopyDecodedCFType( inDecoder: HIArchiveRef; inKey: CFStringRef; var outCFType: CFTypeRef ): OSStatus; external name '_HIArchiveCopyDecodedCFType';
  689. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  690. {$endc} {not TARGET_CPU_64}
  691. {$endc} {TARGET_OS_MAC}
  692. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  693. end.
  694. {$endc} {not MACOSALLINCLUDE}