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: change edits and no-change edits. Add edits to instances of this class using addReplace(int32_t, int32_t) (for change edits) and 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 Edits::Iterator can be used for queries.
There are four flavors of Edits::Iterator:
For example, consider the string "abcßDeF", which case-folds to "abcssdef". This string has the following fine edits:
and the following coarse edits (note how adjacent change edits get merged together):
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.
Definition at line 80 of file edits.h.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4