-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBindCommand.cpp
More file actions
25 lines (23 loc) · 931 Bytes
/
BindCommand.cpp
File metadata and controls
25 lines (23 loc) · 931 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
#include <regex>
#include "BindCommand.h"
BindCommand::BindCommand(DataCommands *dataCommands, DataBinds *dataBinds) {
this->dataCommands = dataCommands;
this->dataBinds = dataBinds;
}
void BindCommand::doCommand() {
// get the index from dataCommands
unsigned long index = this->dataCommands->getIndex();
// skip the command
index++;
// get the nameInSimulator from the vector in dataCommands
string nameInSimulator = this->dataCommands->getSeparated().at(index);
// skip the nameInSimulator
index++;
unsigned long indexOfVarName = this->dataCommands->getIndex() - 2;
// get the varName from the vector in dataCommands
string varName = this->dataCommands->getSeparated().at(indexOfVarName);
// add to the varToNameInSimulator map
this->dataBinds->addNewBind(nameInSimulator, varName);
// set the new index of dataCommands
this->dataCommands->setIndex(index);
}