XOOPS API 2.5.11 Beta1  UI v0.5
Réalisé par monxoops.fr
Référence de la classe HTMLPurifier_Zipper

Fonctions membres publiques

 __construct ($front, $back)
 
 toArray ($t=NULL)
 
 next ($t)
 
 advance ($t, $n)
 
 prev ($t)
 
 delete ()
 
 done ()
 
 insertBefore ($t)
 
 insertAfter ($t)
 
 splice ($t, $delete, $replacement)
 

Fonctions membres publiques statiques

static fromArray ($array)
 

Champs de données

 $front
 
 $back
 

Description détaillée

A zipper is a purely-functional data structure which contains a focus that can be efficiently manipulated. It is known as a "one-hole context". This mutable variant implements a zipper for a list as a pair of two arrays, laid out as follows:

 Base list: 1 2 3 4 [ ] 6 7 8 9
 Front list: 1 2 3 4
 Back list: 9 8 7 6

User is expected to keep track of the "current element" and properly fill it back in as necessary. (ToDo: Maybe it's more user friendly to implicitly track the current element?)

Nota bene: the current class gets confused if you try to store NULLs in the list.

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $front,
  $back 
)

Documentation des fonctions membres

◆ advance()

advance (   $t,
  $n 
)

Iterated hole advancement.

Paramètres
$tElement to fill hole with
$iHow many forward to advance hole
Renvoie
Original contents of new hole, i away
+ Voici le graphe d'appel pour cette fonction :

◆ delete()

delete ( )

Delete contents of current hole, shifting hole to next element.

Renvoie
Original contents of new hole.

◆ done()

done ( )

Returns true if we are at the end of the list.

Renvoie
bool

◆ fromArray()

static fromArray (   $array)
static

Creates a zipper from an array, with a hole in the 0-index position.

Paramètres
Arrayto zipper-ify.
Renvoie
Tuple of zipper and element of first position.
+ Voici le graphe des appelants de cette fonction :

◆ insertAfter()

insertAfter (   $t)

Insert element after hole.

Paramètres
Elementto insert
+ Voici le graphe des appelants de cette fonction :

◆ insertBefore()

insertBefore (   $t)

Insert element before hole.

Paramètres
Elementto insert

◆ next()

next (   $t)

Move hole to the next element.

Paramètres
$tElement to fill hole with
Renvoie
Original contents of new hole.
+ Voici le graphe des appelants de cette fonction :

◆ prev()

prev (   $t)

Move hole to the previous element

Paramètres
$tElement to fill hole with
Renvoie
Original contents of new hole.

◆ splice()

splice (   $t,
  $delete,
  $replacement 
)

Splice in multiple elements at hole. Functional specification in terms of array_splice:

 $arr1 = $arr;
 $old1 = array_splice($arr1, $i, $delete, $replacement);

 list($z, $t) = HTMLPurifier_Zipper::fromArray($arr);
 $t = $z->advance($t, $i);
 list($old2, $t) = $z->splice($t, $delete, $replacement);
 $arr2 = $z->toArray($t);

 assert($old1 === $old2);
 assert($arr1 === $arr2);

NB: the absolute index location after this operation is unchanged!

Paramètres
Currentcontents of hole.
Renvoie
array
+ Voici le graphe d'appel pour cette fonction :

◆ toArray()

toArray (   $t = NULL)

Convert zipper back into a normal array, optionally filling in the hole with a value. (Usually you should supply a $t, unless you are at the end of the array.)

Documentation des champs

◆ $back

$back

◆ $front

$front

La documentation de cette classe a été générée à partir du fichier suivant :