diff dstep/foundation/NSComparisonPredicate.d @ 14:89f3c3ef1fd2

Added the Foundation framework
author Jacob Carlborg <doob@me.com>
date Mon, 03 Aug 2009 15:23:15 +0200
parents
children 19885b43130e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/foundation/NSComparisonPredicate.d	Mon Aug 03 15:23:15 2009 +0200
@@ -0,0 +1,125 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Aug 3, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.foundation.NSComparisonPredicate;
+
+import dstep.foundation.NSExpression;
+import dstep.foundation.NSPredicate;
+import dstep.foundation.NSPredicateOperator;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc : id;
+
+alias NSUInteger NSComparisonPredicateModifier;
+alias NSUInteger NSPredicateOperatorType;
+
+enum
+{
+	NSCaseInsensitivePredicateOption = 0x01,
+	NSDiacriticInsensitivePredicateOption = 0x02
+}
+
+enum
+{
+	NSDirectPredicateModifier = 0,
+	NSAllPredicateModifier,
+	NSAnyPredicateModifier
+}
+
+enum
+{
+	NSLessThanPredicateOperatorType = 0,
+	NSLessThanOrEqualToPredicateOperatorType,
+	NSGreaterThanPredicateOperatorType,
+	NSGreaterThanOrEqualToPredicateOperatorType,
+	NSEqualToPredicateOperatorType,
+	NSNotEqualToPredicateOperatorType,
+	NSMatchesPredicateOperatorType,
+	NSLikePredicateOperatorType,
+	NSBeginsWithPredicateOperatorType,
+	NSEndsWithPredicateOperatorType,
+	NSInPredicateOperatorType,
+	NSCustomSelectorPredicateOperatorType,
+	NSContainsPredicateOperatorType = 99,
+	NSBetweenPredicateOperatorType
+}
+
+class NSComparisonPredicate : NSPredicate
+{
+	mixin ObjcWrap;
+
+	static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options)
+	{
+		return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options);
+	}
+
+	static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector)
+	{
+		return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector);
+	}
+
+	Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options)
+	{
+		return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options);
+	}
+
+	this (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options)
+	{
+		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
+		id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(objcObject, lhs, rhs, modifier, type, options);
+
+		if (result)
+			objcObject = ret;
+
+		dObject = this;
+	}
+
+	Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector)
+	{
+		return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector);
+	}
+
+	this (NSExpression lhs, NSExpression rhs, SEL selector)
+	{
+		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
+		id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(objcObject, lhs, rhs, selector);
+
+		if (result)
+			objcObject = ret;
+
+		dObject = this;
+	}
+
+	uint predicateOperatorType ()
+	{
+		return invokeObjcSelf!(uint, "predicateOperatorType");
+	}
+
+	uint comparisonPredicateModifier ()
+	{
+		return invokeObjcSelf!(uint, "comparisonPredicateModifier");
+	}
+
+	NSExpression leftExpression ()
+	{
+		return invokeObjcSelf!(NSExpression, "leftExpression");
+	}
+
+	NSExpression rightExpression ()
+	{
+		return invokeObjcSelf!(NSExpression, "rightExpression");
+	}
+
+	SEL customSelector ()
+	{
+		return invokeObjcSelf!(SEL, "customSelector");
+	}
+
+	NSUInteger options ()
+	{
+		return invokeObjcSelf!(NSUInteger, "options");
+	}
+}
+