view dwt/internal/cocoa/NSAppleEventDescriptor.d @ 13:f565d3a95c0a

Ported dwt.internal
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 22 Aug 2008 16:46:34 +0200
parents 8b48be5454ce
children d8635bb48c7c
line wrap: on
line source

/*******************************************************************************
 * Copyright (c) 2007 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
 *     
 * Port to the D programming language:
 *     Jacob Carlborg <jacob.carlborg@gmail.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.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 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 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 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 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 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);
    }
}