-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariablesContainer.cpp
More file actions
33 lines (25 loc) · 913 Bytes
/
VariablesContainer.cpp
File metadata and controls
33 lines (25 loc) · 913 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
//
// Created by root on 11/8/17.
//
#include "VariablesContainer.h"
VariablesContainer::VariablesContainer() = default;
VariablesContainer::VariablesContainer(const map<string, Type> &identifiers) : identifiers(
identifiers) {}
const map<string, Type> &VariablesContainer::getIdentifiers() const {
return identifiers;
}
void VariablesContainer::setIdentifiers(const map<string, Type> &identifiers) {
VariablesContainer::identifiers = identifiers;
}
void VariablesContainer::addIdentifier(const string &name, const Type type) {
identifiers.insert(pair<string, Type>(name, type));
}
void VariablesContainer::removeIdentifier(const string &name) {
identifiers.erase(name);
}
bool VariablesContainer::containsIdentifier(const string &name, Type type) {
for (const auto& id : identifiers) {
if (id.first == name && id.second == type) return true;
}
return false;
}