diff dwt/internal/cocoa/NSSet.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSSet.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * 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.NSSet;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSEnumerator;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSKeyValueObserving;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSPredicate;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSSet : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public void addObserver (NSObject observer, NSString keyPath, NSKeyValueObservingOptions options, void* context)
+    {
+        OS.objc_msgSend(this.id, OS.sel_addObserver_1forKeyPath_1options_1context_1, observer !is null ? observer.id : null,
+                keyPath !is null ? keyPath.id : null, options, context);
+    }
+
+    public NSArray allObjects ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_allObjects);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public id anyObject ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_anyObject);
+        return result !is null ? new id(result) : null;
+    }
+
+    public bool containsObject (id anObject)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_containsObject_1, anObject !is null ? anObject.id : null) !is null;
+    }
+
+    public NSUInteger count ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_count);
+    }
+
+    public NSString description ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_description);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString descriptionWithLocale (id locale)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithLocale_1, locale !is null ? locale.id : null);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSSet filteredSetUsingPredicate (NSPredicate predicate)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_filteredSetUsingPredicate_1, predicate !is null ? predicate.id : null);
+        return result is this.id ? this : (result !is null ? new NSSet(result) : null);
+    }
+
+    public NSSet initWithArray (NSArray array)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithArray_1, array !is null ? array.id : null);
+        return result !is null ? this : null;
+    }
+
+    public NSSet initWithObjects_ (id initWithObjects)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithObjects_1, initWithObjects !is null ? initWithObjects.id : null);
+        return result !is null ? this : null;
+    }
+
+    public NSSet initWithObjects_count_ (objc.id* objects, NSUInteger cnt)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithObjects_1count_1, objects, cnt);
+        return result !is null ? this : null;
+    }
+
+    public NSSet initWithSet_ (NSSet set)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSet_1, set !is null ? set.id : null);
+        return result !is null ? this : null;
+    }
+
+    public NSSet initWithSet_copyItems_ (NSSet set, bool flag)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSet_1copyItems_1, set !is null ? set.id : null, flag);
+        return result !is null ? this : null;
+    }
+
+    public bool intersectsSet (NSSet otherSet)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_intersectsSet_1, otherSet !is null ? otherSet.id : null) !is null;
+    }
+
+    public bool isEqualToSet (NSSet otherSet)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isEqualToSet_1, otherSet !is null ? otherSet.id : null) !is null;
+    }
+
+    public bool isSubsetOfSet (NSSet otherSet)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isSubsetOfSet_1, otherSet !is null ? otherSet.id : null) !is null;
+    }
+
+    public void makeObjectsPerformSelector_ (objc.SEL aSelector)
+    {
+        OS.objc_msgSend(this.id, OS.sel_makeObjectsPerformSelector_1, aSelector);
+    }
+
+    public void makeObjectsPerformSelector_withObject_ (objc.SEL aSelector, id argument)
+    {
+        OS.objc_msgSend(this.id, OS.sel_makeObjectsPerformSelector_1withObject_1, aSelector, argument !is null ? argument.id : null);
+    }
+
+    public id member (id object)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_member_1, object !is null ? object.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSEnumerator objectEnumerator ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_objectEnumerator);
+        return result !is null ? new NSEnumerator(result) : null;
+    }
+
+    public void removeObserver (NSObject observer, NSString keyPath)
+    {
+        OS.objc_msgSend(this.id, OS.sel_removeObserver_1forKeyPath_1, observer !is null ? observer.id : null, keyPath !is null ? keyPath.id : null);
+    }
+
+    public static id set ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_set);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSSet setByAddingObject (id anObject)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_setByAddingObject_1, anObject !is null ? anObject.id : null);
+        return result is this.id ? this : (result !is null ? new NSSet(result) : null);
+    }
+
+    public NSSet setByAddingObjectsFromArray (NSArray other)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_setByAddingObjectsFromArray_1, other !is null ? other.id : null);
+        return result is this.id ? this : (result !is null ? new NSSet(result) : null);
+    }
+
+    public NSSet setByAddingObjectsFromSet (NSSet other)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_setByAddingObjectsFromSet_1, other !is null ? other.id : null);
+        return result is this.id ? this : (result !is null ? new NSSet(result) : null);
+    }
+
+    public void setValue (id value, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setValue_1forKey_1, value !is null ? value.id : null, key !is null ? key.id : null);
+    }
+
+    public static id setWithArray (NSArray array)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithArray_1, array !is null ? array.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public static id setWithObject (id object)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithObject_1, object !is null ? object.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public static id static_setWithObjects_ (id setWithObjects)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithObjects_1, setWithObjects !is null ? setWithObjects.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public static id static_setWithObjects_count_ (objc.id* objects, NSUInteger cnt)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithObjects_1count_1, objects, cnt);
+        return result !is null ? new id(result) : null;
+    }
+
+    public static id setWithSet (NSSet set)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSet, OS.sel_setWithSet_1, set !is null ? set.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id valueForKey (NSString key)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_valueForKey_1, key !is null ? key.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+}