diff dwt/internal/cocoa/NSIndexSet.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/NSIndexSet.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSIndexSet.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,142 +1,60 @@
 /*******************************************************************************
- * 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.NSIndexSet;
 
-import dwt.internal.cocoa.id;
-import dwt.internal.cocoa.NSInteger;
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSObject;
 import dwt.internal.cocoa.NSRange;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-public class NSIndexSet : NSObject
-{
-
-    public this ()
-    {
-        super();
-    }
-
-    public this (objc.id id)
-    {
-        super(id);
-    }
+public class NSIndexSet : NSObject {
 
-    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 this() {
+    super();
+}
 
-    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 this(objc.id id) {
+    super(id);
+}
 
-    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 this(cocoa.id id) {
+    super(id);
+}
 
-    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 count() {
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_count);
+}
 
-    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 NSUInteger firstIndex() {
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_firstIndex);
+}
 
-    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 NSUInteger getIndexes(NSUInteger* indexBuffer, NSUInteger bufferSize, NSRangePointer range) {
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_getIndexes_maxCount_inIndexRange_, indexBuffer, bufferSize, range);
+}
 
-    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 cocoa.id initWithIndex(NSUInteger value) {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndex_, value);
+    return result !is null ? new cocoa.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);
-    }
+public cocoa.id initWithIndexesInRange(NSRange range) {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndexesInRange_, range);
+    return result !is null ? new cocoa.id(result) : null;
+}
 
 }