TranslationServices.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. {
  2. File: HIServices/TranslationServices.h
  3. Contains: Translation Services Interfaces.
  4. Version: HIServices-416~44
  5. Copyright: © 2003-2008 by Apple Computer, 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: Gale R Paeper, <[email protected]>, 2006 }
  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 TranslationServices;
  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.CFArray, MacOsApi.CFBase, MacOsApi.CFData, MacOsApi.CFDictionary, MacOsApi.CFURL, MacOsApi.Files;
  205. {$ELSE FPC_DOTTEDUNITS}
  206. uses MacTypes, CFArray, CFBase, CFData, CFDictionary, CFURL, Files;
  207. {$ENDIF FPC_DOTTEDUNITS}
  208. {$endc} {not MACOSALLINCLUDE}
  209. {$ifc TARGET_OS_MAC}
  210. {$ALIGN POWER}
  211. {
  212. * TranslationServices
  213. *
  214. * Discussion:
  215. * Translation Services provides tools for conversion of data and
  216. * file contents from one format to another. All information for
  217. * performing a translation is contained within a TranslationRef.
  218. * These include source and destination data types, flags indicating
  219. * what type of translation can be performed and references to the
  220. * system services which execute the translation. TranslationRefs
  221. * are CFTypes which must be released after they are created. Source
  222. * and destination formats as well as translation flags can be
  223. * queried from the TranslationRef. TranslationRefs are generated
  224. * either by requesting a specific translation via TranslationCreate
  225. * or during discovery of all possible translations via
  226. * TranslationCreateWithSourceArray. It is possible to request
  227. * TranslationRefs which perform either data or file conversions or
  228. * both by using TranslationFlags. When requesting a translation be
  229. * executed via TranslationPerformForData, TranslationPerformForFile
  230. * or TranslationPerformForURL it is important for the source and
  231. * destination data formats to match those found in the
  232. * TranslationRef.
  233. *
  234. * It is possible to extend the set of system services which provide
  235. * translations by creating what is called a filter service. Filter
  236. * services are applications similar to those which provide the
  237. * services available in the application menu but with a few
  238. * modifications in the application plist. Filter services provide
  239. * an "NSFilter" entry instead of "NSMessage". Filter Services must
  240. * also provide an array of both "NSSendTypes" and "NSReturnTypes"
  241. * containing Uniform Type Identifiers indicating from which formats
  242. * a filter services translates to what format. Each filter service
  243. * may translate multiple send types into a single return type.
  244. * Finally, a filter service must indicate what type of translations
  245. * it supports via the "NSSupportsDataTranslation" and
  246. * "NSSupportsFileTranslation" entries. In the end, a filter
  247. * service's plist may look like the following,
  248. *
  249. *
  250. *
  251. * <key>NSServices</key>
  252. * <array>
  253. * <dict>
  254. * <key>NSFilter</key>
  255. * <string>ExampleTranslation</string>
  256. * <key>NSReturnTypes</key>
  257. * <array>
  258. * <string>com.example.returntype</string>
  259. * </array>
  260. * <key>NSSendTypes</key>
  261. * <array>
  262. * <string>com.example.sourcetype1</string>
  263. * <string>com.example.sourcetype2</string>
  264. * </array>
  265. * <key>NSSupportsDataTranslation</key>
  266. * <string></string>
  267. * <key>NSSupportsFileTranslation</key>
  268. * <string></string>
  269. * </dict>
  270. <array>
  271. *
  272. *
  273. *
  274. * All filter services must handle the kEventServicePerform Carbon
  275. * Event. The filter service will be automatically launched when
  276. * necessary and it will receive the kEventServicePerform event with
  277. * the message indicated by the NSFilter tag in the plist as well as
  278. * a Pasteboard Manager pasteboard containing flavors indicating
  279. * what type of translation must be performed. If a filter service
  280. * only supports data translations a flavor on the pasteboard will
  281. * correspond to one of the type identifiers listed in your plist's
  282. * send types. Upon translation of the data, the filter service
  283. * must clear the pasteboard, add the return identifier and
  284. * translated data to the pasteboard, and return from the event. For
  285. * a filter service which provides file translations,
  286. * "public.file-url" and "com.apple.file-contents-type" will be
  287. * available on the pasteboard indicating the file location and
  288. * contents format from which to translate. Upon translation, the
  289. * filter service should place a "public.file-url" flavor on the
  290. * pasteboard indicating where the translated file has been placed,
  291. * typically next to the orignal named "<filename> (converted)"
  292. * (ala. Finder's "<filename> copy" behavior for duplicated files).
  293. }
  294. type
  295. TranslationRef = ^OpaqueTranslationRef; { an opaque type }
  296. OpaqueTranslationRef = record end;
  297. { Translation Services error codes}
  298. const
  299. {invalidTranslationPathErr = -3025}
  300. {couldNotParseSourceFileErr = -3026}
  301. {noTranslationPathErr = -3030 // no translation for source and destination provided}
  302. {badTranslationSpecErr = -3031}
  303. {noPrefAppErr = -3032}
  304. badTranslationRefErr = -3031; { TranslationRef does not perform translation requested}
  305. {
  306. * TranslationFlags
  307. *
  308. * Summary:
  309. * The following constants are used by the translation creation
  310. * routines to indicate which types of translations are requested.
  311. * The flags are cumulative (ie. when passing both
  312. * kTranslationDataTranslation and kTranslationFileTranslation the
  313. * client is requesting only those translations which support both
  314. * data AND file translations).
  315. }
  316. type
  317. TranslationFlags = OptionBits;
  318. const
  319. {
  320. * Indicates that the client is interested in translations which
  321. * provide data translations.
  322. }
  323. kTranslationDataTranslation = 1 shl 0;
  324. {
  325. * Indicates that the client is interested in translations which
  326. * provide file translations.
  327. }
  328. kTranslationFileTranslation = 1 shl 1;
  329. {
  330. * TranslationGetTypeID()
  331. *
  332. * Summary:
  333. * Returns the CFType identifier for a translation object.
  334. *
  335. * Mac OS X threading:
  336. * Not thread safe
  337. *
  338. * Result:
  339. * A CFTypeID unique to translation instances.
  340. *
  341. * Availability:
  342. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  343. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  344. * Non-Carbon CFM: not available
  345. }
  346. function TranslationGetTypeID: CFTypeID; external name '_TranslationGetTypeID';
  347. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  348. {
  349. * TranslationCreate()
  350. *
  351. * Summary:
  352. * Creates a translation reference describing a system service
  353. * providing translations of data from the source type to the
  354. * destination type.
  355. *
  356. * Mac OS X threading:
  357. * Not thread safe
  358. *
  359. * Parameters:
  360. *
  361. * inSourceType:
  362. * A Uniform Type Identifier specifying the format of source data
  363. * to be translated.
  364. *
  365. * inDestinationType:
  366. * A Uniform Type Identifier specifying the destination format to
  367. * which the source data should be translated.
  368. *
  369. * inTranslationFlags:
  370. * A set of TranslationFlags indicating what type of translation
  371. * is requested.
  372. *
  373. * outTranslation:
  374. * A TranslationRef reference which receives the requested
  375. * translation if a system service providing the translation
  376. * exists.
  377. *
  378. * Result:
  379. * An operating system result code.
  380. *
  381. * Availability:
  382. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  383. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  384. * Non-Carbon CFM: not available
  385. }
  386. function TranslationCreate( inSourceType: CFStringRef; inDestinationType: CFStringRef; inTranslationFlags: TranslationFlags; var outTranslation: TranslationRef ): OSStatus; external name '_TranslationCreate';
  387. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  388. {
  389. * TranslationCreateWithSourceArray()
  390. *
  391. * Summary:
  392. * Creates a list of destination flavors translation references
  393. * describing various system services providing translations of data
  394. * from the source types to the destination types.
  395. *
  396. * Mac OS X threading:
  397. * Not thread safe
  398. *
  399. * Parameters:
  400. *
  401. * inSourceTypes:
  402. * An array of Uniform Type Identifiers specifying the formats of
  403. * source data to be translated.
  404. *
  405. * inTranslationFlags:
  406. * A set of TranslationFlags indicating what type of translations
  407. * are requested.
  408. *
  409. * outDestinationTypes:
  410. * A CFArrayRef reference which receives an array of Uniform Type
  411. * Identifiers specifying what destination formats are available
  412. * as translations of the provided source formats. Any destination
  413. * formats already represented as a format in the source array are
  414. * excluded from the returned list. The search for destination
  415. * formats is performed in the order of source formats. This array
  416. * must be released by the client.
  417. *
  418. * outTranslations:
  419. * A CFDictionaryRef reference which receives a dictionary of
  420. * TranslationRefs representing all translations provided by
  421. * system services. The dictionary is keyed by destination flavor.
  422. * Any translations with destination formats already represented
  423. * as a format in the source array are excluded from the returned
  424. * dictionary. This dictionary must be released by the client.
  425. *
  426. * Result:
  427. * An operating system result code.
  428. *
  429. * Availability:
  430. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  431. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  432. * Non-Carbon CFM: not available
  433. }
  434. function TranslationCreateWithSourceArray( inSourceTypes: CFArrayRef; inTranslationFlags: TranslationFlags; var outDestinationTypes: CFArrayRef; var outTranslations: CFDictionaryRef ): OSStatus; external name '_TranslationCreateWithSourceArray';
  435. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  436. {
  437. * TranslationPerformForData()
  438. *
  439. * Summary:
  440. * Executes the translation of source data into destination data.
  441. * The formats of the source and destination data are contained
  442. * within the TranslationRef.
  443. *
  444. * Mac OS X threading:
  445. * Not thread safe
  446. *
  447. * Parameters:
  448. *
  449. * inTranslation:
  450. * A TranslationRef containing information on the source and
  451. * destination data formats and how to execute a translation from
  452. * one to the other. The formats of the source and destination
  453. * data must correspond to those indicated by the TranslationRef.
  454. *
  455. * inSourceData:
  456. * A CFDataRef containing data to be translated.
  457. *
  458. * outDestinationData:
  459. * A CFDataRef reference which receives the translated data.
  460. *
  461. * Result:
  462. * An operating system result code.
  463. *
  464. * Availability:
  465. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  466. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  467. * Non-Carbon CFM: not available
  468. }
  469. function TranslationPerformForData( inTranslation: TranslationRef; inSourceData: CFDataRef; var outDestinationData: CFDataRef ): OSStatus; external name '_TranslationPerformForData';
  470. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  471. {
  472. * TranslationPerformForFile()
  473. *
  474. * Summary:
  475. * Executes the translation of source file contents to a destination
  476. * file content format. The formats of the source and destination
  477. * file contents are held within the TranslationRef.
  478. *
  479. * Mac OS X threading:
  480. * Not thread safe
  481. *
  482. * Parameters:
  483. *
  484. * inTranslation:
  485. * A TranslationRef containing information on the source and
  486. * destination file content formats and how to execute a
  487. * translation from one to the other. The formats of the source
  488. * and destination file contents must correspond to those
  489. * indicated by the TranslationRef.
  490. *
  491. * inSourceFile:
  492. * A FSRef reference pointing to a file whose contents are to be
  493. * translated.
  494. *
  495. * inDestinationDirectory:
  496. * An optional FSRef reference pointing to the desired directory
  497. * for the translation. By default the destination directory is
  498. * the same as the source file.
  499. *
  500. * inDestinationName:
  501. * An optional CFStringRef indicating the desired name for the
  502. * translated file. By default the translated file's name will be
  503. * "<filename> (converted)" (ala. Finder's "<filename> copy"
  504. * behavior for duplicated files).
  505. *
  506. * outTranslatedFile:
  507. * A FSRef reference which receives a new file with the translated
  508. * contents. It is possible for the translated file to not have
  509. * been created in the directory or with the name requested by the
  510. * client due to disk space or translator limitations. It is
  511. * important to rely only on the file reference returned in this
  512. * parameter.
  513. *
  514. * Result:
  515. * An operating system result code.
  516. *
  517. * Availability:
  518. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  519. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  520. * Non-Carbon CFM: not available
  521. }
  522. function TranslationPerformForFile( inTranslation: TranslationRef; const (*var*) inSourceFile: FSRef; {const} inDestinationDirectory: FSRefPtr { can be NULL }; inDestinationName: CFStringRef { can be NULL }; var outTranslatedFile: FSRef ): OSStatus; external name '_TranslationPerformForFile';
  523. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  524. {
  525. * TranslationPerformForURL()
  526. *
  527. * Summary:
  528. * Executes the translation of source data pointed to a URL to a
  529. * destination format. The formats of the source and destination URL
  530. * contents are held within the TranslationRef. Currently, only file
  531. * URLs are accepted for URL translations.
  532. *
  533. * Mac OS X threading:
  534. * Not thread safe
  535. *
  536. * Parameters:
  537. *
  538. * inTranslation:
  539. * A TranslationRef containing information on the source and
  540. * destination URL content formats and how to execute a
  541. * translation from one to the other. The formats of the source
  542. * and destination URL contents must correspond to those indicated
  543. * by the TranslationRef.
  544. *
  545. * inSourceURL:
  546. * A CFURLRef pointing to source data whose contents are to be
  547. * translated. Currently, only file URLs are accepted for URL
  548. * translations.
  549. *
  550. * inDestinationURL:
  551. * An optional CFURLRef indicating the desired location for the
  552. * translated data. File URLs may either indicate the desired
  553. * destination directory or directory and name for the translated
  554. * file. By default for file URLs, the translated file's name will
  555. * be "<filename> (converted)" (ala. Finder's "<filename> copy"
  556. * behavior for duplicated files).
  557. *
  558. * outTranslatedURL:
  559. * A FSRef reference which receives a new file with the translated
  560. * contents. For file URLs, it is possible for the translated file
  561. * to not have been created in the directory or with the name
  562. * requested by the client due to disk space or translator
  563. * limitations. It is important to rely only on the URL returned
  564. * in this parameter.
  565. *
  566. * Result:
  567. * An operating system result code.
  568. *
  569. * Availability:
  570. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  571. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  572. * Non-Carbon CFM: not available
  573. }
  574. function TranslationPerformForURL( inTranslation: TranslationRef; inSourceURL: CFURLRef; inDestinationURL: CFURLRef { can be NULL }; var outTranslatedURL: CFURLRef ): OSStatus; external name '_TranslationPerformForURL';
  575. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  576. {
  577. * TranslationCopySourceType()
  578. *
  579. * Summary:
  580. * Accesses a translation's source type.
  581. *
  582. * Mac OS X threading:
  583. * Not thread safe
  584. *
  585. * Parameters:
  586. *
  587. * inTranslation:
  588. * A TranslationRef containing the requested source type.
  589. *
  590. * outSourceType:
  591. * A CFStringRef which receives the TranslationRef's source type.
  592. *
  593. * Result:
  594. * An operating system result code.
  595. *
  596. * Availability:
  597. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  598. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  599. * Non-Carbon CFM: not available
  600. }
  601. function TranslationCopySourceType( inTranslation: TranslationRef; var outSourceType: CFStringRef ): OSStatus; external name '_TranslationCopySourceType';
  602. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  603. {
  604. * TranslationCopyDestinationType()
  605. *
  606. * Summary:
  607. * Accesses a translation's destination type.
  608. *
  609. * Mac OS X threading:
  610. * Not thread safe
  611. *
  612. * Parameters:
  613. *
  614. * inTranslation:
  615. * A TranslationRef containing the requested destination type.
  616. *
  617. * outDestinationType:
  618. * A CFStringRef which receives the TranslationRef's destination
  619. * type.
  620. *
  621. * Result:
  622. * An operating system result code.
  623. *
  624. * Availability:
  625. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  626. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  627. * Non-Carbon CFM: not available
  628. }
  629. function TranslationCopyDestinationType( inTranslation: TranslationRef; var outDestinationType: CFStringRef ): OSStatus; external name '_TranslationCopyDestinationType';
  630. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  631. {
  632. * TranslationGetTranslationFlags()
  633. *
  634. * Summary:
  635. * Accesses a translation's flags.
  636. *
  637. * Mac OS X threading:
  638. * Not thread safe
  639. *
  640. * Parameters:
  641. *
  642. * inTranslation:
  643. * A TranslationRef containing the requested flags.
  644. *
  645. * outTranslationFlags:
  646. * A TranslationFlags which receives the TranslationRef's flags.
  647. *
  648. * Result:
  649. * An operating system result code.
  650. *
  651. * Availability:
  652. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  653. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  654. * Non-Carbon CFM: not available
  655. }
  656. function TranslationGetTranslationFlags( inTranslation: TranslationRef; var outTranslationFlags: TranslationFlags ): OSStatus; external name '_TranslationGetTranslationFlags';
  657. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  658. {$endc} {TARGET_OS_MAC}
  659. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  660. end.
  661. {$endc} {not MACOSALLINCLUDE}