-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadAction.cpp
More file actions
42 lines (29 loc) · 870 Bytes
/
Copy pathloadAction.cpp
File metadata and controls
42 lines (29 loc) · 870 Bytes
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
#include "loadAction.h"
loadAction::loadAction(ApplicationManager* pApp) : Action(pApp)
{
}
void loadAction::ReadActionParameters()
{
lgrid = pManager->GetGrid();
Output* pOut = lgrid->GetOutput();
Input* pIn = lgrid->GetInput();
pOut->PrintMessage("enter file name you want to load : ");
filename = pIn->GetSrting(pOut) + ".txt";
pOut->ClearStatusBar();
}
void loadAction::Execute()
{
ReadActionParameters();
ifstream loadin(filename, ios::in);
if (!loadin) //check if the file was opened successfully
{
lgrid ->PrintErrorMessage("file doesn't open! click to continue..");
}
//call function that will load all object
lgrid->LoadAll(loadin);
loadin.close(); //close the file that was opened
lgrid->GetOutput()->PrintMessage("Loading successful from " + filename);
}
loadAction::~loadAction()
{
}