Repository navigation
Expand file tree
/
Copy pathApplicationManager.h
More file actions
78 lines (60 loc) · 2.79 KB
/
Copy pathApplicationManager.h
File metadata and controls
78 lines (60 loc) · 2.79 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
#ifndef APPLICATION_MANAGER_H
#define APPLICATION_MANAGER_H
#include "DEFS.h"
#include "ErrorsType.h"
#include "Statements\Statement.h"
#include <utility>
class Input;
class Output;
//Main class that manages everything in the application.
class ApplicationManager
{
enum { MaxCount = 200 }; //Max no of statements/connectors in a single flowchart
private:
int StatCount; //Actual number of statements
int ConnCount; //Actual number of connectors
Statement* StatList[MaxCount]; //List of all statements (Array of pointers)
Connector* ConnList[MaxCount]; //List of all connectors (Array of pointers)
Connector* pSelectedConn;
Statement *pSelectedStat; //a pointer to the last selected statement
//you can set and get this pointer
Statement *pClipboard; //a pointer to the last copied/cut statement
//you can set and get this pointer
//Pointers to Input and Output classes
Input *pIn;
Output *pOut;
string variables[30];
int varcnt;
public:
ApplicationManager();
~ApplicationManager();
// == Actions Related Functions ==
ActionType GetUserAction() const; //Reads the input command from the user
//and returns the corresponding action type
void ExecuteAction(ActionType) ; //Creates an action and executes it
// == Statements/Connector Management Functions ==
void AddStatement(Statement* pStat); //Adds a new Statement to the Flowchart
Statement *GetStatement(Point P) const; //Searches for a statement where point P belongs
//TODO: Complete its implementation
// WITHOUT breaking class responsibilities
void DeleteStatement(Statement* pStat);
void DeleteConn(Connector* pStat);
void AddConnector(Connector* pConn); //Adds a new Connector to the Flowchart
Connector *GetConnector(Point P) const; //search for a Connector where point P belongs
void SetSelectedConn(Connector* pStat);
Connector* GetSelectedConn() const;
// Note: you should use the following 4 functions
// in order not to break class responsibilities (especially in copy, cut and paste)
Statement *GetSelectedStatement() const; //Returns the selected Statement
void SetSelectedStatement(Statement *pStat); //Set the Statement selected by the user
Statement *GetClipboard() const; //Returns the Clipboard
void SetClipboard(Statement *pStat); //Set the Clipboard
// == Interface Management Functions ==
Input *GetInput() const; //Return pointer to the input
Output *GetOutput() const; //Return pointer to the output
void UpdateInterface() const; //Redraws all the drawing window
void DeleteVariable(Statement* Stat);
void AddVariable(Statement* Stat);
RetErrors ApplicationManager::Validation();
};
#endif