Current Path: > > opt > alt > > > libicu > usr > include > unicode
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
alphaindex.h | File | 27055 bytes | November 07 2019 06:58:02. | |
appendable.h | File | 8632 bytes | November 07 2019 06:58:02. | |
basictz.h | File | 9055 bytes | November 07 2019 06:58:02. | |
brkiter.h | File | 28303 bytes | November 07 2019 06:58:02. | |
bytestream.h | File | 9767 bytes | November 07 2019 06:58:02. | |
bytestrie.h | File | 19718 bytes | November 07 2019 06:58:02. | |
bytestriebuilder.h | File | 7186 bytes | November 07 2019 06:58:02. | |
calendar.h | File | 107581 bytes | November 07 2019 06:58:02. | |
caniter.h | File | 7550 bytes | November 07 2019 06:58:02. | |
casemap.h | File | 25871 bytes | November 07 2019 06:58:02. | |
char16ptr.h | File | 7331 bytes | November 07 2019 06:58:02. | |
chariter.h | File | 24573 bytes | November 07 2019 06:58:02. | |
choicfmt.h | File | 24418 bytes | November 07 2019 06:58:02. | |
coleitr.h | File | 14033 bytes | November 07 2019 06:58:02. | |
coll.h | File | 56928 bytes | November 07 2019 06:58:02. | |
compactdecimalformat.h | File | 6971 bytes | November 07 2019 06:58:02. | |
curramt.h | File | 3782 bytes | November 07 2019 06:58:02. | |
currpinf.h | File | 7412 bytes | November 07 2019 06:58:02. | |
currunit.h | File | 4082 bytes | November 07 2019 06:58:02. | |
datefmt.h | File | 41334 bytes | November 07 2019 06:58:02. | |
dbbi.h | File | 1133 bytes | November 07 2019 06:58:02. | |
dcfmtsym.h | File | 20584 bytes | November 07 2019 06:58:02. | |
decimfmt.h | File | 89926 bytes | November 07 2019 06:58:02. | |
docmain.h | File | 7123 bytes | November 07 2019 06:58:02. | |
dtfmtsym.h | File | 38548 bytes | November 07 2019 06:58:02. | |
dtintrv.h | File | 3869 bytes | November 07 2019 06:58:02. | |
dtitvfmt.h | File | 47676 bytes | November 07 2019 06:58:02. | |
dtitvinf.h | File | 18902 bytes | November 07 2019 06:58:02. | |
dtptngen.h | File | 25681 bytes | November 07 2019 06:58:02. | |
dtrule.h | File | 8831 bytes | November 07 2019 06:58:02. | |
edits.h | File | 21169 bytes | November 07 2019 06:58:02. | |
enumset.h | File | 2130 bytes | November 07 2019 06:58:02. | |
errorcode.h | File | 4894 bytes | November 07 2019 06:58:02. | |
fieldpos.h | File | 8838 bytes | November 07 2019 06:58:02. | |
filteredbrk.h | File | 5364 bytes | November 07 2019 06:58:02. | |
fmtable.h | File | 24946 bytes | November 07 2019 06:58:02. | |
format.h | File | 12741 bytes | November 07 2019 06:58:02. | |
formattedvalue.h | File | 9963 bytes | November 07 2019 06:58:02. | |
fpositer.h | File | 3047 bytes | November 07 2019 06:58:02. | |
gender.h | File | 3347 bytes | November 07 2019 06:58:02. | |
gregocal.h | File | 32331 bytes | November 07 2019 06:58:02. | |
icudataver.h | File | 1051 bytes | November 07 2019 06:58:02. | |
icuplug.h | File | 12166 bytes | November 07 2019 06:58:02. | |
idna.h | File | 12938 bytes | November 07 2019 06:58:02. | |
listformatter.h | File | 9644 bytes | November 07 2019 06:58:02. | |
localebuilder.h | File | 10792 bytes | November 07 2019 06:58:02. | |
localpointer.h | File | 20159 bytes | November 07 2019 06:58:02. | |
locdspnm.h | File | 7231 bytes | November 07 2019 06:58:02. | |
locid.h | File | 46015 bytes | November 07 2019 06:58:02. | |
measfmt.h | File | 11710 bytes | November 07 2019 06:58:02. | |
measunit.h | File | 90283 bytes | November 07 2019 06:58:02. | |
measure.h | File | 4361 bytes | November 07 2019 06:58:02. | |
messagepattern.h | File | 34460 bytes | November 07 2019 06:58:02. | |
msgfmt.h | File | 45099 bytes | November 07 2019 06:58:02. | |
normalizer2.h | File | 34789 bytes | November 07 2019 06:58:02. | |
normlzr.h | File | 31476 bytes | November 07 2019 06:58:02. | |
nounit.h | File | 2693 bytes | November 07 2019 06:58:02. | |
numberformatter.h | File | 86654 bytes | November 07 2019 06:58:02. | |
numberrangeformatter.h | File | 30653 bytes | November 07 2019 06:58:02. | |
numfmt.h | File | 50530 bytes | November 07 2019 06:58:02. | |
numsys.h | File | 7303 bytes | November 07 2019 06:58:02. | |
parseerr.h | File | 3155 bytes | November 07 2019 06:58:02. | |
parsepos.h | File | 5630 bytes | November 07 2019 06:58:02. | |
platform.h | File | 27754 bytes | November 07 2019 06:58:02. | |
plurfmt.h | File | 25786 bytes | November 07 2019 06:58:02. | |
plurrule.h | File | 18774 bytes | November 07 2019 06:58:02. | |
ptypes.h | File | 3577 bytes | November 07 2019 06:58:02. | |
putil.h | File | 6487 bytes | November 07 2019 06:58:02. | |
rbbi.h | File | 27053 bytes | November 07 2019 06:58:02. | |
rbnf.h | File | 50984 bytes | November 07 2019 06:58:02. | |
rbtz.h | File | 15838 bytes | November 07 2019 06:58:02. | |
regex.h | File | 86320 bytes | November 07 2019 06:58:02. | |
region.h | File | 9342 bytes | November 07 2019 06:58:02. | |
reldatefmt.h | File | 22910 bytes | November 07 2019 06:58:02. | |
rep.h | File | 9726 bytes | November 07 2019 06:58:02. | |
resbund.h | File | 18440 bytes | November 07 2019 06:58:02. | |
schriter.h | File | 6410 bytes | November 07 2019 06:58:02. | |
scientificnumberformatter.h | File | 6474 bytes | November 07 2019 06:58:02. | |
search.h | File | 22742 bytes | November 07 2019 06:58:02. | |
selfmt.h | File | 14579 bytes | November 07 2019 06:58:02. | |
simpleformatter.h | File | 12826 bytes | November 07 2019 06:58:02. | |
simpletz.h | File | 46389 bytes | November 07 2019 06:58:02. | |
smpdtfmt.h | File | 72597 bytes | November 07 2019 06:58:02. | |
sortkey.h | File | 11383 bytes | November 07 2019 06:58:02. | |
std_string.h | File | 1015 bytes | November 07 2019 06:58:02. | |
strenum.h | File | 10279 bytes | November 07 2019 06:58:02. | |
stringoptions.h | File | 5926 bytes | November 07 2019 06:58:02. | |
stringpiece.h | File | 6610 bytes | November 07 2019 06:58:02. | |
stringtriebuilder.h | File | 15636 bytes | November 07 2019 06:58:02. | |
stsearch.h | File | 21801 bytes | November 07 2019 06:58:02. | |
symtable.h | File | 4312 bytes | November 07 2019 06:58:02. | |
tblcoll.h | File | 37272 bytes | November 07 2019 06:58:02. | |
timezone.h | File | 42189 bytes | November 07 2019 06:58:02. | |
tmunit.h | File | 3371 bytes | November 07 2019 06:58:02. | |
tmutamt.h | File | 4918 bytes | November 07 2019 06:58:02. | |
tmutfmt.h | File | 7977 bytes | November 07 2019 06:58:02. | |
translit.h | File | 67339 bytes | November 07 2019 06:58:02. | |
tzfmt.h | File | 43846 bytes | November 07 2019 06:58:02. | |
tznames.h | File | 17190 bytes | November 07 2019 06:58:02. | |
tzrule.h | File | 36170 bytes | November 07 2019 06:58:02. | |
tztrans.h | File | 6214 bytes | November 07 2019 06:58:02. | |
ubidi.h | File | 91711 bytes | November 07 2019 06:58:02. | |
ubiditransform.h | File | 12950 bytes | November 07 2019 06:58:02. | |
ubrk.h | File | 24547 bytes | November 07 2019 06:58:02. | |
ucal.h | File | 56876 bytes | November 07 2019 06:58:02. | |
ucasemap.h | File | 15546 bytes | November 07 2019 06:58:02. | |
ucat.h | File | 5484 bytes | November 07 2019 06:58:02. | |
uchar.h | File | 144035 bytes | November 07 2019 06:58:02. | |
ucharstrie.h | File | 21569 bytes | November 07 2019 06:58:02. | |
ucharstriebuilder.h | File | 7316 bytes | November 07 2019 06:58:02. | |
uchriter.h | File | 13457 bytes | November 07 2019 06:58:02. | |
uclean.h | File | 11474 bytes | November 07 2019 06:58:02. | |
ucnv.h | File | 85085 bytes | November 07 2019 06:58:02. | |
ucnv_cb.h | File | 6748 bytes | November 07 2019 06:58:02. | |
ucnv_err.h | File | 21492 bytes | November 07 2019 06:58:02. | |
ucnvsel.h | File | 6283 bytes | November 07 2019 06:58:02. | |
ucol.h | File | 62864 bytes | November 07 2019 06:58:02. | |
ucoleitr.h | File | 9684 bytes | November 07 2019 06:58:02. | |
uconfig.h | File | 12338 bytes | November 07 2019 06:58:02. | |
ucpmap.h | File | 5709 bytes | November 07 2019 06:58:02. | |
ucptrie.h | File | 22824 bytes | November 07 2019 06:58:02. | |
ucsdet.h | File | 15018 bytes | November 07 2019 06:58:02. | |
ucurr.h | File | 16536 bytes | November 07 2019 06:58:02. | |
udat.h | File | 62267 bytes | November 07 2019 06:58:02. | |
udata.h | File | 15905 bytes | November 07 2019 06:58:02. | |
udateintervalformat.h | File | 10272 bytes | November 07 2019 06:58:02. | |
udatpg.h | File | 26564 bytes | November 07 2019 06:58:02. | |
udisplaycontext.h | File | 6029 bytes | November 07 2019 06:58:02. | |
uenum.h | File | 7970 bytes | November 07 2019 06:58:02. | |
ufieldpositer.h | File | 4461 bytes | November 07 2019 06:58:02. | |
uformattable.h | File | 11198 bytes | November 07 2019 06:58:02. | |
uformattedvalue.h | File | 12430 bytes | November 07 2019 06:58:02. | |
ugender.h | File | 2052 bytes | November 07 2019 06:58:02. | |
uidna.h | File | 34169 bytes | November 07 2019 06:58:02. | |
uiter.h | File | 23319 bytes | November 07 2019 06:58:02. | |
uldnames.h | File | 10702 bytes | November 07 2019 06:58:02. | |
ulistformatter.h | File | 9043 bytes | November 07 2019 06:58:02. | |
uloc.h | File | 51971 bytes | November 07 2019 06:58:02. | |
ulocdata.h | File | 11533 bytes | November 07 2019 06:58:02. | |
umachine.h | File | 13509 bytes | November 07 2019 06:58:02. | |
umisc.h | File | 1365 bytes | November 07 2019 06:58:02. | |
umsg.h | File | 24812 bytes | November 07 2019 06:58:02. | |
umutablecptrie.h | File | 8477 bytes | November 07 2019 06:58:02. | |
unifilt.h | File | 3716 bytes | November 07 2019 06:58:02. | |
unifunct.h | File | 4079 bytes | November 07 2019 06:58:02. | |
unimatch.h | File | 6184 bytes | November 07 2019 06:58:02. | |
unirepl.h | File | 3403 bytes | November 07 2019 06:58:02. | |
uniset.h | File | 66440 bytes | November 07 2019 06:58:02. | |
unistr.h | File | 174477 bytes | November 07 2019 06:58:02. | |
unorm.h | File | 20938 bytes | November 07 2019 06:58:02. | |
unorm2.h | File | 25254 bytes | November 07 2019 06:58:02. | |
unum.h | File | 54832 bytes | November 07 2019 06:58:02. | |
unumberformatter.h | File | 25795 bytes | November 07 2019 06:58:02. | |
unumsys.h | File | 7387 bytes | November 07 2019 06:58:02. | |
uobject.h | File | 11106 bytes | November 07 2019 06:58:02. | |
upluralrules.h | File | 8068 bytes | November 07 2019 06:58:02. | |
uregex.h | File | 73784 bytes | November 07 2019 06:58:02. | |
uregion.h | File | 10073 bytes | November 07 2019 06:58:02. | |
ureldatefmt.h | File | 17670 bytes | November 07 2019 06:58:02. | |
urename.h | File | 134551 bytes | November 07 2019 06:58:02. | |
urep.h | File | 5507 bytes | November 07 2019 06:58:02. | |
ures.h | File | 37415 bytes | November 07 2019 06:58:02. | |
uscript.h | File | 27510 bytes | November 07 2019 06:58:02. | |
usearch.h | File | 39038 bytes | November 07 2019 06:58:02. | |
uset.h | File | 40958 bytes | November 07 2019 06:58:02. | |
usetiter.h | File | 9719 bytes | November 07 2019 06:58:02. | |
ushape.h | File | 18432 bytes | November 07 2019 06:58:02. | |
uspoof.h | File | 67613 bytes | November 07 2019 06:58:02. | |
usprep.h | File | 8331 bytes | November 07 2019 06:58:02. | |
ustdio.h | File | 39469 bytes | November 07 2019 06:58:02. | |
ustream.h | File | 1844 bytes | November 07 2019 06:58:02. | |
ustring.h | File | 74211 bytes | November 07 2019 06:58:02. | |
ustringtrie.h | File | 3224 bytes | November 07 2019 06:58:02. | |
utext.h | File | 59505 bytes | November 07 2019 06:58:02. | |
utf.h | File | 8046 bytes | November 07 2019 06:58:02. | |
utf16.h | File | 22866 bytes | November 07 2019 06:58:02. | |
utf32.h | File | 763 bytes | November 07 2019 06:58:02. | |
utf8.h | File | 30682 bytes | November 07 2019 06:58:02. | |
utf_old.h | File | 44827 bytes | November 07 2019 06:58:02. | |
utmscale.h | File | 14113 bytes | November 07 2019 06:58:02. | |
utrace.h | File | 14219 bytes | November 07 2019 06:58:02. | |
utrans.h | File | 26157 bytes | November 07 2019 06:58:02. | |
utypes.h | File | 31108 bytes | November 07 2019 06:58:02. | |
uvernum.h | File | 6832 bytes | November 07 2019 06:58:02. | |
uversion.h | File | 6865 bytes | November 07 2019 06:58:02. | |
vtzone.h | File | 20651 bytes | November 07 2019 06:58:02. |
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // edits.h // created: 2016dec30 Markus W. Scherer #ifndef __EDITS_H__ #define __EDITS_H__ #include "unicode/utypes.h" #include "unicode/uobject.h" /** * \file * \brief C++ API: C++ class Edits for low-level string transformations on styled text. */ U_NAMESPACE_BEGIN class UnicodeString; /** * Records lengths of string edits but not replacement text. Supports replacements, insertions, deletions * in linear progression. Does not support moving/reordering of text. * * There are two types of edits: <em>change edits</em> and <em>no-change edits</em>. Add edits to * instances of this class using {@link #addReplace(int32_t, int32_t)} (for change edits) and * {@link #addUnchanged(int32_t)} (for no-change edits). Change edits are retained with full granularity, * whereas adjacent no-change edits are always merged together. In no-change edits, there is a one-to-one * mapping between code points in the source and destination strings. * * After all edits have been added, instances of this class should be considered immutable, and an * {@link Edits::Iterator} can be used for queries. * * There are four flavors of Edits::Iterator: * * <ul> * <li>{@link #getFineIterator()} retains full granularity of change edits. * <li>{@link #getFineChangesIterator()} retains full granularity of change edits, and when calling * next() on the iterator, skips over no-change edits (unchanged regions). * <li>{@link #getCoarseIterator()} treats adjacent change edits as a single edit. (Adjacent no-change * edits are automatically merged during the construction phase.) * <li>{@link #getCoarseChangesIterator()} treats adjacent change edits as a single edit, and when * calling next() on the iterator, skips over no-change edits (unchanged regions). * </ul> * * For example, consider the string "abcßDeF", which case-folds to "abcssdef". This string has the * following fine edits: * <ul> * <li>abc ⇨ abc (no-change) * <li>ß ⇨ ss (change) * <li>D ⇨ d (change) * <li>e ⇨ e (no-change) * <li>F ⇨ f (change) * </ul> * and the following coarse edits (note how adjacent change edits get merged together): * <ul> * <li>abc ⇨ abc (no-change) * <li>ßD ⇨ ssd (change) * <li>e ⇨ e (no-change) * <li>F ⇨ f (change) * </ul> * * The "fine changes" and "coarse changes" iterators will step through only the change edits when their * `Edits::Iterator::next()` methods are called. They are identical to the non-change iterators when * their `Edits::Iterator::findSourceIndex()` or `Edits::Iterator::findDestinationIndex()` * methods are used to walk through the string. * * For examples of how to use this class, see the test `TestCaseMapEditsIteratorDocs` in * UCharacterCaseTest.java. * * An Edits object tracks a separate UErrorCode, but ICU string transformation functions * (e.g., case mapping functions) merge any such errors into their API's UErrorCode. * * @stable ICU 59 */ class U_COMMON_API Edits U_FINAL : public UMemory { public: /** * Constructs an empty object. * @stable ICU 59 */ Edits() : array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0), errorCode_(U_ZERO_ERROR) {} /** * Copy constructor. * @param other source edits * @stable ICU 60 */ Edits(const Edits &other) : array(stackArray), capacity(STACK_CAPACITY), length(other.length), delta(other.delta), numChanges(other.numChanges), errorCode_(other.errorCode_) { copyArray(other); } /** * Move constructor, might leave src empty. * This object will have the same contents that the source object had. * @param src source edits * @stable ICU 60 */ Edits(Edits &&src) U_NOEXCEPT : array(stackArray), capacity(STACK_CAPACITY), length(src.length), delta(src.delta), numChanges(src.numChanges), errorCode_(src.errorCode_) { moveArray(src); } /** * Destructor. * @stable ICU 59 */ ~Edits(); /** * Assignment operator. * @param other source edits * @return *this * @stable ICU 60 */ Edits &operator=(const Edits &other); /** * Move assignment operator, might leave src empty. * This object will have the same contents that the source object had. * The behavior is undefined if *this and src are the same object. * @param src source edits * @return *this * @stable ICU 60 */ Edits &operator=(Edits &&src) U_NOEXCEPT; /** * Resets the data but may not release memory. * @stable ICU 59 */ void reset() U_NOEXCEPT; /** * Adds a no-change edit: a record for an unchanged segment of text. * Normally called from inside ICU string transformation functions, not user code. * @stable ICU 59 */ void addUnchanged(int32_t unchangedLength); /** * Adds a change edit: a record for a text replacement/insertion/deletion. * Normally called from inside ICU string transformation functions, not user code. * @stable ICU 59 */ void addReplace(int32_t oldLength, int32_t newLength); /** * Sets the UErrorCode if an error occurred while recording edits. * Preserves older error codes in the outErrorCode. * Normally called from inside ICU string transformation functions, not user code. * @param outErrorCode Set to an error code if it does not contain one already * and an error occurred while recording edits. * Otherwise unchanged. * @return TRUE if U_FAILURE(outErrorCode) * @stable ICU 59 */ UBool copyErrorTo(UErrorCode &outErrorCode); /** * How much longer is the new text compared with the old text? * @return new length minus old length * @stable ICU 59 */ int32_t lengthDelta() const { return delta; } /** * @return TRUE if there are any change edits * @stable ICU 59 */ UBool hasChanges() const { return numChanges != 0; } /** * @return the number of change edits * @stable ICU 60 */ int32_t numberOfChanges() const { return numChanges; } /** * Access to the list of edits. * * At any moment in time, an instance of this class points to a single edit: a "window" into a span * of the source string and the corresponding span of the destination string. The source string span * starts at {@link #sourceIndex()} and runs for {@link #oldLength()} chars; the destination string * span starts at {@link #destinationIndex()} and runs for {@link #newLength()} chars. * * The iterator can be moved between edits using the `next()`, `findSourceIndex(int32_t, UErrorCode &)`, * and `findDestinationIndex(int32_t, UErrorCode &)` methods. * Calling any of these methods mutates the iterator to make it point to the corresponding edit. * * For more information, see the documentation for {@link Edits}. * * @see getCoarseIterator * @see getFineIterator * @stable ICU 59 */ struct U_COMMON_API Iterator U_FINAL : public UMemory { /** * Default constructor, empty iterator. * @stable ICU 60 */ Iterator() : array(nullptr), index(0), length(0), remaining(0), onlyChanges_(FALSE), coarse(FALSE), dir(0), changed(FALSE), oldLength_(0), newLength_(0), srcIndex(0), replIndex(0), destIndex(0) {} /** * Copy constructor. * @stable ICU 59 */ Iterator(const Iterator &other) = default; /** * Assignment operator. * @stable ICU 59 */ Iterator &operator=(const Iterator &other) = default; /** * Advances the iterator to the next edit. * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return TRUE if there is another edit * @stable ICU 59 */ UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); } /** * Moves the iterator to the edit that contains the source index. * The source index may be found in a no-change edit * even if normal iteration would skip no-change edits. * Normal iteration can continue from a found edit. * * The iterator state before this search logically does not matter. * (It may affect the performance of the search.) * * The iterator state after this search is undefined * if the source index is out of bounds for the source string. * * @param i source index * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return TRUE if the edit for the source index was found * @stable ICU 59 */ UBool findSourceIndex(int32_t i, UErrorCode &errorCode) { return findIndex(i, TRUE, errorCode) == 0; } /** * Moves the iterator to the edit that contains the destination index. * The destination index may be found in a no-change edit * even if normal iteration would skip no-change edits. * Normal iteration can continue from a found edit. * * The iterator state before this search logically does not matter. * (It may affect the performance of the search.) * * The iterator state after this search is undefined * if the source index is out of bounds for the source string. * * @param i destination index * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return TRUE if the edit for the destination index was found * @stable ICU 60 */ UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) { return findIndex(i, FALSE, errorCode) == 0; } /** * Computes the destination index corresponding to the given source index. * If the source index is inside a change edit (not at its start), * then the destination index at the end of that edit is returned, * since there is no information about index mapping inside a change edit. * * (This means that indexes to the start and middle of an edit, * for example around a grapheme cluster, are mapped to indexes * encompassing the entire edit. * The alternative, mapping an interior index to the start, * would map such an interval to an empty one.) * * This operation will usually but not always modify this object. * The iterator state after this search is undefined. * * @param i source index * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return destination index; undefined if i is not 0..string length * @stable ICU 60 */ int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode); /** * Computes the source index corresponding to the given destination index. * If the destination index is inside a change edit (not at its start), * then the source index at the end of that edit is returned, * since there is no information about index mapping inside a change edit. * * (This means that indexes to the start and middle of an edit, * for example around a grapheme cluster, are mapped to indexes * encompassing the entire edit. * The alternative, mapping an interior index to the start, * would map such an interval to an empty one.) * * This operation will usually but not always modify this object. * The iterator state after this search is undefined. * * @param i destination index * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return source index; undefined if i is not 0..string length * @stable ICU 60 */ int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode); /** * Returns whether the edit currently represented by the iterator is a change edit. * * @return TRUE if this edit replaces oldLength() units with newLength() different ones. * FALSE if oldLength units remain unchanged. * @stable ICU 59 */ UBool hasChange() const { return changed; } /** * The length of the current span in the source string, which starts at {@link #sourceIndex}. * * @return the number of units in the original string which are replaced or remain unchanged. * @stable ICU 59 */ int32_t oldLength() const { return oldLength_; } /** * The length of the current span in the destination string, which starts at * {@link #destinationIndex}, or in the replacement string, which starts at * {@link #replacementIndex}. * * @return the number of units in the modified string, if hasChange() is TRUE. * Same as oldLength if hasChange() is FALSE. * @stable ICU 59 */ int32_t newLength() const { return newLength_; } /** * The start index of the current span in the source string; the span has length * {@link #oldLength}. * * @return the current index into the source string * @stable ICU 59 */ int32_t sourceIndex() const { return srcIndex; } /** * The start index of the current span in the replacement string; the span has length * {@link #newLength}. Well-defined only if the current edit is a change edit. * * The *replacement string* is the concatenation of all substrings of the destination * string corresponding to change edits. * * This method is intended to be used together with operations that write only replacement * characters (e.g. operations specifying the \ref U_OMIT_UNCHANGED_TEXT option). * The source string can then be modified in-place. * * @return the current index into the replacement-characters-only string, * not counting unchanged spans * @stable ICU 59 */ int32_t replacementIndex() const { // TODO: Throw an exception if we aren't in a change edit? return replIndex; } /** * The start index of the current span in the destination string; the span has length * {@link #newLength}. * * @return the current index into the full destination string * @stable ICU 59 */ int32_t destinationIndex() const { return destIndex; } #ifndef U_HIDE_INTERNAL_API /** * A string representation of the current edit represented by the iterator for debugging. You * should not depend on the contents of the return string. * @internal */ UnicodeString& toString(UnicodeString& appendTo) const; #endif // U_HIDE_INTERNAL_API private: friend class Edits; Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs); int32_t readLength(int32_t head); void updateNextIndexes(); void updatePreviousIndexes(); UBool noNext(); UBool next(UBool onlyChanges, UErrorCode &errorCode); UBool previous(UErrorCode &errorCode); /** @return -1: error or i<0; 0: found; 1: i>=string length */ int32_t findIndex(int32_t i, UBool findSource, UErrorCode &errorCode); const uint16_t *array; int32_t index, length; // 0 if we are not within compressed equal-length changes. // Otherwise the number of remaining changes, including the current one. int32_t remaining; UBool onlyChanges_, coarse; int8_t dir; // iteration direction: back(<0), initial(0), forward(>0) UBool changed; int32_t oldLength_, newLength_; int32_t srcIndex, replIndex, destIndex; }; /** * Returns an Iterator for coarse-grained change edits * (adjacent change edits are treated as one). * Can be used to perform simple string updates. * Skips no-change edits. * @return an Iterator that merges adjacent changes. * @stable ICU 59 */ Iterator getCoarseChangesIterator() const { return Iterator(array, length, TRUE, TRUE); } /** * Returns an Iterator for coarse-grained change and no-change edits * (adjacent change edits are treated as one). * Can be used to perform simple string updates. * Adjacent change edits are treated as one edit. * @return an Iterator that merges adjacent changes. * @stable ICU 59 */ Iterator getCoarseIterator() const { return Iterator(array, length, FALSE, TRUE); } /** * Returns an Iterator for fine-grained change edits * (full granularity of change edits is retained). * Can be used for modifying styled text. * Skips no-change edits. * @return an Iterator that separates adjacent changes. * @stable ICU 59 */ Iterator getFineChangesIterator() const { return Iterator(array, length, TRUE, FALSE); } /** * Returns an Iterator for fine-grained change and no-change edits * (full granularity of change edits is retained). * Can be used for modifying styled text. * @return an Iterator that separates adjacent changes. * @stable ICU 59 */ Iterator getFineIterator() const { return Iterator(array, length, FALSE, FALSE); } /** * Merges the two input Edits and appends the result to this object. * * Consider two string transformations (for example, normalization and case mapping) * where each records Edits in addition to writing an output string.<br> * Edits ab reflect how substrings of input string a * map to substrings of intermediate string b.<br> * Edits bc reflect how substrings of intermediate string b * map to substrings of output string c.<br> * This function merges ab and bc such that the additional edits * recorded in this object reflect how substrings of input string a * map to substrings of output string c. * * If unrelated Edits are passed in where the output string of the first * has a different length than the input string of the second, * then a U_ILLEGAL_ARGUMENT_ERROR is reported. * * @param ab reflects how substrings of input string a * map to substrings of intermediate string b. * @param bc reflects how substrings of intermediate string b * map to substrings of output string c. * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return *this, with the merged edits appended * @stable ICU 60 */ Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode); private: void releaseArray() U_NOEXCEPT; Edits ©Array(const Edits &other); Edits &moveArray(Edits &src) U_NOEXCEPT; void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; } int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; } void append(int32_t r); UBool growArray(); static const int32_t STACK_CAPACITY = 100; uint16_t *array; int32_t capacity; int32_t length; int32_t delta; int32_t numChanges; UErrorCode errorCode_; uint16_t stackArray[STACK_CAPACITY]; }; U_NAMESPACE_END #endif // __EDITS_H__
SILENT KILLER Tool