- support of [Strings.LanguageID]-sections for inf-files added in setupapi
[reactos.git] / reactos / nls / 3rdparty / icu / source / common / schriter.cpp
1 /*
2 ******************************************************************************
3 * Copyright (C) 1998-2004, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 ******************************************************************************
6 *
7 * File schriter.cpp
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 05/05/99 stephen Cleaned up.
13 ******************************************************************************
14 */
15
16 #include "unicode/chariter.h"
17 #include "unicode/schriter.h"
18
19 U_NAMESPACE_BEGIN
20
21 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringCharacterIterator)
22
23 StringCharacterIterator::StringCharacterIterator()
24 : UCharCharacterIterator(),
25 text()
26 {
27 // NEVER DEFAULT CONSTRUCT!
28 }
29
30 StringCharacterIterator::StringCharacterIterator(const UnicodeString& textStr)
31 : UCharCharacterIterator(textStr.fArray, textStr.length()),
32 text(textStr)
33 {
34 // we had set the input parameter's array, now we need to set our copy's array
35 UCharCharacterIterator::text = this->text.fArray;
36 }
37
38 StringCharacterIterator::StringCharacterIterator(const UnicodeString& textStr,
39 int32_t textPos)
40 : UCharCharacterIterator(textStr.fArray, textStr.length(), textPos),
41 text(textStr)
42 {
43 // we had set the input parameter's array, now we need to set our copy's array
44 UCharCharacterIterator::text = this->text.fArray;
45 }
46
47 StringCharacterIterator::StringCharacterIterator(const UnicodeString& textStr,
48 int32_t textBegin,
49 int32_t textEnd,
50 int32_t textPos)
51 : UCharCharacterIterator(textStr.fArray, textStr.length(), textBegin, textEnd, textPos),
52 text(textStr)
53 {
54 // we had set the input parameter's array, now we need to set our copy's array
55 UCharCharacterIterator::text = this->text.fArray;
56 }
57
58 StringCharacterIterator::StringCharacterIterator(const StringCharacterIterator& that)
59 : UCharCharacterIterator(that),
60 text(that.text)
61 {
62 // we had set the input parameter's array, now we need to set our copy's array
63 UCharCharacterIterator::text = this->text.fArray;
64 }
65
66 StringCharacterIterator::~StringCharacterIterator() {
67 }
68
69 StringCharacterIterator&
70 StringCharacterIterator::operator=(const StringCharacterIterator& that) {
71 UCharCharacterIterator::operator=(that);
72 text = that.text;
73 // we had set the input parameter's array, now we need to set our copy's array
74 UCharCharacterIterator::text = this->text.fArray;
75 return *this;
76 }
77
78 UBool
79 StringCharacterIterator::operator==(const ForwardCharacterIterator& that) const {
80 if (this == &that) {
81 return TRUE;
82 }
83
84 // do not call UCharCharacterIterator::operator==()
85 // because that checks for array pointer equality
86 // while we compare UnicodeString objects
87
88 if (getDynamicClassID() != that.getDynamicClassID()) {
89 return FALSE;
90 }
91
92 StringCharacterIterator& realThat = (StringCharacterIterator&)that;
93
94 return text == realThat.text
95 && pos == realThat.pos
96 && begin == realThat.begin
97 && end == realThat.end;
98 }
99
100 CharacterIterator*
101 StringCharacterIterator::clone() const {
102 return new StringCharacterIterator(*this);
103 }
104
105 void
106 StringCharacterIterator::setText(const UnicodeString& newText) {
107 text = newText;
108 UCharCharacterIterator::setText(text.fArray, text.length());
109 }
110
111 void
112 StringCharacterIterator::getText(UnicodeString& result) {
113 result = text;
114 }
115 U_NAMESPACE_END