-
Notifications
You must be signed in to change notification settings - Fork 0
/
TablaVariables.cpp
46 lines (38 loc) · 937 Bytes
/
TablaVariables.cpp
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
#include "TablaVariables.h"
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
void TablaVariables::addVariable(string t, string id, vector<string> v){
tipos.push_back(t);
ids.push_back(id);
valores.push_back(v);
}
int TablaVariables::getIndex(string id) {
int res=0;
bool encontrado=false;
for(vector<string>::iterator it = ids.begin();it!=ids.end();it++){
if(*it == id){ encontrado=true; break; }
res++;
}
if(encontrado) return res;
else return -1;
}
string TablaVariables::getType(int i){
return tipos[i];
}
string TablaVariables::getId(int i){
return ids[i];
}
vector<string> TablaVariables::getDimensions(int i){
return valores[i];
}
void TablaVariables::clearAll(){
tipos.clear();
ids.clear();
valores.clear();
//for(vector<string>::iterator it = valores.begin();it!=valores.end();it++){
// *it.clear();
//}
}