📄 connection.h
字号:
#ifndef CONNECTION_H
#define CONNECTION_H
using namespace std;
#include "mailsystem.h"
#include "telephone.h"
#include "mailbox.h"
/**
Connects a phone to the voice mail system.
The purpose of this class is to keep track
of the state of a connection, because the phone
itself is only the source of individual key presses.
*/
class Connection
{
public:
/**
Construct a Connection object.
@param s a MailSystemn object
@param p a Telephone object
*/
Connection(MailSystem& s, Telephone& p);
/**
Respond to the user's pressing a key
on the phone touchpad.
@param key the phone key pressed by the user
*/
void dial(string key);
/**
Record voice.
@param voice voice spoken by the user
*/
void record(string voice);
/**
The user hangs up the phone.
*/
void hangup();
private:
/**
Reset the connection to the initial state
and prompt for mailbox number.
*/
void reset_connection();
/**
Try to connect the user with the specified mailbox.
@param key the phone key pressed by the user
*/
void connect(string key);
/**
Try to log in the user.
@param key the phone key pressed by the user
*/
void login(string key);
/**
Change passcode.
@param key the phone key pressed by the user
*/
void change_passcode(string key);
/**
Change greeting.
@param key the phone key presed by the user
*/
void change_greeting(string key);
/**
Respond to the users selection from mailbox menu.
@param key the phone key pressed by the user
*/
void mailbox_menu(string key);
/**
Respond to the user's selection from message menu.
@param key the phone key pressed by the user
*/
void message_menu(string key);
MailSystem& system;
Mailbox* current_mailbox;
string current_recording;
string accumulated_keys;
Telephone& phone;
enum states {DISCONNECTED, CONNECTED, RECORDING,
MAILBOX_MENU, MESSAGE_MENU,
CHANGE_PASSCODE, CHANGE_GREETING};
enum states state;
const string INITIAL_PROMPT;
const string MAILBOX_MENU_TEXT;
const string MESSAGE_MENU_TEXT;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -