]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/schriter.cpp
   2 ****************************************************************************** 
   3 * Copyright (C) 1998-2012, 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 "utypeinfo.h"  // for 'typeid' to work 
  18 #include "unicode/chariter.h" 
  19 #include "unicode/schriter.h" 
  23 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringCharacterIterator
) 
  25 StringCharacterIterator::StringCharacterIterator() 
  26   : UCharCharacterIterator(), 
  29   // NEVER DEFAULT CONSTRUCT! 
  32 StringCharacterIterator::StringCharacterIterator(const UnicodeString
& textStr
) 
  33   : UCharCharacterIterator(textStr
.getBuffer(), textStr
.length()), 
  36     // we had set the input parameter's array, now we need to set our copy's array 
  37     UCharCharacterIterator::text 
= this->text
.getBuffer(); 
  40 StringCharacterIterator::StringCharacterIterator(const UnicodeString
& textStr
, 
  42   : UCharCharacterIterator(textStr
.getBuffer(), textStr
.length(), textPos
), 
  45     // we had set the input parameter's array, now we need to set our copy's array 
  46     UCharCharacterIterator::text 
= this->text
.getBuffer(); 
  49 StringCharacterIterator::StringCharacterIterator(const UnicodeString
& textStr
, 
  53   : UCharCharacterIterator(textStr
.getBuffer(), textStr
.length(), textBegin
, textEnd
, textPos
), 
  56     // we had set the input parameter's array, now we need to set our copy's array 
  57     UCharCharacterIterator::text 
= this->text
.getBuffer(); 
  60 StringCharacterIterator::StringCharacterIterator(const StringCharacterIterator
& that
) 
  61   : UCharCharacterIterator(that
), 
  64     // we had set the input parameter's array, now we need to set our copy's array 
  65     UCharCharacterIterator::text 
= this->text
.getBuffer(); 
  68 StringCharacterIterator::~StringCharacterIterator() { 
  71 StringCharacterIterator
& 
  72 StringCharacterIterator::operator=(const StringCharacterIterator
& that
) { 
  73     UCharCharacterIterator::operator=(that
); 
  75     // we had set the input parameter's array, now we need to set our copy's array 
  76     UCharCharacterIterator::text 
= this->text
.getBuffer(); 
  81 StringCharacterIterator::operator==(const ForwardCharacterIterator
& that
) const { 
  86     // do not call UCharCharacterIterator::operator==() 
  87     // because that checks for array pointer equality 
  88     // while we compare UnicodeString objects 
  90     if (typeid(*this) != typeid(that
)) { 
  94     StringCharacterIterator
&    realThat 
= (StringCharacterIterator
&)that
; 
  96     return text 
== realThat
.text
 
  97         && pos 
== realThat
.pos
 
  98         && begin 
== realThat
.begin
 
  99         && end 
== realThat
.end
; 
 103 StringCharacterIterator::clone() const { 
 104     return new StringCharacterIterator(*this); 
 108 StringCharacterIterator::setText(const UnicodeString
& newText
) { 
 110     UCharCharacterIterator::setText(text
.getBuffer(), text
.length()); 
 114 StringCharacterIterator::getText(UnicodeString
& result
) {