diff dwt/internal/cocoa/NSExpression.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/NSExpression.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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.NSExpression;
+
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSMutableDictionary;
+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;
+
+enum NSExpressionType
+{
+    NSConstantValueExpressionType = 0,
+    NSEvaluatedObjectExpressionType,
+    NSVariableExpressionType,
+    NSKeyPathExpressionType,
+    NSFunctionExpressionType,
+    NSAggregateExpressionType,
+    NSSubqueryExpressionType,
+    NSUnionSetExpressionType,
+    NSIntersectSetExpressionType,
+    NSMinusSetExpressionType
+}
+
+public class NSExpression : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public NSArray arguments ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_arguments);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public id collection ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_collection);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id constantValue ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_constantValue);
+        return result !is null ? new id(result) : null;
+    }
+
+    public static NSExpression expressionForAggregate (NSArray subexpressions)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForAggregate_1, subexpressions !is null ? subexpressions.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForConstantValue (id obj)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForConstantValue_1, obj !is null ? obj.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForEvaluatedObject ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForEvaluatedObject);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression static_expressionForFunction_arguments_ (NSString name, NSArray parameters)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForFunction_1arguments_1, name !is null ? name.id : null,
+                parameters !is null ? parameters.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression static_expressionForFunction_selectorName_arguments_ (NSExpression target, NSString name, NSArray parameters)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForFunction_1selectorName_1arguments_1,
+                target !is null ? target.id : null, name !is null ? name.id : null, parameters !is null ? parameters.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForIntersectSet (NSExpression left, NSExpression right)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForIntersectSet_1with_1, left !is null ? left.id : null,
+                right !is null ? right.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForKeyPath (NSString keyPath)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForKeyPath_1, keyPath !is null ? keyPath.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForMinusSet (NSExpression left, NSExpression right)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForMinusSet_1with_1, left !is null ? left.id : null,
+                right !is null ? right.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForSubquery (NSExpression expression, NSString variable, id predicate)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForSubquery_1usingIteratorVariable_1predicate_1,
+                expression !is null ? expression.id : null, variable !is null ? variable.id : null, predicate !is null ? predicate.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForUnionSet (NSExpression left, NSExpression right)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForUnionSet_1with_1, left !is null ? left.id : null,
+                right !is null ? right.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public static NSExpression expressionForVariable (NSString string)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSExpression, OS.sel_expressionForVariable_1, string !is null ? string.id : null);
+        return result !is null ? new NSExpression(result) : null;
+    }
+
+    public NSExpressionType expressionType ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_expressionType);
+    }
+
+    public id expressionValueWithObject (id object, NSMutableDictionary context)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_expressionValueWithObject_1context_1, object !is null ? object.id : null,
+                context !is null ? context.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSString functionn ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_function);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public id initWithExpressionType (NSExpressionType type)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithExpressionType_1, type);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSString keyPath ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_keyPath);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSExpression leftExpression ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_leftExpression);
+        return result is this.id ? this : (result !is null ? new NSExpression(result) : null);
+    }
+
+    public NSExpression operand ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_operand);
+        return result is this.id ? this : (result !is null ? new NSExpression(result) : null);
+    }
+
+    public NSPredicate predicate ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_predicate);
+        return result !is null ? new NSPredicate(result) : null;
+    }
+
+    public NSExpression rightExpression ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_rightExpression);
+        return result is this.id ? this : (result !is null ? new NSExpression(result) : null);
+    }
+
+    public NSString variable ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_variable);
+        return result !is null ? new NSString(result) : null;
+    }
+
+}