Repository navigation
Expand file tree
/
Copy pathcmdhandler.h
More file actions
101 lines (82 loc) · 2.35 KB
/
Copy pathcmdhandler.h
File metadata and controls
101 lines (82 loc) · 2.35 KB
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
#ifndef CMDHANDLER_H
#define CMDHANDLER_H
#include "handler.h"
#include "searcheng.h"
#include "combiners.h"
/**
* Handles the QUIT command - COMPLETED in cmdhandler.cpp
*/
class QuitHandler : public Handler
{
public:
QuitHandler();
QuitHandler(Handler* next);
protected:
virtual bool canHandle(const std::string& cmd) const;
virtual HANDLER_STATUS_T process(SearchEng* eng, std::istream& instr, std::ostream& ostr);
};
/**
* Handles the PRINT command
*/
class PrintHandler : public Handler
{
public:
PrintHandler();
PrintHandler(Handler* next);
protected:
virtual bool canHandle(const std::string& cmd) const;
virtual HANDLER_STATUS_T process(SearchEng* eng, std::istream& instr, std::ostream& ostr);
};
/*********** Declare the classes for other command handling: *******/
/*********** AND, OR, and DIFF handlers *******/
/*********** Then define their implementation in cmdhandler.cpp *******/
class AndHandler : public Handler
{
public:
AndHandler();
AndHandler(Handler* next);
protected:
virtual bool canHandle(const std::string& cmd) const;
virtual HANDLER_STATUS_T process(SearchEng* eng, std::istream& instr, std::ostream& ostr);
};
// OR handler
class OrHandler : public Handler
{
public:
OrHandler();
OrHandler(Handler* next);
protected:
virtual bool canHandle(const std::string& cmd) const;
virtual HANDLER_STATUS_T process(SearchEng* eng, std::istream& instr, std::ostream& ostr);
};
// DIFF handler
class DiffHandler : public Handler
{
public:
DiffHandler();
DiffHandler(Handler* next);
protected:
virtual bool canHandle(const std::string& cmd) const;
virtual HANDLER_STATUS_T process(SearchEng* eng, std::istream& instr, std::ostream& ostr);
};
// INCOMING handler
class IncomingHandler : public Handler
{
public:
IncomingHandler();
IncomingHandler(Handler* next);
protected:
virtual bool canHandle(const std::string& cmd) const;
virtual HANDLER_STATUS_T process(SearchEng* eng, std::istream& instr, std::ostream& ostr);
};
// OUTGOING handler
class OutgoingHandler : public Handler
{
public:
OutgoingHandler();
OutgoingHandler(Handler* next);
protected:
virtual bool canHandle(const std::string& cmd) const;
virtual HANDLER_STATUS_T process(SearchEng* eng, std::istream& instr, std::ostream& ostr);
};
#endif