summaryrefslogtreecommitdiff
path: root/doxygen/man/man3/cmd2_OutputTrap.3
blob: 8a1a739beb5be0cae0be69d06ba40364581b80e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
.TH "cmd2::OutputTrap" 3 "Fri Sep 9 2011" "Cmd2" \" -*- nroff -*-
.ad l
.nh
.SH NAME
cmd2::OutputTrap \- 
.SH SYNOPSIS
.br
.PP
.PP
Inherits \fBcmd2::Borg\fP'\&.
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "def \fB__init__\fP"
.br
.ti -1c
.RI "def \fBread\fP"
.br
.ti -1c
.RI "def \fBtearDown\fP"
.br
.ti -1c
.RI "def \fBwrite\fP"
.br
.in -1c
.SS "Public Attributes"

.in +1c
.ti -1c
.RI "\fBcontents\fP"
.br
.ti -1c
.RI "\fBold_stdout\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
.PP
.nf
Instantiate  an OutputTrap to divert/capture ALL stdout output.  For use in unit testing.
Call `tearDown()` to return to normal output..fi
.PP
 
.PP
Definition at line 1459 of file cmd2\&.py'\&.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "def cmd2::OutputTrap::__init__ (self)"
.PP
Definition at line 1462 of file cmd2\&.py'\&.
.PP
.nf
1462 
1463     def __init__(self):
1464         self\&.contents = ''
1465         self\&.old_stdout = sys\&.stdout
        sys\&.stdout = self
.fi
.SH "Member Function Documentation"
.PP 
.SS "def cmd2::OutputTrap::read (self)"
.PP
Definition at line 1468 of file cmd2\&.py'\&.
.PP
References contents\&.
.PP
.nf
1468 
1469     def read(self):
1470         result = self\&.contents
1471         self\&.contents = ''
        return result
.fi
.SS "def cmd2::OutputTrap::tearDown (self)"
.PP
Definition at line 1472 of file cmd2\&.py'\&.
.PP
References contents, and old_stdout\&.
.PP
.nf
1472 
1473     def tearDown(self):
1474         sys\&.stdout = self\&.old_stdout
1475         self\&.contents = ''
        
.fi
.SS "def cmd2::OutputTrap::write (self, txt)"
.PP
Definition at line 1466 of file cmd2\&.py'\&.
.PP
References contents\&.
.PP
.nf
1466 
1467     def write(self, txt):
        self\&.contents += txt
.fi
.SH "Member Data Documentation"
.PP 
.SS "\fBcmd2::OutputTrap::contents\fP"
.PP
Definition at line 1462 of file cmd2\&.py'\&.
.PP
Referenced by read(), tearDown(), and write()\&.
.SS "\fBcmd2::OutputTrap::old_stdout\fP"
.PP
Definition at line 1462 of file cmd2\&.py'\&.
.PP
Referenced by tearDown()\&.

.SH "Author"
.PP 
Generated automatically by Doxygen for Cmd2 from the source code'\&.