~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/common/unicode/schriter.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
******************************************************************************
3
 
*
4
 
*   Copyright (C) 1998-2001, International Business Machines
5
 
*   Corporation and others.  All Rights Reserved.
6
 
*
7
 
******************************************************************************
8
 
*
9
 
* File schriter.h
10
 
*
11
 
* Modification History:
12
 
*
13
 
*   Date        Name        Description
14
 
*  05/05/99     stephen     Cleaned up.
15
 
******************************************************************************
16
 
*/
17
 
 
18
 
#ifndef SCHRITER_H
19
 
#define SCHRITER_H
20
 
 
21
 
#include "unicode/utypes.h"
22
 
#include "unicode/chariter.h"
23
 
#include "unicode/uchriter.h"
24
 
 
25
 
U_NAMESPACE_BEGIN
26
 
/**
27
 
 * A concrete subclass of CharacterIterator that iterates over the
28
 
 * characters (code units or code points) in a UnicodeString.
29
 
 * It's possible not only to create an
30
 
 * iterator that iterates over an entire UnicodeString, but also to
31
 
 * create one that iterates over only a subrange of a UnicodeString
32
 
 * (iterators over different subranges of the same UnicodeString don't
33
 
 * compare equal).
34
 
 * @see CharacterIterator
35
 
 * @see ForwardCharacterIterator
36
 
 * @stable
37
 
 */
38
 
class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator {
39
 
public:
40
 
  /**
41
 
   * Create an iterator over the UnicodeString referred to by "textStr".
42
 
   * The UnicodeString object is copied.
43
 
   * The iteration range is the whole string, and the starting position is 0.
44
 
   * @stable
45
 
   */
46
 
  StringCharacterIterator(const UnicodeString& textStr);
47
 
 
48
 
  /**
49
 
   * Create an iterator over the UnicodeString referred to by "textStr".
50
 
   * The iteration range is the whole string, and the starting
51
 
   * position is specified by "textPos".  If "textPos" is outside the valid
52
 
   * iteration range, the behavior of this object is undefined.  
53
 
   * @stable
54
 
   */
55
 
  StringCharacterIterator(const UnicodeString&    textStr,
56
 
              int32_t              textPos);
57
 
 
58
 
  /**
59
 
   * Create an iterator over the UnicodeString referred to by "textStr".
60
 
   * The UnicodeString object is copied.
61
 
   * The iteration range begins with the code unit specified by
62
 
   * "textBegin" and ends with the code unit BEFORE the code unit specfied
63
 
   * by "textEnd".  The starting position is specified by "textPos".  If
64
 
   * "textBegin" and "textEnd" don't form a valid range on "text" (i.e.,
65
 
   * textBegin >= textEnd or either is negative or greater than text.size()),
66
 
   * or "textPos" is outside the range defined by "textBegin" and "textEnd",
67
 
   * the behavior of this iterator is undefined.  
68
 
   * @stable
69
 
   */
70
 
  StringCharacterIterator(const UnicodeString&    textStr,
71
 
              int32_t              textBegin,
72
 
              int32_t              textEnd,
73
 
              int32_t              textPos);
74
 
 
75
 
  /**
76
 
   * Copy constructor.  The new iterator iterates over the same range
77
 
   * of the same string as "that", and its initial position is the
78
 
   * same as "that"'s current position.  
79
 
   * The UnicodeString object in "that" is copied.
80
 
   * @stable
81
 
   */
82
 
  StringCharacterIterator(const StringCharacterIterator&  that);
83
 
 
84
 
  /**
85
 
   * Destructor.  
86
 
   * @stable
87
 
   */
88
 
  virtual ~StringCharacterIterator();
89
 
 
90
 
  /**
91
 
   * Assignment operator.  *this is altered to iterate over the same
92
 
   * range of the same string as "that", and refers to the same
93
 
   * character within that string as "that" does.  
94
 
   * @stable
95
 
   */
96
 
  StringCharacterIterator&
97
 
  operator=(const StringCharacterIterator&    that);
98
 
 
99
 
  /**
100
 
   * Returns true if the iterators iterate over the same range of the
101
 
   * same string and are pointing at the same character.  
102
 
   * @stable
103
 
   */
104
 
  virtual UBool          operator==(const ForwardCharacterIterator& that) const;
105
 
 
106
 
  /**
107
 
   * Returns a new StringCharacterIterator referring to the same
108
 
   * character in the same range of the same string as this one.  The
109
 
   * caller must delete the new iterator.  
110
 
   * @stable
111
 
   */
112
 
  virtual CharacterIterator* clone(void) const;
113
 
                                
114
 
  /**
115
 
   * Sets the iterator to iterate over the provided string.
116
 
   * @stable
117
 
   */
118
 
  void setText(const UnicodeString& newText);
119
 
 
120
 
  /**
121
 
   * Copies the UnicodeString under iteration into the UnicodeString
122
 
   * referred to by "result".  Even if this iterator iterates across
123
 
   * only a part of this string, the whole string is copied.
124
 
   * @param result Receives a copy of the text under iteration.  
125
 
   * @stable
126
 
   */
127
 
  virtual void            getText(UnicodeString& result);
128
 
 
129
 
  /**
130
 
   * Return a class ID for this object (not really public) 
131
 
   * @stable
132
 
   */
133
 
  virtual UClassID         getDynamicClassID(void) const 
134
 
    { return getStaticClassID(); }
135
 
 
136
 
  /**
137
 
   * Return a class ID for this class (not really public) 
138
 
   * @stable
139
 
   */
140
 
  static UClassID          getStaticClassID(void) 
141
 
    { return (UClassID)(&fgClassID); }
142
 
 
143
 
protected:
144
 
  StringCharacterIterator();
145
 
  void setText(const UChar* newText, int32_t newTextLength);
146
 
        
147
 
  UnicodeString            text;
148
 
private:
149
 
  static const char        fgClassID;
150
 
};
151
 
 
152
 
U_NAMESPACE_END
153
 
#endif