Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * TTextWriter class file
4
 *
5
 * @author Qiang Xue <qiang.xue@gmail.com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2005-2008 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: TTextWriter.php 2541 2008-10-21 15:05:13Z qiang.xue $
10
 * @package System.IO
11
 */
12
 
13
/**
14
 * TTextWriter class.
15
 *
16
 * TTextWriter implements a memory-based text writer.
17
 * Content written by TTextWriter are stored in memory
18
 * and can be obtained by calling {@link flush()}.
19
 *
20
 * @author Qiang Xue <qiang.xue@gmail.com>
21
 * @version $Id: TTextWriter.php 2541 2008-10-21 15:05:13Z qiang.xue $
22
 * @package System.IO
23
 * @since 3.0
24
 */
25
class TTextWriter extends TComponent implements ITextWriter
26
{
27
	private $_str='';
28
 
29
	/**
30
	 * Flushes the content that has been written.
31
	 * @return string the content being flushed
32
	 */
33
	public function flush()
34
	{
35
		$str=$this->_str;
36
		$this->_str='';
37
		return $str;
38
	}
39
 
40
	/**
41
	 * Writes a string.
42
	 * @param string string to be written
43
	 */
44
	public function write($str)
45
	{
46
		$this->_str.=$str;
47
	}
48
 
49
	/**
50
	 * Writers a string and terminates it with a newline.
51
	 * @param string content to be written
52
	 * @see write
53
	 */
54
	public function writeLine($str='')
55
	{
56
		$this->write($str."\n");
57
	}
58
}
59