84 array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0),
92 array(stackArray), capacity(STACK_CAPACITY), length(other.length),
93 delta(other.delta), numChanges(other.numChanges),
94 errorCode_(other.errorCode_) {
104 array(stackArray), capacity(STACK_CAPACITY), length(src.length),
105 delta(src.delta), numChanges(src.numChanges),
106 errorCode_(src.errorCode_) {
145 void addUnchanged(int32_t unchangedLength);
151 void addReplace(int32_t oldLength, int32_t newLength);
169 int32_t lengthDelta()
const {
return delta; }
176#ifndef U_HIDE_DRAFT_API
208 array(nullptr), index(0), length(0),
209 remaining(0), onlyChanges_(
FALSE), coarse(
FALSE),
210 dir(0), changed(
FALSE), oldLength_(0), newLength_(0),
211 srcIndex(0), replIndex(0), destIndex(0) {}
253 return findIndex(i,
TRUE, errorCode) == 0;
256#ifndef U_HIDE_DRAFT_API
277 return findIndex(i,
FALSE, errorCode) == 0;
395#ifndef U_HIDE_INTERNAL_API
409 int32_t readLength(int32_t head);
410 void updateNextIndexes();
411 void updatePreviousIndexes();
418 const uint16_t *array;
419 int32_t index, length;
423 UBool onlyChanges_, coarse;
427 int32_t oldLength_, newLength_;
428 int32_t srcIndex, replIndex, destIndex;
478#ifndef U_HIDE_DRAFT_API
510 void releaseArray() U_NOEXCEPT;
514 void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; }
515 int32_t lastUnit()
const {
return length > 0 ? array[length - 1] : 0xffff; }
517 void append(int32_t r);
520 static const int32_t STACK_CAPACITY = 100;
527 uint16_t stackArray[STACK_CAPACITY];
Records lengths of string edits but not replacement text.
Iterator getFineIterator() const
Returns an Iterator for fine-grained change and no-change edits (full granularity of change edits is ...
Edits(const Edits &other)
Copy constructor.
Edits(Edits &&src)
Move constructor, might leave src empty.
void reset()
Resets the data but may not release memory.
Edits & mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode)
Merges the two input Edits and appends the result to this object.
Iterator getCoarseChangesIterator() const
Returns an Iterator for coarse-grained change edits (adjacent change edits are treated as one).
Edits()
Constructs an empty object.
Iterator getCoarseIterator() const
Returns an Iterator for coarse-grained change and no-change edits (adjacent change edits are treated ...
Iterator getFineChangesIterator() const
Returns an Iterator for fine-grained change edits (full granularity of change edits is retained).
int32_t numberOfChanges() const
Edits & operator=(Edits &&src)
Move assignment operator, might leave src empty.
Edits & operator=(const Edits &other)
Assignment operator.
UMemory is the common ICU base class.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Access to the list of edits.
int32_t destinationIndex() const
The start index of the current span in the destination string; the span has length newLength.
UBool findDestinationIndex(int32_t i, UErrorCode &errorCode)
Moves the iterator to the edit that contains the destination index.
Iterator(const Iterator &other)=default
Copy constructor.
Iterator & operator=(const Iterator &other)=default
Assignment operator.
UnicodeString & toString(UnicodeString &appendTo) const
A string representation of the current edit represented by the iterator for debugging.
int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode)
Computes the destination index corresponding to the given source index.
int32_t newLength() const
The length of the current span in the destination string, which starts at destinationIndex,...
int32_t sourceIndex() const
The start index of the current span in the source string; the span has length oldLength.
UBool next(UErrorCode &errorCode)
Advances the iterator to the next edit.
int32_t oldLength() const
The length of the current span in the source string, which starts at sourceIndex.
Iterator()
Default constructor, empty iterator.
UBool findSourceIndex(int32_t i, UErrorCode &errorCode)
Moves the iterator to the edit that contains the source index.
int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode)
Computes the source index corresponding to the given destination index.
UBool hasChange() const
Returns whether the edit currently represented by the iterator is a change edit.
int32_t replacementIndex() const
The start index of the current span in the replacement string; the span has length newLength.
int8_t UBool
The ICU boolean type.
#define TRUE
The TRUE value of a UBool.
#define FALSE
The FALSE value of a UBool.
C++ API: Common ICU base class UObject.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
@ U_ZERO_ERROR
No error, no warning.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.