30
30
std::string suPHP::Environment::getVar(const std::string& name) const
31
31
throw (KeyNotFoundException) {
32
32
if (this->vars.find(name) != this->vars.end()) {
33
return this->vars.find(name)->second;
33
return this->vars.find(name)->second;
35
throw KeyNotFoundException("Key " + name + " not found",
35
throw KeyNotFoundException("Key " + name + " not found",
40
40
void suPHP::Environment::setVar(const std::string name,
41
const std::string content)
41
const std::string content)
42
42
throw (KeyNotFoundException) {
43
43
if (this->vars.find(name) != this->vars.end()) {
44
this->vars.find(name)->second = content;
44
this->vars.find(name)->second = content;
46
throw KeyNotFoundException("Key " + name + " not found",
46
throw KeyNotFoundException("Key " + name + " not found",
51
51
void suPHP::Environment::putVar(const std::string name,
52
const std::string content) {
52
const std::string content) {
53
53
if (this->vars.find(name) != this->vars.end()) {
54
this->vars.find(name)->second = content;
54
this->vars.find(name)->second = content;
56
std::pair<std::string, std::string> p;
56
std::pair<std::string, std::string> p;
64
64
void suPHP::Environment::deleteVar(const std::string& name)
65
65
throw (KeyNotFoundException) {
66
66
if (this->vars.find(name) != this->vars.end()) {
67
this->vars.erase(name);
67
this->vars.erase(name);
69
throw KeyNotFoundException("Key " + name + " not found",
69
throw KeyNotFoundException("Key " + name + " not found",
70
70
__FILE__, __LINE__);
74
74
bool suPHP::Environment::hasVar(const std::string& name) const {
75
75
if (this->vars.find(name) != this->vars.end()) {
83
83
std::string& suPHP::Environment::operator[](const std::string& name)
84
84
throw (KeyNotFoundException) {
85
85
if (this->vars.find(name) != this->vars.end()) {
86
return this->vars.find(name)->second;
86
return this->vars.find(name)->second;
88
throw KeyNotFoundException("Key " + name + " not found",
88
throw KeyNotFoundException("Key " + name + " not found",