Mercurial > projects > dwt-mac
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSPredicate; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSDictionary; | |
19 import dwt.internal.cocoa.NSObject; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 public class NSPredicate : NSObject | |
25 { | |
26 | |
27 public this () | |
28 { | |
29 super(); | |
30 } | |
31 | |
32 public this (objc.id id) | |
33 { | |
34 super(id); | |
35 } | |
36 | |
37 public bool evaluateWithObject_ (id object) | |
38 { | |
39 return OS.objc_msgSend(this.id, OS.sel_evaluateWithObject_1, object !is null ? object.id : null) !is null; | |
40 } | |
41 | |
42 public bool evaluateWithObject_substitutionVariables_ (id object, NSDictionary bindings) | |
43 { | |
44 return OS.objc_msgSend(this.id, OS.sel_evaluateWithObject_1substitutionVariables_1, object !is null ? object.id : null, | |
45 bindings !is null ? bindings.id : null) !is null; | |
46 } | |
47 | |
48 public NSString predicateFormat () | |
49 { | |
50 objc.id result = OS.objc_msgSend(this.id, OS.sel_predicateFormat); | |
51 return result !is null ? new NSString(result) : null; | |
52 } | |
53 | |
54 public static NSPredicate static_predicateWithFormat_ (NSString predicateWithFormat) | |
55 { | |
56 objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithFormat_1, | |
57 predicateWithFormat !is null ? predicateWithFormat.id : null); | |
58 return result !is null ? new NSPredicate(result) : null; | |
59 } | |
60 | |
61 public static NSPredicate static_predicateWithFormat_argumentArray_ (NSString predicateFormat, NSArray arguments) | |
62 { | |
63 objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithFormat_1argumentArray_1, | |
64 predicateFormat !is null ? predicateFormat.id : null, arguments !is null ? arguments.id : null); | |
65 return result !is null ? new NSPredicate(result) : null; | |
66 } | |
67 | |
68 public static NSPredicate static_predicateWithFormat_arguments_ (NSString predicateFormat, ...) | |
69 { | |
70 objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithFormat_1arguments_1, | |
71 predicateFormat !is null ? predicateFormat.id : null, _argptr); | |
72 return result !is null ? new NSPredicate(result) : null; | |
73 } | |
74 | |
75 public NSPredicate predicateWithSubstitutionVariables (NSDictionary variables) | |
76 { | |
77 objc.id result = OS.objc_msgSend(this.id, OS.sel_predicateWithSubstitutionVariables_1, variables !is null ? variables.id : null); | |
78 return result is this.id ? this : (result !is null ? new NSPredicate(result) : null); | |
79 } | |
80 | |
81 public static NSPredicate predicateWithValue (bool value) | |
82 { | |
83 objc.id result = OS.objc_msgSend(OS.class_NSPredicate, OS.sel_predicateWithValue_1, value); | |
84 return result !is null ? new NSPredicate(result) : null; | |
85 } | |
86 | |
87 } |