VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_diffutil.h File Reference
Include dependency graph for vlc_diffutil.h:

Go to the source code of this file.

Data Structures

struct  vlc_diffutil_callback_t
 this structure defines callback to access and compare elements from the old and the new list More...
 
struct  vlc_diffutil_snake_callback_t
 
struct  vlc_diffutil_insert
 The data positioned at newModel[ y ] is inserted at position index in the current model. More...
 
struct  vlc_diffutil_remove
 The data positioned at oldModel[ y ] is removed at position index in the current model. More...
 
struct  vlc_diffutil_move
 Moves the data from position model[ from ] to model[ to ] the data is available either at newModel[ y ] or oldModel[ x ]. More...
 
struct  vlc_diffutil_change_t
 represent a change to the model, each change assumes that previous changes have already been applied More...
 
struct  vlc_diffutil_changelist_t
 

Typedefs

typedef struct diffutil_snake_t diffutil_snake_t
 

Enumerations

enum  vlc_diffutil_op_type { VLC_DIFFUTIL_OP_INSERT , VLC_DIFFUTIL_OP_REMOVE , VLC_DIFFUTIL_OP_MOVE , VLC_DIFFUTIL_OP_IGNORE }
 
enum  vlc_diffutil_result_flag { VLC_DIFFUTIL_RESULT_MOVE = 0x1 , VLC_DIFFUTIL_RESULT_AGGREGATE = 0x2 }
 

Functions

struct diffutil_snake_tvlc_diffutil_build_snake (const vlc_diffutil_callback_t *diffOp, const void *dataOld, const void *dataNew)
 vlc_diffutil_build_snake compute a diff model between the dataOld model and the dataNew model.
 
void vlc_diffutil_free_snake (struct diffutil_snake_t *snake)
 free the snake created by vlc_diffutil_build_snake
 
bool vlc_diffutil_walk_snake (const diffutil_snake_t *snake, const vlc_diffutil_snake_callback_t *snakeOp, void *cbData, const vlc_diffutil_callback_t *diffOp, const void *dataOld, const void *dataNew)
 iterate over the changelist and callback user on each operation (keep/insert/remove)
 
vlc_diffutil_changelist_tvlc_diffutil_build_change_list (const struct diffutil_snake_t *snake, const vlc_diffutil_callback_t *diffOp, const void *dataOld, const void *dataNew, int flags)
 vlc_diffutil_build_change_list creates a list of changes to apply to transform dataOld into dataNew
 
void vlc_diffutil_free_change_list (vlc_diffutil_changelist_t *changelist)
 free the changelist created by vlc_diffutil_build_change_list
 

Typedef Documentation

◆ diffutil_snake_t

Enumeration Type Documentation

◆ vlc_diffutil_op_type

Enumerator
VLC_DIFFUTIL_OP_INSERT 

items have been added to the list

VLC_DIFFUTIL_OP_REMOVE 

items have been removed from the list

VLC_DIFFUTIL_OP_MOVE 

items have been moved within the list

VLC_DIFFUTIL_OP_IGNORE 

current change should be ignored

◆ vlc_diffutil_result_flag

Enumerator
VLC_DIFFUTIL_RESULT_MOVE 

try to transform an insertion with a matching suppression into a move operation

VLC_DIFFUTIL_RESULT_AGGREGATE 

aggregate similar consecutive operations into a single operation for instance this: [{INSERT, i=5}{INSERT, x=6}{REMOVE, i=10}{REMOVE, i=10}{REMOVE, i=10}] would be transformed into: [{INSERT, i=5, count=2}{REMOVE, i=10, count=3}]

Function Documentation

◆ vlc_diffutil_build_change_list()

vlc_diffutil_changelist_t * vlc_diffutil_build_change_list ( const struct diffutil_snake_t snake,
const vlc_diffutil_callback_t diffOp,
const void *  dataOld,
const void *  dataNew,
int  flags 
)

vlc_diffutil_build_change_list creates a list of changes to apply to transform dataOld into dataNew

Parameters
snakethe snake created with vlc_diffutil_build_snake
diffOpcallbacks used in vlc_diffutil_build_snake
dataOldold model
dataNewnew model
flagsvlc_diffutil_result_flag flags
Returns
the list of changes, NULL on error

◆ vlc_diffutil_build_snake()

struct diffutil_snake_t * vlc_diffutil_build_snake ( const vlc_diffutil_callback_t diffOp,
const void *  dataOld,
const void *  dataNew 
)

vlc_diffutil_build_snake compute a diff model between the dataOld model and the dataNew model.

This model can be processed manually using vlc_diffutil_walk_snake or translated into a change list using vlc_diffutil_build_change_list

Parameters
diffOpcallback to compare the elements from the old and new model
dataOldold model
dataNewnew model
Returns
the diff model, NULL on error

References diffutil_context_t::backward, diffutil_context_t::dataNew, diffutil_context_t::dataOld, DiffUtilFindPath(), diffutil_context_t::forward, vlc_diffutil_callback_t::getNewSize, vlc_diffutil_callback_t::getOldSize, vlc_diffutil_callback_t::isSame, diffutil_context_t::op, vlc_vector_init, and diffutil_context_t::z.

◆ vlc_diffutil_free_change_list()

void vlc_diffutil_free_change_list ( vlc_diffutil_changelist_t changelist)

free the changelist created by vlc_diffutil_build_change_list

References vlc_vector_destroy.

◆ vlc_diffutil_free_snake()

void vlc_diffutil_free_snake ( struct diffutil_snake_t snake)

free the snake created by vlc_diffutil_build_snake

References vlc_vector_destroy.

◆ vlc_diffutil_walk_snake()

bool vlc_diffutil_walk_snake ( const diffutil_snake_t snake,
const vlc_diffutil_snake_callback_t snakeOp,
void *  cbData,
const vlc_diffutil_callback_t diffOp,
const void *  dataOld,
const void *  dataNew 
)

iterate over the changelist and callback user on each operation (keep/insert/remove)

Parameters
snakethe snake created with vlc_diffutil_build_snake
snakeOpsnake callback
cbDatauser data for snake callbacks
diffOpcallbacks used in vlc_diffutil_build_snake
dataOldold model
dataNewnew model
Returns
false on error
Warning
dataOld and dataNew should not be altered during the operation

References diffutil_snake_t::data, vlc_diffutil_snake_callback_t::equal, vlc_diffutil_snake_callback_t::insert, vlc_diffutil_snake_callback_t::remove, diffutil_snake_t::size, diffutil_snakepoint_t::x, and diffutil_snakepoint_t::y.

Referenced by vlc_diffutil_build_change_list().