-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvariable.cpp
More file actions
38 lines (29 loc) · 939 Bytes
/
variable.cpp
File metadata and controls
38 lines (29 loc) · 939 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
#include "variable.h"
int Variable::lastId = 0;
Variable::Variable(QString type, QString name, QString process) {
this->id = lastId++;
this->type = type;
this->name = name;
this->process = process;
}
void Variable::setValue(QString value, int index) {
if (this->value.size()>=index+1) this->value.replace(index,value);
else this->value.insert(index,value);
}
void Variable::setValue(QList<QString> value) {
this->value = value;
}
QString Variable::getValueString() {
if (value.size()>1) {
QString returnVal = "{"+value[0];
for (int i = 1 ; i<value.size() ; i++) {
returnVal.append(","+value[i]);
}
return returnVal.append("}");
}
else if (value.size()==0) return "-";
else return value[0];
}
QList<QString> Variable::getValue() { return value; }
QString Variable::getName() { return name; }
int Variable::getId() { return id; }