Mercurial > projects > dwt-addons
comparison dwtx/dwtxhelper/mangoicu/USet.d @ 91:11e8159caf7a
make the mango icu fork work.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 07 Jul 2008 15:53:07 +0200 |
parents | 040da1cb0d76 |
children | f05207c07a98 |
comparison
equal
deleted
inserted
replaced
90:7ffeace6c47f | 91:11e8159caf7a |
---|---|
80 All trademarks and registered trademarks mentioned herein are the | 80 All trademarks and registered trademarks mentioned herein are the |
81 property of their respective owners. | 81 property of their respective owners. |
82 | 82 |
83 *******************************************************************************/ | 83 *******************************************************************************/ |
84 | 84 |
85 module dwtx.dwthelper.mangoicu.USet; | 85 module dwtx.dwtxhelper.mangoicu.USet; |
86 | 86 |
87 private import dwtx.dwthelper.mangoicu.ICU, | 87 private import dwtx.dwtxhelper.mangoicu.ICU, |
88 dwtx.dwthelper.mangoicu.UString; | 88 dwtx.dwtxhelper.mangoicu.UString; |
89 | 89 |
90 /******************************************************************************* | 90 /******************************************************************************* |
91 | 91 |
92 A mutable set of Unicode characters and multicharacter strings. | 92 A mutable set of Unicode characters and multicharacter strings. |
93 | 93 |
150 Creates a set from the given pattern. See the UnicodeSet | 150 Creates a set from the given pattern. See the UnicodeSet |
151 class description for the syntax of the pattern language | 151 class description for the syntax of the pattern language |
152 | 152 |
153 ***********************************************************************/ | 153 ***********************************************************************/ |
154 | 154 |
155 this (UText pattern, Options o = Options.None) | 155 this (UStringView pattern, Options o = Options.None) |
156 { | 156 { |
157 Error e; | 157 UErrorCode e; |
158 | 158 |
159 handle = uset_openPatternOptions (pattern.get.ptr, pattern.len, o, e); | 159 handle = uset_openPatternOptions (pattern.get.ptr, pattern.len, o, e); |
160 testError (e, "failed to open pattern-based charset"); | 160 testError (e, "failed to open pattern-based charset"); |
161 } | 161 } |
162 | 162 |
190 Guide chapter about UnicodeSet. Empties the set passed | 190 Guide chapter about UnicodeSet. Empties the set passed |
191 before applying the pattern. | 191 before applying the pattern. |
192 | 192 |
193 ***********************************************************************/ | 193 ***********************************************************************/ |
194 | 194 |
195 void applyPattern (UText pattern, Options o = Options.None) | 195 void applyPattern (UStringView pattern, Options o = Options.None) |
196 { | 196 { |
197 Error e; | 197 UErrorCode e; |
198 | 198 |
199 uset_applyPattern (handle, pattern.get.ptr, pattern.len, o, e); | 199 uset_applyPattern (handle, pattern.get.ptr, pattern.len, o, e); |
200 testError (e, "failed to apply pattern"); | 200 testError (e, "failed to apply pattern"); |
201 } | 201 } |
202 | 202 |
208 | 208 |
209 ***********************************************************************/ | 209 ***********************************************************************/ |
210 | 210 |
211 void toPattern (UString dst, bool escape) | 211 void toPattern (UString dst, bool escape) |
212 { | 212 { |
213 uint fmt (wchar* p, uint len, inout Error e) | 213 uint fmt (wchar* p, uint len, inout UErrorCode e) |
214 { | 214 { |
215 return uset_toPattern (handle, p, len, escape, e); | 215 return uset_toPattern (handle, p, len, escape, e); |
216 } | 216 } |
217 | 217 |
218 dst.format (&fmt, "failed to convert charset to a pattern"); | 218 dst.format (&fmt, "failed to convert charset to a pattern"); |
263 Adds the given string to the given USet. After this call, | 263 Adds the given string to the given USet. After this call, |
264 containsString (str, strLen) will return true | 264 containsString (str, strLen) will return true |
265 | 265 |
266 ***********************************************************************/ | 266 ***********************************************************************/ |
267 | 267 |
268 void addString (UText t) | 268 void addString (UStringView t) |
269 { | 269 { |
270 uset_addString (handle, t.get.ptr, t.len); | 270 uset_addString (handle, t.get.ptr, t.len); |
271 } | 271 } |
272 | 272 |
273 /*********************************************************************** | 273 /*********************************************************************** |
299 Removes the given string from this USet. After the call, | 299 Removes the given string from this USet. After the call, |
300 containsString (str, strLen) will return false | 300 containsString (str, strLen) will return false |
301 | 301 |
302 ***********************************************************************/ | 302 ***********************************************************************/ |
303 | 303 |
304 void removeString (UText t) | 304 void removeString (UStringView t) |
305 { | 305 { |
306 uset_removeString (handle, t.get.ptr, t.len); | 306 uset_removeString (handle, t.get.ptr, t.len); |
307 } | 307 } |
308 | 308 |
309 /*********************************************************************** | 309 /*********************************************************************** |
370 | 370 |
371 Returns true if this USet contains the given string | 371 Returns true if this USet contains the given string |
372 | 372 |
373 ***********************************************************************/ | 373 ***********************************************************************/ |
374 | 374 |
375 bool containsString (UText t) | 375 bool containsString (UStringView t) |
376 { | 376 { |
377 return uset_containsString (handle, t.get.ptr, t.len) != 0; | 377 return uset_containsString (handle, t.get.ptr, t.len) != 0; |
378 } | 378 } |
379 | 379 |
380 /*********************************************************************** | 380 /*********************************************************************** |
403 | 403 |
404 private static extern (C) | 404 private static extern (C) |
405 { | 405 { |
406 Handle function (wchar start, wchar end) uset_open; | 406 Handle function (wchar start, wchar end) uset_open; |
407 void function (Handle) uset_close; | 407 void function (Handle) uset_close; |
408 Handle function (wchar* pattern, uint patternLength, uint options, inout Error e) uset_openPatternOptions; | 408 Handle function (wchar* pattern, uint patternLength, uint options, inout UErrorCode e) uset_openPatternOptions; |
409 uint function (Handle, wchar* pattern, uint patternLength, uint options, inout Error e) uset_applyPattern; | 409 uint function (Handle, wchar* pattern, uint patternLength, uint options, inout UErrorCode e) uset_applyPattern; |
410 uint function (Handle, wchar* result, uint resultCapacity, byte escapeUnprintable, inout Error e) uset_toPattern; | 410 uint function (Handle, wchar* result, uint resultCapacity, byte escapeUnprintable, inout UErrorCode e) uset_toPattern; |
411 void function (Handle, wchar c) uset_add; | 411 void function (Handle, wchar c) uset_add; |
412 void function (Handle, Handle additionalSet) uset_addAll; | 412 void function (Handle, Handle additionalSet) uset_addAll; |
413 void function (Handle, wchar start, wchar end) uset_addRange; | 413 void function (Handle, wchar start, wchar end) uset_addRange; |
414 void function (Handle, wchar* str, uint strLen) uset_addString; | 414 void function (Handle, wchar* str, uint strLen) uset_addString; |
415 void function (Handle, wchar c) uset_remove; | 415 void function (Handle, wchar c) uset_remove; |