JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::TextDiff Class Reference

Calculates and applies a sequence of changes to convert one text string into another. More...

#include <juce_TextDiff.h>

Collaboration diagram for juce::TextDiff:

Classes

struct  Change
 Describes a change, which can be either an insertion or deletion. More...
 

Public Member Functions

 TextDiff (const String &original, const String &target)
 Creates a set of diffs for converting the original string into the target. More...
 
String appliedTo (String text) const
 Applies this sequence of changes to the original string, producing the target string that was specified when generating them. More...
 

Public Attributes

Array< Changechanges
 The list of changes required to perform the transformation. More...
 

Detailed Description

Calculates and applies a sequence of changes to convert one text string into another.

Once created, the TextDiff object contains an array of change objects, where each change can be either an insertion or a deletion. When applied in order to the original string, these changes will convert it to the target string.

{Core}

Constructor & Destructor Documentation

◆ TextDiff()

juce::TextDiff::TextDiff ( const String original,
const String target 
)

Creates a set of diffs for converting the original string into the target.

Member Function Documentation

◆ appliedTo()

String juce::TextDiff::appliedTo ( String  text) const

Applies this sequence of changes to the original string, producing the target string that was specified when generating them.

Obviously it only makes sense to call this function with the string that was originally passed to the constructor. Any other input will produce an undefined result.

Member Data Documentation

◆ changes

Array<Change> juce::TextDiff::changes

The list of changes required to perform the transformation.

Applying each of these, in order, to the original string will produce the target.


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