Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Default Coercion Handlers
This appendix lists the type conversions performed by the default coercion handlers provided by the Mac OS. These handlers may be implemented by the Apple Event Manager, the Open Scripting framework, or other frameworks.
Support for the following coercions was added in Mac OS X version 10.4:
Between these types:
typeStyledText
,typeUnicodeText
,typeUTF8Text
, andtypeUTF16ExternalRepresentation
and these types:
typeType
,typeEnumerated
, and the numeric typestypeSInt16
,typeSInt32
,typeUInt32
,typeSInt64
,typeIEEE32BitFloatingPoint
,typeIEEE64BitFloatingPoint
, andtypeExtended
.See table Table C-1 for a mapping between the preferred and non-preferred numeric constant names.
From
typeChar
totypeStyledText
.
Coercion Handler Tables
Table C-1 shows some older, non-preferred numeric constant names and their preferred equivalents. To find available coercions for a non-preferred name from Table C-1, look up its equivalent preferred name in Table C-2.
Non-preferred numeric constant name | Preferred numeric constant name |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Table C-2 lists the default coercions handled by the Apple Event Manager.
Coerce from descriptor type | To descriptor type | Comment |
---|---|---|
|
| Any string that is a valid representation of a number can be coerced into an equivalent numeric value. |
|
| Any numeric descriptor type can be coerced into the equivalent text string. |
|
| Any numeric descriptor type can be coerced into any other numeric descriptor type. |
|
| If the destination encoding cannot represent a character in the source text, the result is undefined. |
|
| Any four-character string can be coerced to one of these descriptor types. |
|
| Any of these descriptor types can be coerced to the equivalent text string. |
|
| The result contains text only, without the script code or language code from the original descriptor. |
|
| The result is the Boolean value |
|
| The result is the Boolean value |
|
| The enumerated value |
|
| The Boolean value |
|
| A value of 1 becomes the Boolean value |
|
| A value of |
|
| An alias is coerced into a file system specification. Not recommended—use |
|
| An alias is coerced into a file system reference. |
|
| An Apple event is coerced into a list of application parameters for the |
any descriptor type |
| A descriptor is coerced into a descriptor list containing a single item. |
| type of list item | A descriptor list containing a single descriptor is coerced into a descriptor. |
Copyright © 2005, 2007 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2007-10-31