]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/schriter.cpp
2 ******************************************************************************
3 * Copyright (C) 1998-2007, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 ******************************************************************************
9 * Modification History:
11 * Date Name Description
12 * 05/05/99 stephen Cleaned up.
13 ******************************************************************************
16 #include "unicode/chariter.h"
17 #include "unicode/schriter.h"
21 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringCharacterIterator
)
23 StringCharacterIterator::StringCharacterIterator()
24 : UCharCharacterIterator(),
27 // NEVER DEFAULT CONSTRUCT!
30 StringCharacterIterator::StringCharacterIterator(const UnicodeString
& textStr
)
31 : UCharCharacterIterator(textStr
.getBuffer(), textStr
.length()),
34 // we had set the input parameter's array, now we need to set our copy's array
35 UCharCharacterIterator::text
= this->text
.getBuffer();
38 StringCharacterIterator::StringCharacterIterator(const UnicodeString
& textStr
,
40 : UCharCharacterIterator(textStr
.getBuffer(), textStr
.length(), textPos
),
43 // we had set the input parameter's array, now we need to set our copy's array
44 UCharCharacterIterator::text
= this->text
.getBuffer();
47 StringCharacterIterator::StringCharacterIterator(const UnicodeString
& textStr
,
51 : UCharCharacterIterator(textStr
.getBuffer(), textStr
.length(), textBegin
, textEnd
, textPos
),
54 // we had set the input parameter's array, now we need to set our copy's array
55 UCharCharacterIterator::text
= this->text
.getBuffer();
58 StringCharacterIterator::StringCharacterIterator(const StringCharacterIterator
& that
)
59 : UCharCharacterIterator(that
),
62 // we had set the input parameter's array, now we need to set our copy's array
63 UCharCharacterIterator::text
= this->text
.getBuffer();
66 StringCharacterIterator::~StringCharacterIterator() {
69 StringCharacterIterator
&
70 StringCharacterIterator::operator=(const StringCharacterIterator
& that
) {
71 UCharCharacterIterator::operator=(that
);
73 // we had set the input parameter's array, now we need to set our copy's array
74 UCharCharacterIterator::text
= this->text
.getBuffer();
79 StringCharacterIterator::operator==(const ForwardCharacterIterator
& that
) const {
84 // do not call UCharCharacterIterator::operator==()
85 // because that checks for array pointer equality
86 // while we compare UnicodeString objects
88 if (getDynamicClassID() != that
.getDynamicClassID()) {
92 StringCharacterIterator
& realThat
= (StringCharacterIterator
&)that
;
94 return text
== realThat
.text
95 && pos
== realThat
.pos
96 && begin
== realThat
.begin
97 && end
== realThat
.end
;
101 StringCharacterIterator::clone() const {
102 return new StringCharacterIterator(*this);
106 StringCharacterIterator::setText(const UnicodeString
& newText
) {
108 UCharCharacterIterator::setText(text
.getBuffer(), text
.length());
112 StringCharacterIterator::getText(UnicodeString
& result
) {