Access to the list of edits.
More...
#include <edits.h>
Access to the list of edits.
- See also
- getCoarseIterator
-
getFineIterator
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 143 of file edits.h.
◆ Iterator() [1/2]
icu::Edits::Iterator::Iterator |
( |
| ) |
|
|
inline |
Default constructor, empty iterator.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 60
Definition at line 148 of file edits.h.
◆ Iterator() [2/2]
icu::Edits::Iterator::Iterator |
( |
const Iterator & |
other | ) |
|
|
default |
Copy constructor.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
◆ destinationIndex()
int32_t icu::Edits::Iterator::destinationIndex |
( |
| ) |
const |
|
inline |
- Returns
- the current index into the full destination string
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 301 of file edits.h.
◆ destinationIndexFromSourceIndex()
int32_t icu::Edits::Iterator::destinationIndexFromSourceIndex |
( |
int32_t |
i, |
|
|
UErrorCode & |
errorCode |
|
) |
| |
Returns 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.
- Parameters
-
i | source index |
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.) |
- Returns
- destination index; undefined if i is not 0..string length
- Draft:
- This API may be changed in the future versions and was introduced in ICU 60
◆ findDestinationIndex()
UBool icu::Edits::Iterator::findDestinationIndex |
( |
int32_t |
i, |
|
|
UErrorCode & |
errorCode |
|
) |
| |
|
inline |
Finds the edit that contains the destination index.
The destination index may be found in a non-change even if normal iteration would skip non-changes. 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.
- Parameters
-
i | destination index |
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.) |
- Returns
- TRUE if the edit for the destination index was found
- Draft:
- This API may be changed in the future versions and was introduced in ICU 60
Definition at line 216 of file edits.h.
References FALSE.
◆ findSourceIndex()
UBool icu::Edits::Iterator::findSourceIndex |
( |
int32_t |
i, |
|
|
UErrorCode & |
errorCode |
|
) |
| |
|
inline |
Finds the edit that contains the source index.
The source index may be found in a non-change even if normal iteration would skip non-changes. 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.
- Parameters
-
i | source index |
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.) |
- Returns
- TRUE if the edit for the source index was found
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 193 of file edits.h.
References TRUE.
◆ hasChange()
UBool icu::Edits::Iterator::hasChange |
( |
| ) |
const |
|
inline |
- Returns
- TRUE if this edit replaces oldLength() units with newLength() different ones. FALSE if oldLength units remain unchanged.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 273 of file edits.h.
◆ newLength()
int32_t icu::Edits::Iterator::newLength |
( |
| ) |
const |
|
inline |
- Returns
- the number of units in the modified string, if hasChange() is TRUE. Same as oldLength if hasChange() is FALSE.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 284 of file edits.h.
◆ next()
Advances to the next edit.
- Parameters
-
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.) |
- Returns
- TRUE if there is another edit
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 172 of file edits.h.
References next().
Referenced by next().
◆ oldLength()
int32_t icu::Edits::Iterator::oldLength |
( |
| ) |
const |
|
inline |
- Returns
- the number of units in the original string which are replaced or remain unchanged.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 278 of file edits.h.
◆ operator=()
Assignment operator.
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
◆ replacementIndex()
int32_t icu::Edits::Iterator::replacementIndex |
( |
| ) |
const |
|
inline |
- Returns
- the current index into the replacement-characters-only string, not counting unchanged spans
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 296 of file edits.h.
◆ sourceIndex()
int32_t icu::Edits::Iterator::sourceIndex |
( |
| ) |
const |
|
inline |
- Returns
- the current index into the source string
- Draft:
- This API may be changed in the future versions and was introduced in ICU 59
Definition at line 290 of file edits.h.
◆ sourceIndexFromDestinationIndex()
int32_t icu::Edits::Iterator::sourceIndexFromDestinationIndex |
( |
int32_t |
i, |
|
|
UErrorCode & |
errorCode |
|
) |
| |
Returns 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.
- Parameters
-
i | destination index |
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.) |
- Returns
- source index; undefined if i is not 0..string length
- Draft:
- This API may be changed in the future versions and was introduced in ICU 60
The documentation for this struct was generated from the following file: