Path

ez components / documentation / api reference / trunk / tree


eZ Components trunk

Tree: ezcTreeVisitorPlainText

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcTreeVisitorPlainText

An implementation of the ezcTreeVisitor interface that generates a plain text representation of a tree structure. [source]

Implemented Interfaces

 1.  <?php
 2.      $visitor new ezcTreeVisitorPlainTextezcTreeVisitorPlainText::SYMBOL_UTF8 );
 3.      $tree->accept$visitor );
 4.      echo (string) $visitor// print the plot
 5.  ?>
Shows (something like):
 1.  Hylobatidae
 2.  ├─Hylobates
 3.  │ ├─Lar Gibbon
 4.  │ ├─Agile Gibbon
 5.  │ ├─Müller's Bornean Gibbon
 6.  │ ├─Silvery Gibbon
 7.  │ ├─Pileated Gibbon
 8.  │ └─Kloss's Gibbon
 9.  ├─Hoolock
10.  │ ├─Western Hoolock Gibbon
11.  │ └─Eastern Hoolock Gibbon
12.  ├─Symphalangus
13.  └─Nomascus
14.    ├─Black Crested Gibbon
15.    ├─Eastern Black Crested Gibbon
16.    ├─White-cheecked Crested Gibbon
17.    └─Yellow-cheecked Gibbon

Constants

SYMBOL_ASCII = 1 Represents the ASCII symbol set.
SYMBOL_UTF8 = 2 Represents the UTF-8 symbol set.

Member Variables

protected array(string=>array(string)) $edges = array()
Holds all the edges of the graph.
protected string $root = null
Holds the root ID

Method Summary

public ezcTreeVisitorPlainText __construct( [$symbolCharset = self::SYMBOL_UTF8] )
Constructs a new ezcTreeVisitorPlainText visualizer using $symbolCharset as character set.
public bool visit( $visitable )
Visits the node and sets the the member variables according to the node type and contents.

Methods

__construct

ezcTreeVisitorPlainText __construct( [int $symbolCharset = self::SYMBOL_UTF8] )
Constructs a new ezcTreeVisitorPlainText visualizer using $symbolCharset as character set.
This class only supports 'ascii' and 'utf-8' as character sets. Default is 'utf-8'.

Parameters

Name Type Description
$symbolCharset int  

See also:

ezcTreeVisitorPlainText::SYMBOL_UTF8ezcTreeVisitorPlainText::SYMBOL_ASCII.


visit

bool visit( ezcTreeVisitable $visitable )
Visits the node and sets the the member variables according to the node type and contents.

Parameters

Name Type Description
$visitable ezcTreeVisitable  

Last updated: Mon, 21 Dec 2009