[prev in list] [next in list] [prev in thread] [next in thread]
List: icu4c-support
Subject: Re: BreakIterator C++ help needed
From: Markus Scherer <markus.scherer () jtcsv ! com>
Date: 2002-10-28 21:32:41
[Download RAW message or body]
Christian Gilmore wrote:
> void lineBoundary::printTextRange(BreakIterator &iterator,
> int32_t start, int32_t end ) {
> UnicodeString temp;
> UChar *textBuffer = new UChar[end-start];
>
> CharacterIterator *strIter = (CharacterIterator *)iterator.clone();
Christian, this line could never work. You clone a BreakIterator and cast the resulting
(BreakIterator *) to a (CharacterIterator *). Those are incompatible types!
> strIter->getText(temp);
> temp.extractBetween(start, end, textBuffer);
>
> std::cout << " " << start << " " << end << " |"
> << textBuffer << "|" << std::endl;
> delete strIter;
> }
Try this (I did not compile it):
void lineBoundary::printTextRange(BreakIterator &iterator,
int32_t start, int32_t end ) {
UnicodeString temp;
UChar *textBuffer = new UChar[end-start];
iterator.getText().getText(temp);
temp.extractBetween(start, end, textBuffer);
std::cout << " " << start << " " << end << " |"
<< textBuffer << "|" << std::endl;
}
Note: I doubt that std::cout will be able (portably) to handle the Unicode string in the textBuffer.
I guess it will work on Windows (where wchar_t==UChar) but it will not work on many other platforms.
markus
_______________________________________________
icu4c-support@oss.software.ibm.com - icu4c-support mailing list
To Un/Subscribe:
http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu4c-support
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic