ICU 59.1  59.1
Data Structures | Public Member Functions
icu::Edits Class Referencefinal

Records lengths of string edits but not replacement text. More...

#include <edits.h>

Inheritance diagram for icu::Edits:
icu::UMemory

Data Structures

struct  Iterator
 Access to the list of edits. More...
 

Public Member Functions

 Edits ()
 Constructs an empty object. More...
 
 ~Edits ()
 Destructor. More...
 
void reset ()
 Resets the data but may not release memory. More...
 
void addUnchanged (int32_t unchangedLength)
 Adds a record for an unchanged segment of text. More...
 
void addReplace (int32_t oldLength, int32_t newLength)
 Adds a record for a text replacement/insertion/deletion. More...
 
UBool copyErrorTo (UErrorCode &outErrorCode)
 Sets the UErrorCode if an error occurred while recording edits. More...
 
int32_t lengthDelta () const
 How much longer is the new text compared with the old text? More...
 
UBool hasChanges () const
 
Iterator getCoarseChangesIterator () const
 Returns an Iterator for coarse-grained changes for simple string updates. More...
 
Iterator getCoarseIterator () const
 Returns an Iterator for coarse-grained changes and non-changes for simple string updates. More...
 
Iterator getFineChangesIterator () const
 Returns an Iterator for fine-grained changes for modifying styled text. More...
 
Iterator getFineIterator () const
 Returns an Iterator for fine-grained changes and non-changes for modifying styled text. More...
 

Detailed Description

Records lengths of string edits but not replacement text.

Supports replacements, insertions, deletions in linear progression. Does not support moving/reordering of text.

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.

Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 32 of file edits.h.

Constructor & Destructor Documentation

§ Edits()

icu::Edits::Edits ( )
inline

Constructs an empty object.

Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 38 of file edits.h.

§ ~Edits()

icu::Edits::~Edits ( )

Destructor.

Draft:
This API may be changed in the future versions and was introduced in ICU 59

Member Function Documentation

§ addReplace()

void icu::Edits::addReplace ( int32_t  oldLength,
int32_t  newLength 
)

Adds a record for a text replacement/insertion/deletion.

Normally called from inside ICU string transformation functions, not user code.

Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ addUnchanged()

void icu::Edits::addUnchanged ( int32_t  unchangedLength)

Adds a record for an unchanged segment of text.

Normally called from inside ICU string transformation functions, not user code.

Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ copyErrorTo()

UBool icu::Edits::copyErrorTo ( UErrorCode outErrorCode)

Sets the UErrorCode if an error occurred while recording edits.

Preserves older error codes in the outErrorCode. Normally called from inside ICU string transformation functions, not user code.

Returns
TRUE if U_FAILURE(outErrorCode)
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ getCoarseChangesIterator()

Iterator icu::Edits::getCoarseChangesIterator ( ) const
inline

Returns an Iterator for coarse-grained changes for simple string updates.

Skips non-changes.

Returns
an Iterator that merges adjacent changes.
Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 190 of file edits.h.

References TRUE.

§ getCoarseIterator()

Iterator icu::Edits::getCoarseIterator ( ) const
inline

Returns an Iterator for coarse-grained changes and non-changes for simple string updates.

Returns
an Iterator that merges adjacent changes.
Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 199 of file edits.h.

References FALSE, and TRUE.

§ getFineChangesIterator()

Iterator icu::Edits::getFineChangesIterator ( ) const
inline

Returns an Iterator for fine-grained changes for modifying styled text.

Skips non-changes.

Returns
an Iterator that separates adjacent changes.
Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 209 of file edits.h.

References FALSE, and TRUE.

§ getFineIterator()

Iterator icu::Edits::getFineIterator ( ) const
inline

Returns an Iterator for fine-grained changes and non-changes for modifying styled text.

Returns
an Iterator that separates adjacent changes.
Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 218 of file edits.h.

References FALSE.

§ hasChanges()

UBool icu::Edits::hasChanges ( ) const
Returns
TRUE if there are any change edits
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ lengthDelta()

int32_t icu::Edits::lengthDelta ( ) const
inline

How much longer is the new text compared with the old text?

Returns
new length minus old length
Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 79 of file edits.h.

§ reset()

void icu::Edits::reset ( )

Resets the data but may not release memory.

Draft:
This API may be changed in the future versions and was introduced in ICU 59

The documentation for this class was generated from the following file: