📄 connection.h.html
字号:
<html>
<head>
<title>connection.h</title>
</head>
<body>
<pre> 1 #ifndef CONNECTION_H
2 #define CONNECTION_H
3
4 using namespace std;
5
6 #include "mailsystem.h"
7 #include "telephone.h"
8 #include "mailbox.h"
9
<font color="#0000cc">10 /**
11 Connects a phone to the voice mail system.
12 The purpose of this class is to keep track
13 of the state of a connection, because the phone
14 itself is only the source of individual key presses.
15 */</font>
16 class Connection
17 {
18 public:
<font color="#0000cc">19 /**
20 Construct a Connection object
21 @param s a MailSystemn object
22 @param p a Telephone object
23 */</font>
24 Connection(MailSystem& s, Telephone& p);
25
<font color="#0000cc">26 /**
27 Respond to the user's pressing a key
28 on the phone touchpad.
29 @param key the phone key pressed by the user
30 */</font>
31 void dial(string key);
32
<font color="#0000cc">33 /**
34 Record voice
35 @param voice voice spoken by the user
36 */</font>
37 void record(string voice);
38
<font color="#0000cc">39 /**
40 The user hangs up the phone.
41 */</font>
42 void hangup();
43
44 private:
<font color="#0000cc">45 /**
46 Reset the connection to the initial state
47 and prompt for mailbox number
48 */</font>
49 void reset_connection();
50
<font color="#0000cc">51 /**
52 Try to connect the user with the specified mailbox
53 @param key the phone key pressed by the user
54 */</font>
55 void connect(string key);
56
<font color="#0000cc">57 /**
58 Try to log in the user
59 @param key the phone key pressed by the user
60 */</font>
61 void login(string key);
62
<font color="#0000cc">63 /**
64 Change passcode
65 @param key the phone key pressed by the user
66 */</font>
67 void change_passcode(string key);
68
<font color="#0000cc">69 /**
70 Change greeting.
71 @param key the phone key presed by the user
72 */</font>
73 void change_greeting(string key);
74
<font color="#0000cc">75 /**
76 Respond to the users selection from mailbox menu
77 @param key the phone key pressed by the user
78 */</font>
79 void mailbox_menu(string key);
80
<font color="#0000cc">81 /**
82 Respond to the user's selection from message menu
83 @param key the phone key pressed by the user
84 */</font>
85 void message_menu(string key);
86
87 MailSystem& system;
88 Mailbox* current_mailbox;
89 string current_recording;
90 string accumulated_keys;
91 Telephone& phone;
92
93 enum states {DISCONNECTED, CONNECTED, RECORDING,
94 MAILBOX_MENU, MESSAGE_MENU,
95 CHANGE_PASSCODE, CHANGE_GREETING};
96 enum states state;
97
98 const string INITIAL_PROMPT;
99 const string MAILBOX_MENU_TEXT;
100 const string MESSAGE_MENU_TEXT;
101 };
102
103 #endif</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -