12 #if U_SHOW_CPLUSPLUS_API
87 array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0),
95 array(stackArray), capacity(STACK_CAPACITY), length(other.length),
96 delta(other.delta), numChanges(other.numChanges),
97 errorCode_(other.errorCode_) {
107 array(stackArray), capacity(STACK_CAPACITY), length(src.length),
108 delta(src.delta), numChanges(src.numChanges),
109 errorCode_(src.errorCode_) {
141 void reset() U_NOEXCEPT;
148 void addUnchanged(int32_t unchangedLength);
154 void addReplace(int32_t oldLength, int32_t newLength);
172 int32_t lengthDelta()
const {
return delta; }
209 array(nullptr), index(0), length(0),
210 remaining(0), onlyChanges_(false), coarse(false),
211 dir(0), changed(false), oldLength_(0), newLength_(0),
212 srcIndex(0), replIndex(0), destIndex(0) {}
254 return findIndex(i,
true, errorCode) == 0;
277 return findIndex(i,
false, errorCode) == 0;
302 int32_t destinationIndexFromSourceIndex(int32_t i,
UErrorCode &errorCode);
326 int32_t sourceIndexFromDestinationIndex(int32_t i,
UErrorCode &errorCode);
394 #ifndef U_HIDE_INTERNAL_API
401 #endif // U_HIDE_INTERNAL_API
408 int32_t readLength(int32_t head);
409 void updateNextIndexes();
410 void updatePreviousIndexes();
417 const uint16_t *array;
418 int32_t index, length;
422 UBool onlyChanges_, coarse;
426 int32_t oldLength_, newLength_;
427 int32_t srcIndex, replIndex, destIndex;
439 return Iterator(array, length,
true,
true);
451 return Iterator(array, length,
false,
true);
463 return Iterator(array, length,
true,
false);
474 return Iterator(array, length,
false,
false);
511 void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; }
512 int32_t lastUnit()
const {
return length > 0 ? array[length - 1] : 0xffff; }
514 void append(int32_t r);
517 static const int32_t STACK_CAPACITY = 100;
524 uint16_t stackArray[STACK_CAPACITY];
531 #endif // __EDITS_H__
Iterator getCoarseChangesIterator() const
Returns an Iterator for coarse-grained change edits (adjacent change edits are treated as one)...
int32_t replacementIndex() const
The start index of the current span in the replacement string; the span has length newLength...
UBool findSourceIndex(int32_t i, UErrorCode &errorCode)
Moves the iterator to the edit that contains the source index.
int32_t newLength() const
The length of the current span in the destination string, which starts at destinationIndex, or in the replacement string, which starts at replacementIndex.
Access to the list of edits.
int32_t sourceIndex() const
The start index of the current span in the source string; the span has length oldLength.
int32_t oldLength() const
The length of the current span in the source string, which starts at sourceIndex. ...
Iterator getFineChangesIterator() const
Returns an Iterator for fine-grained change edits (full granularity of change edits is retained)...
int32_t numberOfChanges() const
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(Edits &&src) U_NOEXCEPT
Move constructor, might leave src empty.
C++ API: Common ICU base class UObject.
Edits(const Edits &other)
Copy constructor.
Iterator()
Default constructor, empty iterator.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
UBool hasChange() const
Returns whether the edit currently represented by the iterator is a change edit.
UBool findDestinationIndex(int32_t i, UErrorCode &errorCode)
Moves the iterator to the edit that contains the destination index.
#define U_FINAL
Defined to the C++11 "final" keyword if available.
int32_t destinationIndex() const
The start index of the current span in the destination string; the span has length newLength...
Basic definitions for ICU, for both C and C++ APIs.
Edits()
Constructs an empty object.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Iterator getCoarseIterator() const
Returns an Iterator for coarse-grained change and no-change edits (adjacent change edits are treated ...
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
UBool next(UErrorCode &errorCode)
Advances the iterator to the next edit.
UMemory is the common ICU base class.
int8_t UBool
The ICU boolean type, a signed-byte integer.