view dwt/internal/cocoa/NSIndexSet.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.NSIndexSet;

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSRange;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSIndexSet : NSObject
{

    public this ()
    {
        super();
    }

    public this (objc.id id)
    {
        super(id);
    }

    public bool containsIndex (NSUInteger value)
    {
        return OS.objc_msgSend(this.id_, OS.sel_containsIndex_1, value) !is null;
    }

    public bool containsIndexes (NSIndexSet indexSet)
    {
        return OS.objc_msgSend(this.id_, OS.sel_containsIndexes_1, indexSet !is null ? indexSet.id_ : null) !is null;
    }

    public bool containsIndexesInRange (NSRange range)
    {
        return OS.objc_msgSend(this.id_, OS.sel_containsIndexesInRange_1, range) !is null;
    }

    public NSUInteger count ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_count);
    }

    public NSUInteger countOfIndexesInRange (NSRange range)
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_countOfIndexesInRange_1, range);
    }

    public NSUInteger firstIndex ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_firstIndex);
    }

    public NSUInteger getIndexes (NSUInteger* indexBuffer, NSUInteger bufferSize, NSRangePointer range)
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_getIndexes_1maxCount_1inIndexRange_1, indexBuffer, bufferSize, range);
    }

    public NSUInteger indexGreaterThanIndex (NSUInteger value)
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexGreaterThanIndex_1, value);
    }

    public NSUInteger indexGreaterThanOrEqualToIndex (NSUInteger value)
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexGreaterThanOrEqualToIndex_1, value);
    }

    public NSUInteger indexLessThanIndex (NSUInteger value)
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexLessThanIndex_1, value);
    }

    public NSUInteger indexLessThanOrEqualToIndex (NSUInteger value)
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexLessThanOrEqualToIndex_1, value);
    }

    public static id indexSet ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSIndexSet, OS.sel_indexSet);
        return result !is null ? new id(result) : null;
    }

    public static id indexSetWithIndex (NSUInteger value)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSIndexSet, OS.sel_indexSetWithIndex_1, value);
        return result !is null ? new id(result) : null;
    }

    public static id indexSetWithIndexesInRange (NSRange range)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSIndexSet, OS.sel_indexSetWithIndexesInRange_1, range);
        return result !is null ? new id(result) : null;
    }

    public id initWithIndex (NSUInteger value)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIndex_1, value);
        return result !is null ? new id(result) : null;
    }

    public id initWithIndexSet (NSIndexSet indexSet)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIndexSet_1, indexSet !is null ? indexSet.id_ : null);
        return result !is null ? new id(result) : null;
    }

    public id initWithIndexesInRange (NSRange range)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIndexesInRange_1, range);
        return result !is null ? new id(result) : null;
    }

    public bool intersectsIndexesInRange (NSRange range)
    {
        return OS.objc_msgSend(this.id_, OS.sel_intersectsIndexesInRange_1, range) !is null;
    }

    public bool isEqualToIndexSet (NSIndexSet indexSet)
    {
        return OS.objc_msgSend(this.id_, OS.sel_isEqualToIndexSet_1, indexSet !is null ? indexSet.id_ : null) !is null;
    }

    public NSUInteger lastIndex ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_lastIndex);
    }

}