summaryrefslogtreecommitdiff
path: root/doxygen/man/man3/pirate6_Pirate.3
blob: 6d103d9b61fa62af14b63e3138bbe7be5bb56be7 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
.TH "pirate6::Pirate" 3 "Fri Sep 9 2011" "Cmd2" \" -*- nroff -*-
.ad l
.nh
.SH NAME
pirate6::Pirate \- 
.SH SYNOPSIS
.br
.PP
.PP
Inherits \fBcmd2::Cmd\fP'\&.
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "def \fBdefault\fP"
.br
.ti -1c
.RI "def \fBdo_drink\fP"
.br
.ti -1c
.RI "def \fBdo_loot\fP"
.br
.ti -1c
.RI "def \fBdo_quit\fP"
.br
.ti -1c
.RI "def \fBpostcmd\fP"
.br
.ti -1c
.RI "def \fBprecmd\fP"
.br
.in -1c
.SS "Public Attributes"

.in +1c
.ti -1c
.RI "\fBinitial_gold\fP"
.br
.in -1c
.SS "Static Public Attributes"

.in +1c
.ti -1c
.RI "int \fBgold\fP = 3"
.br
.ti -1c
.RI "string \fBprompt\fP = 'arrr> '"
.br
.in -1c
.SH "Detailed Description"
.PP 
Definition at line 4 of file pirate6\&.py'\&.
.SH "Member Function Documentation"
.PP 
.SS "def pirate6::Pirate::default (self, line)"
.PP
Definition at line 7 of file pirate6\&.py'\&.
.PP
Referenced by cmd2::Cmd::_default()\&.
.PP
.nf
7 
8     def default(self, line):
9         print('What mean ye by '{0}'?'
              \&.format(line))
.fi
.SS "def pirate6::Pirate::do_drink (self, arg)".PP
.nf
Drown your sorrrows in rrrum.

drink [n] - drink [n] barrel[s] o' rum..fi
.PP
 
.PP
Definition at line 13 of file pirate6\&.py'\&.
.PP
References pirate2::Pirate::gold, gold, pirate5::Pirate::gold, pirate4::Pirate::gold, and pirate3::Pirate::gold\&.
.PP
.nf
13 
14     def do_drink(self, arg):
15         '''Drown your sorrrows in rrrum\&.
16         
17         drink [n] - drink [n] barrel[s] o' rum\&.'''          
18         try:
19             self\&.gold -= int(arg)
20         except:
21             if arg:
22                 print('''What's '{0}'?  I'll take rrrum\&.'''\&.format(arg))
            self\&.gold -= 1            
.fi
.SS "def pirate6::Pirate::do_loot (self, arg)"
.PP
Definition at line 10 of file pirate6\&.py'\&.
.PP
References pirate2::Pirate::gold, gold, pirate5::Pirate::gold, pirate4::Pirate::gold, and pirate3::Pirate::gold\&.
.PP
.nf
10 
11     def do_loot(self, arg):
12         'Seize booty from a passing ship\&.'
        self\&.gold += 1
.fi
.SS "def pirate6::Pirate::do_quit (self, arg)"
.PP
Reimplemented from \fBcmd2::Cmd\fP'\&.
.PP
Definition at line 34 of file pirate6\&.py'\&.
.PP
.nf
34 
35     def do_quit(self, arg):
36         print('Quiterrr!')
37         return True    

.fi
.SS "def pirate6::Pirate::postcmd (self, stop, line)"
.PP
Definition at line 26 of file pirate6\&.py'\&.
.PP
References pirate2::Pirate::gold, pirate3::Pirate::gold, pirate5::Pirate::gold, gold, pirate4::Pirate::gold, pirate3::Pirate::initial_gold, pirate5::Pirate::initial_gold, pirate4::Pirate::initial_gold, and initial_gold\&.
.PP
Referenced by cmd2::Cmd::onecmd_plus_hooks()\&.
.PP
.nf
26 
27     def postcmd(self, stop, line):   
28         if self\&.gold != self\&.initial_gold:
29             print('Now we gots {0} doubloons'
30                   \&.format(self\&.gold))
31         if self\&.gold < 0:
32             print('Off to debtorrr's prison\&.')
33             stop = True
        return stop
.fi
.SS "def pirate6::Pirate::precmd (self, line)"
.PP
Definition at line 23 of file pirate6\&.py'\&.
.PP
References pirate2::Pirate::gold, pirate5::Pirate::gold, gold, pirate4::Pirate::gold, pirate3::Pirate::gold, pirate3::Pirate::initial_gold, pirate4::Pirate::initial_gold, pirate5::Pirate::initial_gold, and initial_gold\&.
.PP
Referenced by cmd2::Cmd::onecmd_plus_hooks()\&.
.PP
.nf
23 
24     def precmd(self, line):
25         self\&.initial_gold = self\&.gold
        return line
.fi
.SH "Member Data Documentation"
.PP 
.SS "int \fBpirate6::Pirate::gold\fP = 3\fC [static]\fP"
.PP
Definition at line 5 of file pirate6\&.py'\&.
.PP
Referenced by pirate7::Pirate::do_drink(), pirate8::Pirate::do_drink(), do_drink(), pirate8::Pirate::do_loot(), pirate7::Pirate::do_loot(), do_loot(), pirate7::Pirate::postcmd(), pirate8::Pirate::postcmd(), postcmd(), pirate7::Pirate::precmd(), pirate8::Pirate::precmd(), and precmd()\&.
.SS "\fBpirate6::Pirate::initial_gold\fP"
.PP
Definition at line 23 of file pirate6\&.py'\&.
.PP
Referenced by pirate7::Pirate::postcmd(), pirate8::Pirate::postcmd(), postcmd(), pirate8::Pirate::precmd(), pirate7::Pirate::precmd(), and precmd()\&.
.SS "string \fBpirate6::Pirate::prompt\fP = 'arrr> '\fC [static]\fP"
.PP
Reimplemented from \fBcmd2::Cmd\fP'\&.
.PP
Definition at line 6 of file pirate6\&.py'\&.

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