将terminal中的interface.h拆成3个子头文件 · cpp-main/cpp-tbox@9dbfdb0 · GitHub
Skip to content

Commit 9dbfdb0

Browse files
committed
将terminal中的interface.h拆成3个子头文件
1 parent d389ecf commit 9dbfdb0

13 files changed

Lines changed: 85 additions & 54 deletions

main/context.h

Lines changed: 1 addition & 1 deletion

terminal/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ LIB_VERSION_Z = 2
55

66
HEAD_FILES = \
77
types.h \
8-
interface.h \
8+
connection.h \
9+
terminal_interact.h \
10+
terminal_nodes.h \
911
session.h \
1012
telnetd.h \
1113
terminal.h \

terminal/connection.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef TBOX_TERMINAL_CONNECTION_H_20220214
2+
#define TBOX_TERMINAL_CONNECTION_H_20220214
3+
4+
#include "types.h"
5+
6+
namespace tbox::terminal {
7+
8+
class Connection {
9+
public:
10+
virtual bool send(const SessionToken &st, char ch) = 0;
11+
virtual bool send(const SessionToken &st, const std::string &str) = 0;
12+
virtual bool endSession(const SessionToken &st) = 0;
13+
virtual bool isValid(const SessionToken &st) const = 0;
14+
15+
protected:
16+
virtual ~Connection() { }
17+
};
18+
19+
}
20+
21+
#endif //TBOX_TERMINAL_CONNECTION_H_20220214

terminal/impl/telnetd.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <tbox/util/string.h>
77
#include <tbox/base/log.h>
88

9+
#include "../terminal_interact.h"
10+
911
namespace tbox::terminal {
1012

1113
using namespace std;

terminal/impl/telnetd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <map>
77

88
#include "../telnetd.h"
9-
#include "../interface.h"
9+
#include "../connection.h"
1010

1111
namespace tbox::terminal {
1212

terminal/impl/terminal.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <tbox/base/log.h>
66

7+
#include "../connection.h"
78
#include "session_context.h"
89
#include "dir_node.h"
910
#include "func_node.h"

terminal/impl/terminal_commands.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "session_context.h"
1010
#include "dir_node.h"
1111
#include "func_node.h"
12+
#include "../connection.h"
1213

1314
namespace tbox::terminal {
1415

terminal/impl/terminal_key_events.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "session_context.h"
88
#include "dir_node.h"
99
#include "func_node.h"
10+
#include "../connection.h"
1011

1112
namespace tbox::terminal {
1213

terminal/interface.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

terminal/session.cpp

Lines changed: 2 additions & 1 deletion

0 commit comments

Comments
 (0)