/*
**********************************************************************
-* Copyright (c) 2002-2003, International Business Machines
+* Copyright (c) 2002-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
* @param set set to iterate over
*/
UnicodeSetIterator::UnicodeSetIterator(const UnicodeSet& uSet) {
+ cpString = NULL;
reset(uSet);
}
*/
UnicodeSetIterator::UnicodeSetIterator() {
this->set = NULL;
+ cpString = NULL;
reset();
}
UnicodeSetIterator::~UnicodeSetIterator() {
- // Nothing to do
+ delete cpString;
}
/**
UBool UnicodeSetIterator::next() {
if (nextElement <= endElement) {
codepoint = codepointEnd = nextElement++;
+ string = NULL;
return TRUE;
}
if (range < endRange) {
loadRange(++range);
codepoint = codepointEnd = nextElement++;
+ string = NULL;
return TRUE;
}
* <br>Note also that the codepointEnd is undefined after calling this method.
*/
UBool UnicodeSetIterator::nextRange() {
+ string = NULL;
if (nextElement <= endElement) {
codepointEnd = endElement;
codepoint = nextElement;
loadRange(range);
}
nextString = 0;
+ string = NULL;
}
void UnicodeSetIterator::loadRange(int32_t iRange) {
endElement = set->getRangeEnd(iRange);
}
+
+const UnicodeString& UnicodeSetIterator::getString() {
+ if (string==NULL && codepoint!=(UChar32)IS_STRING) {
+ if (cpString == NULL) {
+ cpString = new UnicodeString();
+ }
+ if (cpString != NULL) {
+ cpString->setTo((UChar32)codepoint);
+ }
+ string = cpString;
+ }
+ return *string;
+}
+
U_NAMESPACE_END
//eof