diff dwt/internal/cocoa/NSAppleEventDescriptor.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSAppleEventDescriptor.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSAppleEventDescriptor.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,284 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *     IBM Corporation - initial API and implementation
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *     Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSAppleEventDescriptor;
 
-import dwt.internal.c.carboncore.MacTypes : FourCharCode;
-import dwt.internal.cocoa.id;
-import dwt.internal.cocoa.NSData;
-import dwt.internal.cocoa.NSInteger;
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSObject;
-import dwt.internal.cocoa.NSString;
 import dwt.internal.cocoa.OS;
 import objc = dwt.internal.objc.runtime;
 
-alias FourCharCode AEKeyword;
-
-public class NSAppleEventDescriptor : NSObject
-{
-    public this ()
-    {
-        super();
-    }
-
-    public this (objc.id id)
-    {
-        super(id);
-    }
-
-    public objc.id aeDesc ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_aeDesc);
-    }
-
-    public static NSAppleEventDescriptor appleEventWithEventClass (objc.id eventClass, objc.id eventID, NSAppleEventDescriptor targetDescriptor,
-            short returnID, objc.id transactionID)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor,
-                OS.sel_appleEventWithEventClass_1eventID_1targetDescriptor_1returnID_1transactionID_1, eventClass, eventID,
-                targetDescriptor !is null ? targetDescriptor.id_ : null, returnID, transactionID);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public NSAppleEventDescriptor attributeDescriptorForKeyword (objc.id keyword)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributeDescriptorForKeyword_1, keyword);
-        return result is this.id_ ? this : (result !is null ? new NSAppleEventDescriptor(result) : null);
-    }
-
-    public bool boolValue ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_boolValue) !is null;
-    }
-
-    public NSAppleEventDescriptor coerceToDescriptorType (objc.id descriptorType)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_coerceToDescriptorType_1, descriptorType);
-        return result is this.id_ ? this : (result !is null ? new NSAppleEventDescriptor(result) : null);
-    }
-
-    public NSData data ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_data);
-        return result !is null ? new NSData(result) : null;
-    }
-
-    public NSAppleEventDescriptor descriptorAtIndex (NSInteger index)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_descriptorAtIndex_1, index);
-        return result is this.id_ ? this : (result !is null ? new NSAppleEventDescriptor(result) : null);
-    }
-
-    public NSAppleEventDescriptor descriptorForKeyword (objc.id keyword)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_descriptorForKeyword_1, keyword);
-        return result is this.id_ ? this : (result !is null ? new NSAppleEventDescriptor(result) : null);
-    }
+public class NSAppleEventDescriptor : NSObject {
 
-    public objc.id descriptorType ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_descriptorType);
-    }
-
-    public static NSAppleEventDescriptor descriptorWithBoolean (bool b)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithBoolean_1, b);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public static NSAppleEventDescriptor static_descriptorWithDescriptorType_bytes_length_ (objc.id descriptorType, /*const*/void* bytes, NSUInteger byteCount)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithDescriptorType_1bytes_1length_1, descriptorType, bytes,
-                byteCount);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public static NSAppleEventDescriptor static_descriptorWithDescriptorType_data_ (objc.id descriptorType, NSData data)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithDescriptorType_1data_1, descriptorType,
-                data !is null ? data.id_ : null);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public static NSAppleEventDescriptor descriptorWithEnumCode (objc.id enumerator)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithEnumCode_1, enumerator);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
+public this() {
+    super();
+}
 
-    public static NSAppleEventDescriptor descriptorWithInt32 (int signedInt)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithInt32_1, signedInt);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public static NSAppleEventDescriptor descriptorWithString (NSString str)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithString_1, str !is null ? str.id_ : null);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public static NSAppleEventDescriptor descriptorWithTypeCode (objc.id typeCode)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithTypeCode_1, typeCode);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public objc.id enumCodeValue ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_enumCodeValue);
-    }
-
-    public objc.id eventClass ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_eventClass);
-    }
-
-    public objc.id eventID ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_eventID);
-    }
+public this(objc.id id) {
+    super(id);
+}
 
-    public NSAppleEventDescriptor initListDescriptor ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initListDescriptor);
-        return result !is null ? this : null;
-    }
-
-    public NSAppleEventDescriptor initRecordDescriptor ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initRecordDescriptor);
-        return result !is null ? this : null;
-    }
-
-    public NSAppleEventDescriptor initWithAEDescNoCopy (objc.id aeDesc)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithAEDescNoCopy_1, aeDesc);
-        return result !is null ? this : null;
-    }
-
-    public NSAppleEventDescriptor initWithDescriptorType_bytes_length_ (objc.id descriptorType, /*const*/void* bytes, NSUInteger byteCount)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithDescriptorType_1bytes_1length_1, descriptorType, bytes, byteCount);
-        return result !is null ? this : null;
-    }
-
-    public NSAppleEventDescriptor initWithDescriptorType_data_ (objc.id descriptorType, NSData data)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithDescriptorType_1data_1, descriptorType, data !is null ? data.id_ : null);
-        return result !is null ? this : null;
-    }
-
-    public NSAppleEventDescriptor initWithEventClass (objc.id eventClass, objc.id eventID, NSAppleEventDescriptor targetDescriptor, objc.id returnID,
-            objc.id transactionID)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithEventClass_1eventID_1targetDescriptor_1returnID_1transactionID_1, eventClass,
-                eventID, targetDescriptor !is null ? targetDescriptor.id_ : null, returnID, transactionID);
-        return result !is null ? this : null;
-    }
-
-    public void insertDescriptor (NSAppleEventDescriptor descriptor, NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_insertDescriptor_1atIndex_1, descriptor !is null ? descriptor.id_ : null, index);
-    }
-
-    public int int32Value ()
-    {
-        return cast(int) OS.objc_msgSend(this.id_, OS.sel_int32Value);
-    }
-
-    public AEKeyword keywordForDescriptorAtIndex (NSInteger index)
-    {
-        return cast(AEKeyword) OS.objc_msgSend(this.id_, OS.sel_keywordForDescriptorAtIndex_1, index);
-    }
-
-    public static NSAppleEventDescriptor listDescriptor ()
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_listDescriptor);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public static NSAppleEventDescriptor nullDescriptor ()
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_nullDescriptor);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
+public this(cocoa.id id) {
+    super(id);
+}
 
-    public NSInteger numberOfItems ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfItems);
-    }
-
-    public NSAppleEventDescriptor paramDescriptorForKeyword (objc.id keyword)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_paramDescriptorForKeyword_1, keyword);
-        return result is this.id_ ? this : (result !is null ? new NSAppleEventDescriptor(result) : null);
-    }
-
-    public static NSAppleEventDescriptor recordDescriptor ()
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_recordDescriptor);
-        return result !is null ? new NSAppleEventDescriptor(result) : null;
-    }
-
-    public void removeDescriptorAtIndex (NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_removeDescriptorAtIndex_1, index);
-    }
-
-    public void removeDescriptorWithKeyword (objc.id keyword)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_removeDescriptorWithKeyword_1, keyword);
-    }
-
-    public void removeParamDescriptorWithKeyword (objc.id keyword)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_removeParamDescriptorWithKeyword_1, keyword);
-    }
+public NSAppleEventDescriptor initListDescriptor() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_initListDescriptor);
+    return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null);
+}
 
-    public short returnID ()
-    {
-        return cast(short) OS.objc_msgSend(this.id_, OS.sel_returnID);
-    }
-
-    public void setAttributeDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setAttributeDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id_ : null, keyword);
-    }
-
-    public void setDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id_ : null, keyword);
-    }
-
-    public void setParamDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setParamDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id_ : null, keyword);
-    }
-
-    public NSString StringValue ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringValue);
-        return result !is null ? new NSString(result) : null;
-    }
-
-    public objc.id transactionID ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_transactionID);
-    }
-
-    public objc.id typeCodeValue ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_typeCodeValue);
-    }
 }