comparison dwt/internal/cocoa/NSCharacterSet.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
comparison
equal deleted inserted replaced
44:ca5e494f2bbf 45:d8635bb48c7c
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others. 2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * 10 *
11 * Port to the D programming language: 11 * Port to the D programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <doob@me.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.internal.cocoa.NSCharacterSet; 14 module dwt.internal.cocoa.NSCharacterSet;
15 15
16 import dwt.internal.cocoa.id; 16 import dwt.dwthelper.utils;
17 import dwt.internal.cocoa.NSData; 17 import cocoa = dwt.internal.cocoa.id;
18 import dwt.internal.cocoa.NSObject; 18 import dwt.internal.cocoa.NSObject;
19 import dwt.internal.cocoa.NSRange;
20 import dwt.internal.cocoa.NSString;
21 import dwt.internal.cocoa.OS; 19 import dwt.internal.cocoa.OS;
22 import objc = dwt.internal.objc.runtime; 20 import objc = dwt.internal.objc.runtime;
23 21
24 public class NSCharacterSet : NSObject 22 public class NSCharacterSet : NSObject {
25 {
26 23
27 public this () 24 public this() {
28 { 25 super();
29 super(); 26 }
30 }
31 27
32 public this (objc.id id) 28 public this(objc.id id) {
33 { 29 super(id);
34 super(id); 30 }
35 }
36 31
37 public static id alphanumericCharacterSet () 32 public this(cocoa.id id) {
38 { 33 super(id);
39 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_alphanumericCharacterSet); 34 }
40 return result !is null ? new id(result) : null;
41 }
42 35
43 public NSData bitmapRepresentation () 36 public bool characterIsMember(wchar aCharacter) {
44 { 37 return OS.objc_msgSend_bool(this.id, OS.sel_characterIsMember_, aCharacter);
45 objc.id result = OS.objc_msgSend(this.id_, OS.sel_bitmapRepresentation); 38 }
46 return result !is null ? new NSData(result) : null;
47 }
48 39
49 public static id capitalizedLetterCharacterSet () 40 public static cocoa.id decimalDigitCharacterSet() {
50 { 41 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_decimalDigitCharacterSet);
51 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_capitalizedLetterCharacterSet); 42 return result !is null ? new cocoa.id(result) : null;
52 return result !is null ? new id(result) : null; 43 }
53 }
54
55 public bool characterIsMember (short aCharacter)
56 {
57 return OS.objc_msgSend(this.id_, OS.sel_characterIsMember_1, aCharacter) !is null;
58 }
59
60 public static id characterSetWithBitmapRepresentation (NSData data)
61 {
62 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_characterSetWithBitmapRepresentation_1, data !is null ? data.id_ : null);
63 return result !is null ? new id(result) : null;
64 }
65
66 public static id characterSetWithCharactersInString (NSString aString)
67 {
68 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_characterSetWithCharactersInString_1, aString !is null ? aString.id_ : null);
69 return result !is null ? new id(result) : null;
70 }
71
72 public static id characterSetWithContentsOfFile (NSString fName)
73 {
74 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_characterSetWithContentsOfFile_1, fName !is null ? fName.id_ : null);
75 return result !is null ? new id(result) : null;
76 }
77
78 public static id characterSetWithRange (NSRange aRange)
79 {
80 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_characterSetWithRange_1, aRange);
81 return result !is null ? new id(result) : null;
82 }
83
84 public static id controlCharacterSet ()
85 {
86 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_controlCharacterSet);
87 return result !is null ? new id(result) : null;
88 }
89
90 public static id decimalDigitCharacterSet ()
91 {
92 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_decimalDigitCharacterSet);
93 return result !is null ? new id(result) : null;
94 }
95
96 public static id decomposableCharacterSet ()
97 {
98 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_decomposableCharacterSet);
99 return result !is null ? new id(result) : null;
100 }
101
102 public bool hasMemberInPlane (byte thePlane)
103 {
104 return OS.objc_msgSend(this.id_, OS.sel_hasMemberInPlane_1, thePlane) !is null;
105 }
106
107 public static id illegalCharacterSet ()
108 {
109 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_illegalCharacterSet);
110 return result !is null ? new id(result) : null;
111 }
112
113 public NSCharacterSet invertedSet ()
114 {
115 objc.id result = OS.objc_msgSend(this.id_, OS.sel_invertedSet);
116 return result is this.id_ ? this : (result !is null ? new NSCharacterSet(result) : null);
117 }
118
119 public bool isSupersetOfSet (NSCharacterSet theOtherSet)
120 {
121 return OS.objc_msgSend(this.id_, OS.sel_isSupersetOfSet_1, theOtherSet !is null ? theOtherSet.id_ : null) !is null;
122 }
123
124 public static id letterCharacterSet ()
125 {
126 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_letterCharacterSet);
127 return result !is null ? new id(result) : null;
128 }
129
130 public bool longCharacterIsMember (dchar theLongChar)
131 {
132 return OS.objc_msgSend(this.id_, OS.sel_longCharacterIsMember_1, theLongChar) !is null;
133 }
134
135 public static id lowercaseLetterCharacterSet ()
136 {
137 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_lowercaseLetterCharacterSet);
138 return result !is null ? new id(result) : null;
139 }
140
141 public static id newlineCharacterSet ()
142 {
143 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_newlineCharacterSet);
144 return result !is null ? new id(result) : null;
145 }
146
147 public static id nonBaseCharacterSet ()
148 {
149 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_nonBaseCharacterSet);
150 return result !is null ? new id(result) : null;
151 }
152
153 public static id punctuationCharacterSet ()
154 {
155 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_punctuationCharacterSet);
156 return result !is null ? new id(result) : null;
157 }
158
159 public static id symbolCharacterSet ()
160 {
161 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_symbolCharacterSet);
162 return result !is null ? new id(result) : null;
163 }
164
165 public static id uppercaseLetterCharacterSet ()
166 {
167 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_uppercaseLetterCharacterSet);
168 return result !is null ? new id(result) : null;
169 }
170
171 public static id whitespaceAndNewlineCharacterSet ()
172 {
173 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_whitespaceAndNewlineCharacterSet);
174 return result !is null ? new id(result) : null;
175 }
176
177 public static id whitespaceCharacterSet ()
178 {
179 objc.id result = OS.objc_msgSend(OS.class_NSCharacterSet, OS.sel_whitespaceCharacterSet);
180 return result !is null ? new id(result) : null;
181 }
182 44
183 } 45 }