continued development
This commit is contained in:
parent
50270bbc91
commit
3d98448ec4
@ -11,4 +11,9 @@ namespace jet {
|
||||
|
||||
}
|
||||
|
||||
void Global::dump() {
|
||||
for (auto i = variables.begin(); i != variables.end(); i++)
|
||||
std::cout << i->first << "=[" << i->second << "]" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
2
Global.h
2
Global.h
@ -12,6 +12,8 @@ namespace jet {
|
||||
Global();
|
||||
virtual ~Global();
|
||||
|
||||
void dump();
|
||||
|
||||
std::map<coreutils::MString, coreutils::MString> variables;
|
||||
|
||||
};
|
||||
|
11
Tag.cpp
11
Tag.cpp
@ -61,11 +61,12 @@ namespace jet {
|
||||
}
|
||||
|
||||
Tag::~Tag() {
|
||||
if(evaluate) {
|
||||
copyContainer(out, parent);
|
||||
} else {
|
||||
copyContainer(container, parent);
|
||||
}
|
||||
if(evaluate)
|
||||
if(output)
|
||||
copyContainer(out, parent);
|
||||
else
|
||||
if(output)
|
||||
copyContainer(container, parent);
|
||||
}
|
||||
|
||||
void Tag::parseContainer(coreutils::ZString &in) {
|
||||
|
3
Tag.h
3
Tag.h
@ -18,11 +18,12 @@ namespace jet {
|
||||
|
||||
protected:
|
||||
bool hasContainer;
|
||||
std::map<coreutils::ZString, coreutils::ZString> variables;
|
||||
std::map<coreutils::ZString, coreutils::MString> variables;
|
||||
bool variableDefined(coreutils::ZString variable);
|
||||
void parseContainer(coreutils::ZString &in);
|
||||
void copyContainer(coreutils::ZString &in, coreutils::MString &out);
|
||||
|
||||
bool output = true;
|
||||
bool evaluate = true;
|
||||
bool filterBlankLines = false;
|
||||
bool trim = false;
|
||||
|
16
__set.cpp
16
__set.cpp
@ -4,21 +4,15 @@
|
||||
|
||||
namespace jet {
|
||||
|
||||
__set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
std::cout << "name: [" << variables["name"] << "]" << std::endl;
|
||||
std::cout << "value: [" << variables["value"] << "]" << std::endl;
|
||||
std::cout << "container: [" << container << "]" << std::endl;
|
||||
std::cout << "scope: [" << variables["scope"] << "]" << std::endl;
|
||||
|
||||
__set::__set(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
output = false;
|
||||
if(variables["scope"] == "local")
|
||||
variables[variables["name"]] = variables["value"];
|
||||
if(variables["scope"] == "global")
|
||||
if(variables["scope"] == "global")
|
||||
global.variables[variables["name"]] = container;
|
||||
|
||||
global.dump();
|
||||
|
||||
std::cout << "localvar: [" << variables.size() << "]" << std::endl;
|
||||
std::cout << "localvarx: [" << variables[variables["name"]] << "]" << std::endl;
|
||||
std::cout << "globalvar: [" << global.variables.size() << "]" << std::endl;
|
||||
std::cout << "globalvarx: [" << global.variables[variables["name"]] << "]" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user