1: <?php
2: /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3: /**
4: * Abstract base class for Highlighter renderers
5: *
6: * PHP versions 4 and 5
7: *
8: * LICENSE: This source file is subject to version 3.0 of the PHP license
9: * that is available through the world-wide-web at the following URI:
10: * http://www.php.net/license/3_0.txt. If you did not receive a copy of
11: * the PHP License and are unable to obtain it through the web, please
12: * send a note to license@php.net so we can mail you a copy immediately.
13: *
14: * @category Text
15: * @package Text_Highlighter
16: * @author Andrey Demenev <demenev@gmail.com>
17: * @copyright 2004-2006 Andrey Demenev
18: * @license http://www.php.net/license/3_0.txt PHP License
19: * @version CVS: $Id: Renderer.php,v 1.1 2007/06/03 02:36:35 ssttoo Exp $
20: * @link http://pear.php.net/package/Text_Highlighter
21: */
22:
23: /**
24: * Abstract base class for Highlighter renderers
25: *
26: * @author Andrey Demenev <demenev@gmail.com>
27: * @category Text
28: * @package Text_Highlighter
29: * @copyright 2004-2006 Andrey Demenev
30: * @license http://www.php.net/license/3_0.txt PHP License
31: * @version Release: 0.7.1
32: * @link http://pear.php.net/package/Text_Highlighter
33: * @abstract
34: */
35:
36: class Text_Highlighter_Renderer
37: {
38: /**
39: * Renderer options
40: *
41: * @var array
42: * @access protected
43: */
44: public $_options = array();
45:
46: /**
47: * Current language
48: *
49: * @var string
50: * @access protected
51: */
52: public $_language = '';
53:
54: /**
55: * Constructor
56: *
57: * @access public
58: *
59: * @param array $options Rendering options. Renderer-specific.
60: */
61: function __construct($options = array())
62: {
63: $this->_options = $options;
64: }
65:
66: /**
67: * Resets renderer state
68: *
69: * @access public
70: *
71: * @param array $options Rendering options. Renderer-specific.
72: */
73: function reset()
74: {
75: return;
76: }
77:
78: /**
79: * Preprocesses code
80: *
81: * @access public
82: *
83: * @param string $str Code to preprocess
84: * @return string Preprocessed code
85: */
86: function preprocess($str)
87: {
88: return $str;
89: }
90:
91: /**
92: * Accepts next token
93: *
94: * @abstract
95: * @access public
96: *
97: * @param string $class Token class
98: * @param string $content Token content
99: */
100: function acceptToken($class, $content)
101: {
102: return;
103: }
104:
105: /**
106: * Signals that no more tokens are available
107: *
108: * @access public
109: *
110: */
111: function finalize()
112: {
113: return;
114: }
115:
116: /**
117: * Get generated output
118: *
119: * @abstract
120: * @return mixed Renderer-specific
121: * @access public
122: *
123: */
124: function getOutput()
125: {
126: return;
127: }
128:
129: /**
130: * Set current language
131: *
132: * @abstract
133: * @return void
134: * @access public
135: *
136: */
137: function setCurrentLanguage($lang)
138: {
139: $this->_language = $lang;
140: }
141:
142: }
143:
144: /*
145: * Local variables:
146: * tab-width: 4
147: * c-basic-offset: 4
148: * c-hanging-comment-ender-p: nil
149: * End:
150: */
151:
152: ?>
153: