Renderer.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. * Abstract base class for Highlighter renderers
  24. *
  25. * @author Andrey Demenev <demenev@gmail.com>
  26. * @category Text
  27. * @package Text_Highlighter
  28. * @copyright 2004-2006 Andrey Demenev
  29. * @license http://www.php.net/license/3_0.txt PHP License
  30. * @version Release: 0.7.1
  31. * @link http://pear.php.net/package/Text_Highlighter
  32. * @abstract
  33. */
  34. class Text_Highlighter_Renderer
  35. {
  36. /**
  37. * Renderer options
  38. *
  39. * @var array
  40. * @access protected
  41. */
  42. public $_options = array();
  43. /**
  44. * Current language
  45. *
  46. * @var string
  47. * @access protected
  48. */
  49. public $_language = '';
  50. /**
  51. * Constructor
  52. *
  53. * @access public
  54. *
  55. * @param array $options Rendering options. Renderer-specific.
  56. */
  57. function __construct($options = array())
  58. {
  59. $this->_options = $options;
  60. }
  61. /**
  62. * Resets renderer state
  63. *
  64. * @access public
  65. *
  66. * @param array $options Rendering options. Renderer-specific.
  67. */
  68. function reset()
  69. {
  70. return;
  71. }
  72. /**
  73. * Preprocesses code
  74. *
  75. * @access public
  76. *
  77. * @param string $str Code to preprocess
  78. * @return string Preprocessed code
  79. */
  80. function preprocess($str)
  81. {
  82. return $str;
  83. }
  84. /**
  85. * Accepts next token
  86. *
  87. * @abstract
  88. * @access public
  89. *
  90. * @param string $class Token class
  91. * @param string $content Token content
  92. */
  93. function acceptToken($class, $content)
  94. {
  95. return;
  96. }
  97. /**
  98. * Signals that no more tokens are available
  99. *
  100. * @access public
  101. *
  102. */
  103. function finalize()
  104. {
  105. return;
  106. }
  107. /**
  108. * Get generated output
  109. *
  110. * @abstract
  111. * @return mixed Renderer-specific
  112. * @access public
  113. *
  114. */
  115. function getOutput()
  116. {
  117. return;
  118. }
  119. /**
  120. * Set current language
  121. *
  122. * @abstract
  123. * @return void
  124. * @access public
  125. *
  126. */
  127. function setCurrentLanguage($lang)
  128. {
  129. $this->_language = $lang;
  130. }
  131. }
  132. /*
  133. * Local variables:
  134. * tab-width: 4
  135. * c-basic-offset: 4
  136. * c-hanging-comment-ender-p: nil
  137. * End:
  138. */
  139. ?>