diff dwt/internal/cocoa/NSPredicate.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/NSPredicate.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.NSPredicate;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSDictionary;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSPredicate : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public bool evaluateWithObject_ (id object)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_evaluateWithObject_1, object !is null ? object.id : null) !is null;
+    }
+
+    public bool evaluateWithObject_substitutionVariables_ (id object, NSDictionary bindings)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_evaluateWithObject_1substitutionVariables_1, object !is null ? object.id : null,
+                bindings !is null ? bindings.id : null) !is null;
+    }
+
+    public NSString predicateFormat ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_predicateFormat);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public static NSPredicate static_predicateWithFormat_ (NSString predicateWithFormat)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithFormat_1,
+                predicateWithFormat !is null ? predicateWithFormat.id : null);
+        return result !is null ? new NSPredicate(result) : null;
+    }
+
+    public static NSPredicate static_predicateWithFormat_argumentArray_ (NSString predicateFormat, NSArray arguments)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithFormat_1argumentArray_1,
+                predicateFormat !is null ? predicateFormat.id : null, arguments !is null ? arguments.id : null);
+        return result !is null ? new NSPredicate(result) : null;
+    }
+
+    public static NSPredicate static_predicateWithFormat_arguments_ (NSString predicateFormat, ...)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithFormat_1arguments_1,
+                predicateFormat !is null ? predicateFormat.id : null, _argptr);
+        return result !is null ? new NSPredicate(result) : null;
+    }
+
+    public NSPredicate predicateWithSubstitutionVariables (NSDictionary variables)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_predicateWithSubstitutionVariables_1, variables !is null ? variables.id : null);
+        return result is this.id ? this : (result !is null ? new NSPredicate(result) : null);
+    }
+
+    public static NSPredicate predicateWithValue (bool value)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithValue_1, value);
+        return result !is null ? new NSPredicate(result) : null;
+    }
+
+}