annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/schriter.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // © 2016 and later: Unicode, Inc. and others.
jpayne@69 2 // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69 3 /*
jpayne@69 4 ******************************************************************************
jpayne@69 5 *
jpayne@69 6 * Copyright (C) 1998-2005, International Business Machines
jpayne@69 7 * Corporation and others. All Rights Reserved.
jpayne@69 8 *
jpayne@69 9 ******************************************************************************
jpayne@69 10 *
jpayne@69 11 * File schriter.h
jpayne@69 12 *
jpayne@69 13 * Modification History:
jpayne@69 14 *
jpayne@69 15 * Date Name Description
jpayne@69 16 * 05/05/99 stephen Cleaned up.
jpayne@69 17 ******************************************************************************
jpayne@69 18 */
jpayne@69 19
jpayne@69 20 #ifndef SCHRITER_H
jpayne@69 21 #define SCHRITER_H
jpayne@69 22
jpayne@69 23 #include "unicode/utypes.h"
jpayne@69 24
jpayne@69 25 #if U_SHOW_CPLUSPLUS_API
jpayne@69 26
jpayne@69 27 #include "unicode/chariter.h"
jpayne@69 28 #include "unicode/uchriter.h"
jpayne@69 29
jpayne@69 30 /**
jpayne@69 31 * \file
jpayne@69 32 * \brief C++ API: String Character Iterator
jpayne@69 33 */
jpayne@69 34
jpayne@69 35 U_NAMESPACE_BEGIN
jpayne@69 36 /**
jpayne@69 37 * A concrete subclass of CharacterIterator that iterates over the
jpayne@69 38 * characters (code units or code points) in a UnicodeString.
jpayne@69 39 * It's possible not only to create an
jpayne@69 40 * iterator that iterates over an entire UnicodeString, but also to
jpayne@69 41 * create one that iterates over only a subrange of a UnicodeString
jpayne@69 42 * (iterators over different subranges of the same UnicodeString don't
jpayne@69 43 * compare equal).
jpayne@69 44 * @see CharacterIterator
jpayne@69 45 * @see ForwardCharacterIterator
jpayne@69 46 * @stable ICU 2.0
jpayne@69 47 */
jpayne@69 48 class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator {
jpayne@69 49 public:
jpayne@69 50 /**
jpayne@69 51 * Create an iterator over the UnicodeString referred to by "textStr".
jpayne@69 52 * The UnicodeString object is copied.
jpayne@69 53 * The iteration range is the whole string, and the starting position is 0.
jpayne@69 54 * @param textStr The unicode string used to create an iterator
jpayne@69 55 * @stable ICU 2.0
jpayne@69 56 */
jpayne@69 57 StringCharacterIterator(const UnicodeString& textStr);
jpayne@69 58
jpayne@69 59 /**
jpayne@69 60 * Create an iterator over the UnicodeString referred to by "textStr".
jpayne@69 61 * The iteration range is the whole string, and the starting
jpayne@69 62 * position is specified by "textPos". If "textPos" is outside the valid
jpayne@69 63 * iteration range, the behavior of this object is undefined.
jpayne@69 64 * @param textStr The unicode string used to create an iterator
jpayne@69 65 * @param textPos The starting position of the iteration
jpayne@69 66 * @stable ICU 2.0
jpayne@69 67 */
jpayne@69 68 StringCharacterIterator(const UnicodeString& textStr,
jpayne@69 69 int32_t textPos);
jpayne@69 70
jpayne@69 71 /**
jpayne@69 72 * Create an iterator over the UnicodeString referred to by "textStr".
jpayne@69 73 * The UnicodeString object is copied.
jpayne@69 74 * The iteration range begins with the code unit specified by
jpayne@69 75 * "textBegin" and ends with the code unit BEFORE the code unit specified
jpayne@69 76 * by "textEnd". The starting position is specified by "textPos". If
jpayne@69 77 * "textBegin" and "textEnd" don't form a valid range on "text" (i.e.,
jpayne@69 78 * textBegin >= textEnd or either is negative or greater than text.size()),
jpayne@69 79 * or "textPos" is outside the range defined by "textBegin" and "textEnd",
jpayne@69 80 * the behavior of this iterator is undefined.
jpayne@69 81 * @param textStr The unicode string used to create the StringCharacterIterator
jpayne@69 82 * @param textBegin The begin position of the iteration range
jpayne@69 83 * @param textEnd The end position of the iteration range
jpayne@69 84 * @param textPos The starting position of the iteration
jpayne@69 85 * @stable ICU 2.0
jpayne@69 86 */
jpayne@69 87 StringCharacterIterator(const UnicodeString& textStr,
jpayne@69 88 int32_t textBegin,
jpayne@69 89 int32_t textEnd,
jpayne@69 90 int32_t textPos);
jpayne@69 91
jpayne@69 92 /**
jpayne@69 93 * Copy constructor. The new iterator iterates over the same range
jpayne@69 94 * of the same string as "that", and its initial position is the
jpayne@69 95 * same as "that"'s current position.
jpayne@69 96 * The UnicodeString object in "that" is copied.
jpayne@69 97 * @param that The StringCharacterIterator to be copied
jpayne@69 98 * @stable ICU 2.0
jpayne@69 99 */
jpayne@69 100 StringCharacterIterator(const StringCharacterIterator& that);
jpayne@69 101
jpayne@69 102 /**
jpayne@69 103 * Destructor.
jpayne@69 104 * @stable ICU 2.0
jpayne@69 105 */
jpayne@69 106 virtual ~StringCharacterIterator();
jpayne@69 107
jpayne@69 108 /**
jpayne@69 109 * Assignment operator. *this is altered to iterate over the same
jpayne@69 110 * range of the same string as "that", and refers to the same
jpayne@69 111 * character within that string as "that" does.
jpayne@69 112 * @param that The object to be copied.
jpayne@69 113 * @return the newly created object.
jpayne@69 114 * @stable ICU 2.0
jpayne@69 115 */
jpayne@69 116 StringCharacterIterator&
jpayne@69 117 operator=(const StringCharacterIterator& that);
jpayne@69 118
jpayne@69 119 /**
jpayne@69 120 * Returns true if the iterators iterate over the same range of the
jpayne@69 121 * same string and are pointing at the same character.
jpayne@69 122 * @param that The ForwardCharacterIterator to be compared for equality
jpayne@69 123 * @return true if the iterators iterate over the same range of the
jpayne@69 124 * same string and are pointing at the same character.
jpayne@69 125 * @stable ICU 2.0
jpayne@69 126 */
jpayne@69 127 virtual UBool operator==(const ForwardCharacterIterator& that) const;
jpayne@69 128
jpayne@69 129 /**
jpayne@69 130 * Returns a new StringCharacterIterator referring to the same
jpayne@69 131 * character in the same range of the same string as this one. The
jpayne@69 132 * caller must delete the new iterator.
jpayne@69 133 * @return the newly cloned object.
jpayne@69 134 * @stable ICU 2.0
jpayne@69 135 */
jpayne@69 136 virtual StringCharacterIterator* clone() const;
jpayne@69 137
jpayne@69 138 /**
jpayne@69 139 * Sets the iterator to iterate over the provided string.
jpayne@69 140 * @param newText The string to be iterated over
jpayne@69 141 * @stable ICU 2.0
jpayne@69 142 */
jpayne@69 143 void setText(const UnicodeString& newText);
jpayne@69 144
jpayne@69 145 /**
jpayne@69 146 * Copies the UnicodeString under iteration into the UnicodeString
jpayne@69 147 * referred to by "result". Even if this iterator iterates across
jpayne@69 148 * only a part of this string, the whole string is copied.
jpayne@69 149 * @param result Receives a copy of the text under iteration.
jpayne@69 150 * @stable ICU 2.0
jpayne@69 151 */
jpayne@69 152 virtual void getText(UnicodeString& result);
jpayne@69 153
jpayne@69 154 /**
jpayne@69 155 * Return a class ID for this object (not really public)
jpayne@69 156 * @return a class ID for this object.
jpayne@69 157 * @stable ICU 2.0
jpayne@69 158 */
jpayne@69 159 virtual UClassID getDynamicClassID(void) const;
jpayne@69 160
jpayne@69 161 /**
jpayne@69 162 * Return a class ID for this class (not really public)
jpayne@69 163 * @return a class ID for this class
jpayne@69 164 * @stable ICU 2.0
jpayne@69 165 */
jpayne@69 166 static UClassID U_EXPORT2 getStaticClassID(void);
jpayne@69 167
jpayne@69 168 protected:
jpayne@69 169 /**
jpayne@69 170 * Default constructor, iteration over empty string.
jpayne@69 171 * @stable ICU 2.0
jpayne@69 172 */
jpayne@69 173 StringCharacterIterator();
jpayne@69 174
jpayne@69 175 /**
jpayne@69 176 * Sets the iterator to iterate over the provided string.
jpayne@69 177 * @param newText The string to be iterated over
jpayne@69 178 * @param newTextLength The length of the String
jpayne@69 179 * @stable ICU 2.0
jpayne@69 180 */
jpayne@69 181 void setText(const char16_t* newText, int32_t newTextLength);
jpayne@69 182
jpayne@69 183 /**
jpayne@69 184 * Copy of the iterated string object.
jpayne@69 185 * @stable ICU 2.0
jpayne@69 186 */
jpayne@69 187 UnicodeString text;
jpayne@69 188
jpayne@69 189 };
jpayne@69 190
jpayne@69 191 U_NAMESPACE_END
jpayne@69 192
jpayne@69 193 #endif /* U_SHOW_CPLUSPLUS_API */
jpayne@69 194
jpayne@69 195 #endif