wex v26.04.0
wex::unified_diffs Class Reference

Offers a class that collects unified diff invocations to be able to iterate through the differences, show them on the stc component, or checkout a difference. More...

#include <wex/factory/unified-diffs.h>

Public Member Functions

 unified_diffs (factory::stc *s)
 Constructor, provide stc.
bool checkout (size_t line)
 Checks out the difference on specified line.
void clear ()
 Clears all differences, reset iterator.
bool end ()
 Goto last diff line on stc.
bool finish (const factory::unified_diff *diff)
 Finishes diff: the diff should already be inserted, and is now overwritten by the new diff.
bool first ()
 Goto first diff line on stc.
void insert (const factory::unified_diff *diff)
 Inserts a unified diff.
bool next ()
 Goto next diff line on stc.
size_t pos () const
 Returns position of iterator in the collection.
bool prev ()
 Goto previous diff line on stc.
size_t size () const
 Returns number of differences present.
void status () const
 Shows status message.

Detailed Description

Offers a class that collects unified diff invocations to be able to iterate through the differences, show them on the stc component, or checkout a difference.

For each single diff the insert should be called, and after the last one finish should be called.

Member Function Documentation

◆ checkout()

bool wex::unified_diffs::checkout ( size_t line)

Checks out the difference on specified line.

It reverts the changes on that line, and removes key from the container, and resets the iterator to begin.

◆ next()

bool wex::unified_diffs::next ( )

Goto next diff line on stc.

If at end (we are not on the last of all differences), goes to the next stc. If on first position of stc, goes to first diff line.

◆ pos()

size_t wex::unified_diffs::pos ( ) const

Returns position of iterator in the collection.

The first element has number 1, 0 is returned if no differences are present.

◆ prev()

bool wex::unified_diffs::prev ( )

Goto previous diff line on stc.

If at begin, goes to previous stc. If on last position of stc, goes to last diff line.