1<?php
2
3require_once(HTML2PS_DIR.'value.content.item.php');
4
5class ValueContent {
6  var $_items;
7
8  function ValueContent() {
9    $this->set_items(array());
10  }
11
12  function add_item(&$item) {
13    $this->_items[] =& $item;
14  }
15
16  function &copy() {
17    $copy =& new ValueContent();
18
19    foreach ($this->_items as $item) {
20      $copy->add_item($item->copy());
21    };
22
23    return $copy;
24  }
25
26  function doInherit(&$state) {
27
28  }
29
30  function &parse($string) {
31    $value =& new ValueContent();
32
33    while ($string !== '') {
34      $result = ValueContentItem::parse($string);
35
36      $item =& $result['item'];
37      $rest = $result['rest'];
38
39      $string = $rest;
40
41      if (is_null($item)) {
42        break;
43      };
44
45      $value->add_item($item);
46    };
47
48    return $value;
49  }
50
51  function render(&$counters) {
52    $content = array();
53    foreach ($this->_items as $item) {
54      $content[] = $item->render($counters);
55    };
56    return join('', $content);
57  }
58
59  function set_items($value) {
60    $this->_items = $value;
61  }
62}
63
64?>