comparison dwtx/dwtxhelper/mangoicu/UBreakIterator.d @ 98:95307ad235d9

Added Draw2d code, still work in progress
author Frank Benoit <benoit@tionex.de>
date Sun, 03 Aug 2008 00:52:14 +0200
parents f05207c07a98
children 1a5b8f8129df
comparison
equal deleted inserted replaced
96:b492ba44e44d 98:95307ad235d9
364 a specified locale. A UBreakIterator may be used for detecting 364 a specified locale. A UBreakIterator may be used for detecting
365 character, line, word, and sentence breaks in text. 365 character, line, word, and sentence breaks in text.
366 366
367 ***********************************************************************/ 367 ***********************************************************************/
368 368
369 static UBreakIterator openWordIterator( ULocale locale, char[] str ){ 369 static UBreakIterator openWordIterator( ULocale locale, char[] str = null ){
370 UBreakIterator res; 370 UBreakIterator res;
371 res.ut.openUTF8(str);
372 auto e = ICU.UErrorCode.OK; 371 auto e = ICU.UErrorCode.OK;
373 res.handle = ubrk_open( Type.Word, locale.name.ptr, null, 0, e); 372 res.handle = ubrk_open( Type.Word, locale.name.ptr, null, 0, e);
374 ICU.testError (e, "failed to open word iterator"); 373 ICU.testError (e, "failed to open word iterator");
375 ubrk_setUText( res.handle, & res.ut, e); 374 if( str ) {
376 ICU.testError (e, "failed to set text in iterator"); 375 res.ut.openUTF8(str);
376 ubrk_setUText( res.handle, & res.ut, e);
377 ICU.testError (e, "failed to set text in iterator");
378 }
377 return res; 379 return res;
378 } 380 }
379 381
380 static UBreakIterator openLineIterator( ULocale locale, char[] str ){ 382 static UBreakIterator openLineIterator( ULocale locale, char[] str = null ){
381 UBreakIterator res; 383 UBreakIterator res;
382 res.ut.openUTF8(str);
383 auto e = ICU.UErrorCode.OK; 384 auto e = ICU.UErrorCode.OK;
384 res.handle = ubrk_open( Type.Line, locale.name.ptr, null, 0, e); 385 res.handle = ubrk_open( Type.Line, locale.name.ptr, null, 0, e);
385 ICU.testError (e, "failed to open line iterator"); 386 ICU.testError (e, "failed to open line iterator");
386 ubrk_setUText( res.handle, & res.ut, e); 387 if( str ) {
387 ICU.testError (e, "failed to set text in iterator"); 388 res.ut.openUTF8(str);
389 ubrk_setUText( res.handle, & res.ut, e);
390 ICU.testError (e, "failed to set text in iterator");
391 }
388 return res; 392 return res;
389 } 393 }
390 394
391 /*********************************************************************** 395 /***********************************************************************
392 396