SCPreferences.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. {
  2. * Copyright (c) 2000, 2001, 2004, 2005, 2007-2010 Apple Inc. All rights reserved.
  3. *
  4. * @APPLE_LICENSE_HEADER_START@
  5. *
  6. * This file contains Original Code and/or Modifications of Original Code
  7. * as defined in and that are subject to the Apple Public Source License
  8. * Version 2.0 (the 'License'). You may not use this file except in
  9. * compliance with the License. Please obtain a copy of the License at
  10. * http://www.opensource.apple.com/apsl/ and read it before using this
  11. * file.
  12. *
  13. * The Original Code and all software distributed under the License are
  14. * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  15. * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  16. * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  18. * Please see the License for the specific language governing rights and
  19. * limitations under the License.
  20. *
  21. * @APPLE_LICENSE_HEADER_END@
  22. }
  23. { Pascal Translation: Peter N Lewis, <[email protected]>, 2004 }
  24. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  25. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  26. {
  27. Modified for use with Free Pascal
  28. Version 308
  29. Please report any bugs to <[email protected]>
  30. }
  31. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  32. {$mode macpas}
  33. {$modeswitch cblocks}
  34. {$packenum 1}
  35. {$macro on}
  36. {$inline on}
  37. {$calling mwpascal}
  38. unit SCPreferences;
  39. interface
  40. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  41. {$setc GAP_INTERFACES_VERSION := $0308}
  42. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  43. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  44. {$endc}
  45. {$ifc defined CPUPOWERPC and defined CPUI386}
  46. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  47. {$endc}
  48. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  49. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  50. {$endc}
  51. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  52. {$setc __ppc__ := 1}
  53. {$elsec}
  54. {$setc __ppc__ := 0}
  55. {$endc}
  56. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  57. {$setc __ppc64__ := 1}
  58. {$elsec}
  59. {$setc __ppc64__ := 0}
  60. {$endc}
  61. {$ifc not defined __i386__ and defined CPUI386}
  62. {$setc __i386__ := 1}
  63. {$elsec}
  64. {$setc __i386__ := 0}
  65. {$endc}
  66. {$ifc not defined __x86_64__ and defined CPUX86_64}
  67. {$setc __x86_64__ := 1}
  68. {$elsec}
  69. {$setc __x86_64__ := 0}
  70. {$endc}
  71. {$ifc not defined __arm__ and defined CPUARM}
  72. {$setc __arm__ := 1}
  73. {$elsec}
  74. {$setc __arm__ := 0}
  75. {$endc}
  76. {$ifc not defined __arm64__ and defined CPUAARCH64}
  77. {$setc __arm64__ := 1}
  78. {$elsec}
  79. {$setc __arm64__ := 0}
  80. {$endc}
  81. {$ifc defined cpu64}
  82. {$setc __LP64__ := 1}
  83. {$elsec}
  84. {$setc __LP64__ := 0}
  85. {$endc}
  86. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  87. {$error Conflicting definitions for __ppc__ and __i386__}
  88. {$endc}
  89. {$ifc defined __ppc__ and __ppc__}
  90. {$setc TARGET_CPU_PPC := TRUE}
  91. {$setc TARGET_CPU_PPC64 := FALSE}
  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 __ppc64__ and __ppc64__}
  101. {$setc TARGET_CPU_PPC := FALSE}
  102. {$setc TARGET_CPU_PPC64 := TRUE}
  103. {$setc TARGET_CPU_X86 := FALSE}
  104. {$setc TARGET_CPU_X86_64 := FALSE}
  105. {$setc TARGET_CPU_ARM := FALSE}
  106. {$setc TARGET_CPU_ARM64 := FALSE}
  107. {$setc TARGET_OS_MAC := TRUE}
  108. {$setc TARGET_OS_IPHONE := FALSE}
  109. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  110. {$setc TARGET_OS_EMBEDDED := FALSE}
  111. {$elifc defined __i386__ and __i386__}
  112. {$setc TARGET_CPU_PPC := FALSE}
  113. {$setc TARGET_CPU_PPC64 := FALSE}
  114. {$setc TARGET_CPU_X86 := TRUE}
  115. {$setc TARGET_CPU_X86_64 := FALSE}
  116. {$setc TARGET_CPU_ARM := FALSE}
  117. {$setc TARGET_CPU_ARM64 := FALSE}
  118. {$ifc defined iphonesim}
  119. {$setc TARGET_OS_MAC := FALSE}
  120. {$setc TARGET_OS_IPHONE := TRUE}
  121. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  122. {$elsec}
  123. {$setc TARGET_OS_MAC := TRUE}
  124. {$setc TARGET_OS_IPHONE := FALSE}
  125. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  126. {$endc}
  127. {$setc TARGET_OS_EMBEDDED := FALSE}
  128. {$elifc defined __x86_64__ and __x86_64__}
  129. {$setc TARGET_CPU_PPC := FALSE}
  130. {$setc TARGET_CPU_PPC64 := FALSE}
  131. {$setc TARGET_CPU_X86 := FALSE}
  132. {$setc TARGET_CPU_X86_64 := TRUE}
  133. {$setc TARGET_CPU_ARM := FALSE}
  134. {$setc TARGET_CPU_ARM64 := FALSE}
  135. {$ifc defined iphonesim}
  136. {$setc TARGET_OS_MAC := FALSE}
  137. {$setc TARGET_OS_IPHONE := TRUE}
  138. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  139. {$elsec}
  140. {$setc TARGET_OS_MAC := TRUE}
  141. {$setc TARGET_OS_IPHONE := FALSE}
  142. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  143. {$endc}
  144. {$setc TARGET_OS_EMBEDDED := FALSE}
  145. {$elifc defined __arm__ and __arm__}
  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 := TRUE}
  151. {$setc TARGET_CPU_ARM64 := FALSE}
  152. {$setc TARGET_OS_MAC := FALSE}
  153. {$setc TARGET_OS_IPHONE := TRUE}
  154. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  155. {$setc TARGET_OS_EMBEDDED := TRUE}
  156. {$elifc defined __arm64__ and __arm64__}
  157. {$setc TARGET_CPU_PPC := FALSE}
  158. {$setc TARGET_CPU_PPC64 := FALSE}
  159. {$setc TARGET_CPU_X86 := FALSE}
  160. {$setc TARGET_CPU_X86_64 := FALSE}
  161. {$setc TARGET_CPU_ARM := FALSE}
  162. {$setc TARGET_CPU_ARM64 := TRUE}
  163. {$ifc defined ios}
  164. {$setc TARGET_OS_MAC := FALSE}
  165. {$setc TARGET_OS_IPHONE := TRUE}
  166. {$setc TARGET_OS_EMBEDDED := TRUE}
  167. {$elsec}
  168. {$setc TARGET_OS_MAC := TRUE}
  169. {$setc TARGET_OS_IPHONE := FALSE}
  170. {$setc TARGET_OS_EMBEDDED := FALSE}
  171. {$endc}
  172. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  173. {$elsec}
  174. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  175. {$endc}
  176. {$ifc defined __LP64__ and __LP64__ }
  177. {$setc TARGET_CPU_64 := TRUE}
  178. {$elsec}
  179. {$setc TARGET_CPU_64 := FALSE}
  180. {$endc}
  181. {$ifc defined FPC_BIG_ENDIAN}
  182. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  183. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  184. {$elifc defined FPC_LITTLE_ENDIAN}
  185. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  186. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  187. {$elsec}
  188. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  189. {$endc}
  190. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  191. {$setc CALL_NOT_IN_CARBON := FALSE}
  192. {$setc OLDROUTINENAMES := FALSE}
  193. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  194. {$setc OPAQUE_UPP_TYPES := TRUE}
  195. {$setc OTCARBONAPPLICATION := TRUE}
  196. {$setc OTKERNEL := FALSE}
  197. {$setc PM_USE_SESSION_APIS := TRUE}
  198. {$setc TARGET_API_MAC_CARBON := TRUE}
  199. {$setc TARGET_API_MAC_OS8 := FALSE}
  200. {$setc TARGET_API_MAC_OSX := TRUE}
  201. {$setc TARGET_CARBON := TRUE}
  202. {$setc TARGET_CPU_68K := FALSE}
  203. {$setc TARGET_CPU_MIPS := FALSE}
  204. {$setc TARGET_CPU_SPARC := FALSE}
  205. {$setc TARGET_OS_UNIX := FALSE}
  206. {$setc TARGET_OS_WIN32 := FALSE}
  207. {$setc TARGET_RT_MAC_68881 := FALSE}
  208. {$setc TARGET_RT_MAC_CFM := FALSE}
  209. {$setc TARGET_RT_MAC_MACHO := TRUE}
  210. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  211. {$setc TYPE_BOOL := FALSE}
  212. {$setc TYPE_EXTENDED := FALSE}
  213. {$setc TYPE_LONGLONG := TRUE}
  214. uses MacTypes,MacOSXPosix,CFBase,SCDynamicStore,CFDate,CFPropertyList,CFArray,CFData,CFRunLoop,Authorization;
  215. {$endc} {not MACOSALLINCLUDE}
  216. {$ALIGN POWER}
  217. {$ifc not TARGET_OS_IPHONE}
  218. {$elsec} {not TARGET_OS_IPHONE}
  219. type
  220. AuthorizationOpaqueRef = record end;
  221. AuthorizationRef = ^AuthorizationOpaqueRef;
  222. {$endc} {not TARGET_OS_IPHONE}
  223. {!
  224. @header SCPreferences
  225. @discussion The SCPreferences API allows an application to load and
  226. store XML configuration data in a controlled manner and provide
  227. the necessary notifications to other applications that need to
  228. be aware of configuration changes.
  229. To access configuration preferences, you must first establish a
  230. preferences session using the SCPreferencesCreate function.
  231. To identify a specific set of preferences to access, you pass a
  232. value in the prefsID parameter.
  233. A NULL value indicates that the default system preferences are
  234. to be accessed.
  235. A string that starts with a leading "/" character specifies
  236. the absolute path to the file containing the preferences to
  237. be accessed.
  238. A string that does not start with a leading "/" character
  239. specifies a file relative to the default system preferences
  240. directory.
  241. When you are finished with the preferences session, use
  242. CFRelease to close it.
  243. }
  244. {!
  245. @typedef SCPreferencesRef
  246. @discussion This is the handle to an open preferences session for
  247. accessing system configuration preferences.
  248. }
  249. type
  250. SCPreferencesRef = ^__SCPreferences; { an opaque type }
  251. __SCPreferences = record end;
  252. {!
  253. @enum SCPreferencesNotification
  254. @discussion Used with the SCPreferencesCallBack callback
  255. to describe the type of notification.
  256. @constant kSCPreferencesNotificationCommit Indicates when new
  257. preferences have been saved.
  258. @constant kSCPreferencesNotificationApply Key Indicates when a
  259. request has been made to apply the currently saved
  260. preferences to the active system configuration.
  261. }
  262. const
  263. kSCPreferencesNotificationCommit = 1 shl 0; // __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA)
  264. kSCPreferencesNotificationApply = 1 shl 1; // __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA)
  265. type
  266. SCPreferencesNotification = UInt32;
  267. {!
  268. @typedef SCPreferencesContext
  269. Structure containing user-specified data and callbacks for SCPreferences.
  270. @field version The version number of the structure type being passed
  271. in as a parameter to the SCPreferencesSetCallback function.
  272. This structure is version 0.
  273. @field info A C pointer to a user-specified block of data.
  274. @field retain The callback used to add a retain for the info field.
  275. If this parameter is not a pointer to a function of the correct
  276. prototype, the behavior is undefined.
  277. The value may be NULL.
  278. @field release The calllback used to remove a retain previously added
  279. for the info field.
  280. If this parameter is not a pointer to a function of the
  281. correct prototype, the behavior is undefined.
  282. The value may be NULL.
  283. @field copyDescription The callback used to provide a description of
  284. the info field.
  285. }
  286. type
  287. SCPreferencesContext = record
  288. version: CFIndex;
  289. info: UnivPtr;
  290. retain: function( info: UnivPtr ): UnivPtr;
  291. release: procedure( info: UnivPtr );
  292. copyDescription: function( info: UnivPtr ): CFStringRef;
  293. end;
  294. {!
  295. @typedef SCPreferencesCallBack
  296. @discussion Type of the callback function used when the
  297. preferences have been updated and/or applied.
  298. @param prefs The preferences session.
  299. @param notificationType The type of notification, such as changes
  300. committed, changes applied, etc.
  301. @param info A C pointer to a user-specified block of data.
  302. }
  303. type
  304. SCPreferencesCallBack = procedure( prefs: SCPreferencesRef; notificationType: SCPreferencesNotification; info: UnivPtr );
  305. { until __IPHONE_NA is automatically translated }
  306. {$ifc TARGET_OS_MAC}
  307. {!
  308. @function SCPreferencesGetTypeID
  309. @discussion Returns the type identifier of all SCPreferences instances.
  310. }
  311. function SCPreferencesGetTypeID: CFTypeID; external name '_SCPreferencesGetTypeID';
  312. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  313. {!
  314. @function SCPreferencesCreate
  315. @discussion Initiates access to the per-system set of configuration
  316. preferences.
  317. @param allocator The CFAllocator that should be used to allocate
  318. memory for this preferences session.
  319. This parameter may be NULL in which case the current
  320. default CFAllocator is used.
  321. If this reference is not a valid CFAllocator, the behavior
  322. is undefined.
  323. @param name A string that describes the name of the calling
  324. process.
  325. @param prefsID A string that identifies the name of the
  326. group of preferences to be accessed or updated.
  327. @result Returns a reference to the new SCPreferences.
  328. You must release the returned value.
  329. }
  330. function SCPreferencesCreate( allocator: CFAllocatorRef; name: CFStringRef; prefsID: CFStringRef ): SCPreferencesRef; external name '_SCPreferencesCreate';
  331. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  332. {!
  333. @function SCPreferencesCreateWithAuthorization
  334. @discussion Initiates access to the per-system set of configuration
  335. preferences.
  336. @param allocator The CFAllocator that should be used to allocate
  337. memory for this preferences session.
  338. This parameter may be NULL in which case the current
  339. default CFAllocator is used.
  340. If this reference is not a valid CFAllocator, the behavior
  341. is undefined.
  342. @param name A string that describes the name of the calling
  343. process.
  344. @param prefsID A string that identifies the name of the
  345. group of preferences to be accessed or updated.
  346. @param authorization An authorization reference that is used to
  347. authorize any access to the enhanced privileges needed
  348. to manage the preferences session.
  349. @result Returns a reference to the new SCPreferences.
  350. You must release the returned value.
  351. }
  352. function SCPreferencesCreateWithAuthorization( allocator: CFAllocatorRef; name: CFStringRef; prefsID: CFStringRef; authorization: AuthorizationRef ): SCPreferencesRef; external name '_SCPreferencesCreateWithAuthorization';
  353. (* __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA) *)
  354. {!
  355. @function SCPreferencesLock
  356. @discussion Locks access to the configuration preferences.
  357. This function obtains exclusive access to the configuration
  358. preferences. Clients attempting to obtain exclusive access
  359. to the preferences will either receive a kSCStatusPrefsBusy
  360. error or block waiting for the lock to be released.
  361. @param prefs The preferences session.
  362. @param wait A boolean flag indicating whether the calling process
  363. should block waiting for another process to complete its update
  364. operation and release its lock.
  365. @result Returns TRUE if the lock was obtained;
  366. FALSE if an error occurred.
  367. }
  368. function SCPreferencesLock( prefs: SCPreferencesRef; wait: Boolean ): Boolean; external name '_SCPreferencesLock';
  369. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  370. {!
  371. @function SCPreferencesCommitChanges
  372. @discussion Commits changes made to the configuration preferences to
  373. persistent storage.
  374. This function commits any changes to permanent storage.
  375. Implicit calls to the SCPreferencesLock and SCPreferencesUnlock
  376. functions will be made if exclusive access has not already been
  377. established.
  378. Note: This routine commits changes to persistent storage.
  379. Call the SCPreferencesApplyChanges function to apply the
  380. changes to the running system.
  381. @param prefs The preferences session.
  382. @result Returns TRUE if the lock was obtained;
  383. FALSE if an error occurred.
  384. }
  385. function SCPreferencesCommitChanges( prefs: SCPreferencesRef ): Boolean; external name '_SCPreferencesCommitChanges';
  386. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  387. {!
  388. @function SCPreferencesApplyChanges
  389. @discussion Requests that the currently stored configuration
  390. preferences be applied to the active configuration.
  391. @param prefs The preferences session.
  392. @result Returns TRUE if the lock was obtained;
  393. FALSE if an error occurred.
  394. }
  395. function SCPreferencesApplyChanges( prefs: SCPreferencesRef ): Boolean; external name '_SCPreferencesApplyChanges';
  396. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  397. {!
  398. @function SCPreferencesUnlock
  399. @discussion Releases exclusive access to the configuration preferences.
  400. This function releases the exclusive access lock to the
  401. preferences. Other clients will be now be able to establish
  402. exclusive access to the preferences.
  403. @param prefs The preferences session.
  404. @result Returns TRUE if the lock was obtained;
  405. FALSE if an error occurred.
  406. }
  407. function SCPreferencesUnlock( prefs: SCPreferencesRef ): Boolean; external name '_SCPreferencesUnlock';
  408. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  409. {!
  410. @function SCPreferencesGetSignature
  411. @discussion Returns a sequence of bytes that can be used to determine
  412. if the saved configuration preferences have changed.
  413. @param prefs The preferences session.
  414. @result Returns a CFDataRef that reflects the signature of the configuration
  415. preferences at the time of the call to the SCPreferencesCreate function.
  416. }
  417. function SCPreferencesGetSignature( prefs: SCPreferencesRef ): CFDataRef; external name '_SCPreferencesGetSignature';
  418. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  419. {!
  420. @function SCPreferencesCopyKeyList
  421. @discussion Returns an array of currently defined preference keys.
  422. @param prefs The preferences session.
  423. @result Returns the list of keys.
  424. You must release the returned value.
  425. }
  426. function SCPreferencesCopyKeyList( prefs: SCPreferencesRef ): CFArrayRef; external name '_SCPreferencesCopyKeyList';
  427. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  428. {!
  429. @function SCPreferencesGetValue
  430. @discussion Returns the data associated with a preference key.
  431. This function retrieves data associated with the specified
  432. key.
  433. Note: To avoid inadvertantly reading stale data, first call
  434. the SCPreferencesLock function.
  435. @param prefs The preferences session.
  436. @param key The preference key to be returned.
  437. @result Returns the value associated with the specified preference key;
  438. NULL if no value was located.
  439. }
  440. function SCPreferencesGetValue( prefs: SCPreferencesRef; key: CFStringRef ): CFPropertyListRef; external name '_SCPreferencesGetValue';
  441. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  442. {!
  443. @function SCPreferencesAddValue
  444. @discussion Adds data for a preference key.
  445. This function associates new data with the specified key.
  446. To commit these changes to permanent storage, a call must
  447. be made to the SCPreferencesCommitChanges function.
  448. @param prefs The preferences session.
  449. @param key The preference key to be updated.
  450. @param value The CFPropertyListRef object containing the
  451. value to be associated with the specified preference key.
  452. @result Returns TRUE if the value was added;
  453. FALSE if the key already exists or
  454. if an error occurred.
  455. }
  456. function SCPreferencesAddValue( prefs: SCPreferencesRef; key: CFStringRef; value: CFPropertyListRef ): Boolean; external name '_SCPreferencesAddValue';
  457. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  458. {!
  459. @function SCPreferencesSetValue
  460. @discussion Updates the data associated with a preference key.
  461. This function adds or replaces the value associated with the
  462. specified key. To commit these changes to permanent storage
  463. a call must be made to the SCPreferencesCommitChanges function.
  464. @param prefs The preferences session.
  465. @param key The preference key to be updated.
  466. @param value The CFPropertyListRef object containing the
  467. data to be associated with the specified preference key.
  468. @result Returns TRUE if the value was set;
  469. FALSE if an error occurred.
  470. }
  471. function SCPreferencesSetValue( prefs: SCPreferencesRef; key: CFStringRef; value: CFPropertyListRef ): Boolean; external name '_SCPreferencesSetValue';
  472. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  473. {!
  474. @function SCPreferencesRemoveValue
  475. @discussion Removes the data associated with a preference key.
  476. This function removes the data associated with the specified
  477. key. To commit these changes to permanent storage a call must
  478. be made to the SCPreferencesCommitChanges function.
  479. @param prefs The preferences session.
  480. @param key The preference key to be removed.
  481. @result Returns TRUE if the value was removed;
  482. FALSE if the key did not exist or if an error occurred.
  483. }
  484. function SCPreferencesRemoveValue( prefs: SCPreferencesRef; key: CFStringRef ): Boolean; external name '_SCPreferencesRemoveValue';
  485. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  486. {!
  487. @function SCPreferencesSetCallback
  488. @discussion Assigns a callback to a preferences session. The function
  489. is called when the changes to the preferences have been
  490. committed or applied.
  491. @param prefs The preferences session.
  492. @param callout The function to be called when the preferences have
  493. been changed or applied.
  494. If NULL, the current callback is removed.
  495. @param context The SCPreferencesContext associated with
  496. the callout.
  497. @result Returns TRUE if the notification client was successfully set.
  498. }
  499. function SCPreferencesSetCallback( prefs: SCPreferencesRef; callout: SCPreferencesCallBack; var context: SCPreferencesContext ): Boolean; external name '_SCPreferencesSetCallback';
  500. (* __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA) *)
  501. {!
  502. @function SCPreferencesScheduleWithRunLoop
  503. @discussion Schedule commit and apply notifications for the specified
  504. preferences session using the specified run loop and mode.
  505. @param prefs The preferences session.
  506. @param runLoop A reference to a run loop on which the notification
  507. should be scheduled.
  508. Must be non-NULL.
  509. @param runLoopMode The mode on which to schedule the notification.
  510. Must be non-NULL.
  511. @result Returns TRUE if the notifications are successfully scheduled;
  512. FALSE otherwise.
  513. }
  514. function SCPreferencesScheduleWithRunLoop( prefs: SCPreferencesRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCPreferencesScheduleWithRunLoop';
  515. (* __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA) *)
  516. {!
  517. @function SCPreferencesUnscheduleFromRunLoop
  518. @discussion Unschedule commit and apply notifications for the specified
  519. preferences session from the specified run loop and mode.
  520. @param prefs The preferences session.
  521. @param runLoop A reference to a run loop from which the notification
  522. should be unscheduled.
  523. Must be non-NULL.
  524. @param runLoopMode The mode on which to unschedule the notification.
  525. Must be non-NULL.
  526. @result Returns TRUE if the notifications are successfully unscheduled;
  527. FALSE otherwise.
  528. }
  529. function SCPreferencesUnscheduleFromRunLoop( prefs: SCPreferencesRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCPreferencesUnscheduleFromRunLoop';
  530. (* __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA) *)
  531. {!
  532. @function SCPreferencesSetDispatchQueue
  533. @discussion Schedule commit and apply notifications for the specified
  534. preferences session.
  535. @param prefs The preferences session.
  536. @param queue The dispatch queue to run the callback function on.
  537. @result Returns TRUE if the notifications are successfully scheduled;
  538. FALSE otherwise.
  539. }
  540. function SCPreferencesSetDispatchQueue( prefs: SCPreferencesRef; queue: dispatch_queue_t ): Boolean; external name '_SCPreferencesSetDispatchQueue';
  541. (* __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA) *)
  542. {!
  543. @function SCPreferencesSynchronize
  544. @discussion Synchronizes accessed preferences with committed changes.
  545. Any references to preference values returned by calls to the
  546. SCPreferencesGetValue function are no longer valid unless they
  547. were explicitly retained or copied. Any preference values
  548. that were updated (add, set, remove) but not committed will
  549. be discarded.
  550. @param prefs The preferences session.
  551. }
  552. procedure SCPreferencesSynchronize( prefs: SCPreferencesRef ); external name '_SCPreferencesSynchronize';
  553. (* __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA) *)
  554. {$endc} {TARGET_OS_MAC}
  555. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  556. end.
  557. {$endc} {not MACOSALLINCLUDE}