|
||||
Warning, file /include/unicode/schriter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // © 2016 and later: Unicode, Inc. and others. 0002 // License & terms of use: http://www.unicode.org/copyright.html 0003 /* 0004 ****************************************************************************** 0005 * 0006 * Copyright (C) 1998-2005, International Business Machines 0007 * Corporation and others. All Rights Reserved. 0008 * 0009 ****************************************************************************** 0010 * 0011 * File schriter.h 0012 * 0013 * Modification History: 0014 * 0015 * Date Name Description 0016 * 05/05/99 stephen Cleaned up. 0017 ****************************************************************************** 0018 */ 0019 0020 #ifndef SCHRITER_H 0021 #define SCHRITER_H 0022 0023 #include "unicode/utypes.h" 0024 0025 #if U_SHOW_CPLUSPLUS_API 0026 0027 #include "unicode/chariter.h" 0028 #include "unicode/uchriter.h" 0029 0030 /** 0031 * \file 0032 * \brief C++ API: String Character Iterator 0033 */ 0034 0035 U_NAMESPACE_BEGIN 0036 /** 0037 * A concrete subclass of CharacterIterator that iterates over the 0038 * characters (code units or code points) in a UnicodeString. 0039 * It's possible not only to create an 0040 * iterator that iterates over an entire UnicodeString, but also to 0041 * create one that iterates over only a subrange of a UnicodeString 0042 * (iterators over different subranges of the same UnicodeString don't 0043 * compare equal). 0044 * @see CharacterIterator 0045 * @see ForwardCharacterIterator 0046 * @stable ICU 2.0 0047 */ 0048 class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { 0049 public: 0050 /** 0051 * Create an iterator over the UnicodeString referred to by "textStr". 0052 * The UnicodeString object is copied. 0053 * The iteration range is the whole string, and the starting position is 0. 0054 * @param textStr The unicode string used to create an iterator 0055 * @stable ICU 2.0 0056 */ 0057 StringCharacterIterator(const UnicodeString& textStr); 0058 0059 /** 0060 * Create an iterator over the UnicodeString referred to by "textStr". 0061 * The iteration range is the whole string, and the starting 0062 * position is specified by "textPos". If "textPos" is outside the valid 0063 * iteration range, the behavior of this object is undefined. 0064 * @param textStr The unicode string used to create an iterator 0065 * @param textPos The starting position of the iteration 0066 * @stable ICU 2.0 0067 */ 0068 StringCharacterIterator(const UnicodeString& textStr, 0069 int32_t textPos); 0070 0071 /** 0072 * Create an iterator over the UnicodeString referred to by "textStr". 0073 * The UnicodeString object is copied. 0074 * The iteration range begins with the code unit specified by 0075 * "textBegin" and ends with the code unit BEFORE the code unit specified 0076 * by "textEnd". The starting position is specified by "textPos". If 0077 * "textBegin" and "textEnd" don't form a valid range on "text" (i.e., 0078 * textBegin >= textEnd or either is negative or greater than text.size()), 0079 * or "textPos" is outside the range defined by "textBegin" and "textEnd", 0080 * the behavior of this iterator is undefined. 0081 * @param textStr The unicode string used to create the StringCharacterIterator 0082 * @param textBegin The begin position of the iteration range 0083 * @param textEnd The end position of the iteration range 0084 * @param textPos The starting position of the iteration 0085 * @stable ICU 2.0 0086 */ 0087 StringCharacterIterator(const UnicodeString& textStr, 0088 int32_t textBegin, 0089 int32_t textEnd, 0090 int32_t textPos); 0091 0092 /** 0093 * Copy constructor. The new iterator iterates over the same range 0094 * of the same string as "that", and its initial position is the 0095 * same as "that"'s current position. 0096 * The UnicodeString object in "that" is copied. 0097 * @param that The StringCharacterIterator to be copied 0098 * @stable ICU 2.0 0099 */ 0100 StringCharacterIterator(const StringCharacterIterator& that); 0101 0102 /** 0103 * Destructor. 0104 * @stable ICU 2.0 0105 */ 0106 virtual ~StringCharacterIterator(); 0107 0108 /** 0109 * Assignment operator. *this is altered to iterate over the same 0110 * range of the same string as "that", and refers to the same 0111 * character within that string as "that" does. 0112 * @param that The object to be copied. 0113 * @return the newly created object. 0114 * @stable ICU 2.0 0115 */ 0116 StringCharacterIterator& 0117 operator=(const StringCharacterIterator& that); 0118 0119 /** 0120 * Returns true if the iterators iterate over the same range of the 0121 * same string and are pointing at the same character. 0122 * @param that The ForwardCharacterIterator to be compared for equality 0123 * @return true if the iterators iterate over the same range of the 0124 * same string and are pointing at the same character. 0125 * @stable ICU 2.0 0126 */ 0127 virtual bool operator==(const ForwardCharacterIterator& that) const override; 0128 0129 /** 0130 * Returns a new StringCharacterIterator referring to the same 0131 * character in the same range of the same string as this one. The 0132 * caller must delete the new iterator. 0133 * @return the newly cloned object. 0134 * @stable ICU 2.0 0135 */ 0136 virtual StringCharacterIterator* clone() const override; 0137 0138 /** 0139 * Sets the iterator to iterate over the provided string. 0140 * @param newText The string to be iterated over 0141 * @stable ICU 2.0 0142 */ 0143 void setText(const UnicodeString& newText); 0144 0145 /** 0146 * Copies the UnicodeString under iteration into the UnicodeString 0147 * referred to by "result". Even if this iterator iterates across 0148 * only a part of this string, the whole string is copied. 0149 * @param result Receives a copy of the text under iteration. 0150 * @stable ICU 2.0 0151 */ 0152 virtual void getText(UnicodeString& result) override; 0153 0154 /** 0155 * Return a class ID for this object (not really public) 0156 * @return a class ID for this object. 0157 * @stable ICU 2.0 0158 */ 0159 virtual UClassID getDynamicClassID(void) const override; 0160 0161 /** 0162 * Return a class ID for this class (not really public) 0163 * @return a class ID for this class 0164 * @stable ICU 2.0 0165 */ 0166 static UClassID U_EXPORT2 getStaticClassID(void); 0167 0168 protected: 0169 /** 0170 * Default constructor, iteration over empty string. 0171 * @stable ICU 2.0 0172 */ 0173 StringCharacterIterator(); 0174 0175 /** 0176 * Copy of the iterated string object. 0177 * @stable ICU 2.0 0178 */ 0179 UnicodeString text; 0180 0181 }; 0182 0183 U_NAMESPACE_END 0184 0185 #endif /* U_SHOW_CPLUSPLUS_API */ 0186 0187 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |