NSAppleEventDescriptor

NSAppleEventDescriptor Mac OS X 10.0

This class is primarily used to retrieve information about an Apple Event in a Cocoa application. A handful of methods in the scripting classes of the Foundation framework either take an event descriptor object or return one. For example, in the class NSAppleScript we expect an NSAppleEventDescriptor object to be returned by the script execution methods. This class is only useful for creating event descriptor objects to return to other objects, or to extract information about an Apple Event descriptor. Currently, Cocoa has no mechanism for sending raw Apple Events; for that you must rely on the Carbon Apple Event APIs.

figs/cocn_1303.gif

@interface NSAppleEventDescriptor : NSObject <NSCopying>
 // Initializers
   - (id)initListDescriptor;
   - (id)initRecordDescriptor;
   - (id)initWithAEDescNoCopy:(const AEDesc *)aeDesc;
   - (id)initWithDescriptorType:(DescType)descriptorType  bytes:(const void *)bytes length:(unsigned int)byteCount;
   - (id)initWithDescriptorType:(DescType)descriptorType  data:(NSData *)data;
   - (id)initWithEventClass:(AEEventClass)eventClass eventID:(AEEventID)eventID
        targetDescriptor:(NSAppleEventDescriptor *)targetDescriptor returnID:(AEReturnID)returnID                                
        transactionID:(AETransactionID)transactionID;
 // Accessor Methods
   - (void)setDescriptor:(NSAppleEventDescriptor *)descriptor forKeyword:(AEKeyword)keyword;
   - (void)setAttributeDescriptor:(NSAppleEventDescriptor *)descriptor forKeyword:(AEKeyword)keyword;
   - (void)setParamDescriptor:(NSAppleEventDescriptor *)descriptor forKeyword:(AEKeyword)keyword;
 // Class Methods
   + (NSAppleEventDescriptor *)appleEventWithEventClass:(AEEventClass)eventClass eventID:(AEEventID)eventID
        targetDescriptor:(NSAppleEventDescriptor *)targetDescriptor returnID:(AEReturnID)returnID
        transactionID:(AETransactionID)transactionID; transactionID:(AETransactionID)transactionID;
   + (NSAppleEventDescriptor *)descriptorWithBoolean:(Boolean)boolean;
   + (NSAppleEventDescriptor *)descriptorWithDescriptorType:(DescType)descriptorType
        bytes:(const void *)bytes length:(unsigned int)byteCount;
   + (NSAppleEventDescriptor *)descriptorWithDescriptorType:(DescType)descriptorType data:(NSData *)data;
   + (NSAppleEventDescriptor *)descriptorWithEnumCode:(OSType)enumerator;
   + (NSAppleEventDescriptor *)descriptorWithInt32:(SInt32)signedInt;
   + (NSAppleEventDescriptor *)descriptorWithString:(NSString *)string;
   + (NSAppleEventDescriptor *)descriptorWithTypeCode:(OSType)typeCode;
   + (NSAppleEventDescriptor *)listDescriptor;
   + (NSAppleEventDescriptor *)nullDescriptor;
   + (NSAppleEventDescriptor *)recordDescriptor;
 // Instance Methods
   - (NSAppleEventDescriptor *)coerceToDescriptorType:(DescType)descriptorType;
   - (const AEDesc *)aeDesc;
   - (NSAppleEventDescriptor *)attributeDescriptorForKeyword:(AEKeyword)keyword;
   - (Boolean)booleanValue;
   - (NSData *)data;
   - (NSAppleEventDescriptor *)descriptorAtIndex:(long int)index;
   - (NSAppleEventDescriptor *)descriptorForKeyword:(AEKeyword)keyword;
   - (DescType)descriptorType;
   - (OSType)enumCodeValue;
   - (AEEventClass)eventClass;
   - (AEEventID)eventID;
   - (void)insertDescriptor:(NSAppleEventDescriptor *)descriptor atIndex:(long int)index;
   - (SInt32)int32Value;
   - (AEKeyword)keywordForDescriptorAtIndex:(long int)index;
   - (int)numberOfItems;
   - (NSAppleEventDescriptor *)paramDescriptorForKeyword:(AEKeyword)keyword;
   - (void)removeDecriptorAtIndex:(long int)index;
   - (void)removeDescriptorAtIndex:(long int)index;
   - (void)removeDescriptorWithKeyword:(AEKeyword)keyword;
   - (void)removeParamDescriptorWithKeyword:(AEKeyword)keyword;
   - (AEReturnID)returnID;
   - (NSString *)stringValue;
   - (AETransactionID)transactionID;
   - (OSType)typeCodeValue;
 // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;



    Part II: API Quick Reference
    Chapter 13. Foundation Classes