20 #ifndef U_HIDE_DRAFT_API 39 array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0),
47 array(stackArray), capacity(STACK_CAPACITY), length(other.length),
48 delta(other.delta), numChanges(other.numChanges),
49 errorCode_(other.errorCode_) {
59 array(stackArray), capacity(STACK_CAPACITY), length(src.length),
60 delta(src.delta), numChanges(src.numChanges),
61 errorCode_(src.errorCode_) {
93 void reset() U_NOEXCEPT;
100 void addUnchanged(int32_t unchangedLength);
106 void addReplace(int32_t oldLength, int32_t newLength);
124 int32_t lengthDelta()
const {
return delta; }
149 array(nullptr), index(0), length(0),
150 remaining(0), onlyChanges_(
FALSE), coarse(
FALSE),
151 dir(0), changed(
FALSE), oldLength_(0), newLength_(0),
152 srcIndex(0), replIndex(0), destIndex(0) {}
194 return findIndex(i,
TRUE, errorCode) == 0;
217 return findIndex(i,
FALSE, errorCode) == 0;
242 int32_t destinationIndexFromSourceIndex(int32_t i,
UErrorCode &errorCode);
266 int32_t sourceIndexFromDestinationIndex(int32_t i,
UErrorCode &errorCode);
308 int32_t readLength(int32_t head);
309 void updateNextIndexes();
310 void updatePreviousIndexes();
317 const uint16_t *array;
318 int32_t index, length;
322 UBool onlyChanges_, coarse;
326 int32_t oldLength_, newLength_;
327 int32_t srcIndex, replIndex, destIndex;
398 void releaseArray() U_NOEXCEPT;
402 void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; }
403 int32_t lastUnit()
const {
return length > 0 ? array[length - 1] : 0xffff; }
405 void append(int32_t r);
408 static const int32_t STACK_CAPACITY = 100;
415 uint16_t stackArray[STACK_CAPACITY];
418 #endif // U_HIDE_DRAFT_API 422 #endif // __EDITS_H__ int32_t oldLength() const
UBool findSourceIndex(int32_t i, UErrorCode &errorCode)
Finds the edit that contains the source index.
Iterator getFineChangesIterator() const
Returns an Iterator for fine-grained changes for modifying styled text.
Access to the list of edits.
Iterator getCoarseIterator() const
Returns an Iterator for coarse-grained changes and non-changes for simple string updates.
Iterator getCoarseChangesIterator() const
Returns an Iterator for coarse-grained changes for simple string updates.
int32_t newLength() const
Records lengths of string edits but not replacement text.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
int32_t sourceIndex() const
Edits(Edits &&src)
Move constructor, might leave src empty.
int32_t replacementIndex() const
int32_t destinationIndex() const
#define TRUE
The TRUE value of a UBool.
C++ API: Common ICU base class UObject.
Iterator getFineIterator() const
Returns an Iterator for fine-grained changes and non-changes for modifying styled text...
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Edits(const Edits &other)
Copy constructor.
Iterator()
Default constructor, empty iterator.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
UBool findDestinationIndex(int32_t i, UErrorCode &errorCode)
Finds the edit that contains the destination index.
Basic definitions for ICU, for both C and C++ APIs.
Edits()
Constructs an empty object.
#define FALSE
The FALSE value of a UBool.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
int32_t numberOfChanges() const
UBool next(UErrorCode &errorCode)
Advances to the next edit.
UMemory is the common ICU base class.
int8_t UBool
The ICU boolean type.