Setup base for conversion modifiers to be written.
This commit is contained in:
parent
0de087f14d
commit
31e309934c
12
Global.cpp
12
Global.cpp
@ -37,6 +37,13 @@ namespace jet {
|
||||
sessions.erase(sessionId);
|
||||
}
|
||||
|
||||
coreutils::MString& Global::processModifier(coreutils::MString &value, coreutils::MString &modifier) {
|
||||
if(modifier.getLength() == 0)
|
||||
return value;
|
||||
lastConverted = modifier;
|
||||
return lastConverted;
|
||||
}
|
||||
|
||||
coreutils::ZString Global::getVariable(coreutils::ZString &variable, std::map<coreutils::ZString, coreutils::MString> &lvariables) {
|
||||
if(variable.ifNext("$[")) {
|
||||
coreutils::MString name;
|
||||
@ -54,8 +61,9 @@ namespace jet {
|
||||
} else {
|
||||
renderVariableName(variable, name, modifier, lvariables);
|
||||
name.split(".");
|
||||
if(name.getList().size() == 1)
|
||||
return variables[name[0]];
|
||||
if(name.getList().size() == 1) {
|
||||
return processModifier(variables[name[0]], modifier);
|
||||
}
|
||||
return getSessionVariable(name);
|
||||
}
|
||||
throw coreutils::Exception("expected variable name or type designator.");
|
||||
|
2
Global.h
2
Global.h
@ -18,6 +18,7 @@ namespace jet {
|
||||
bool sessionExists(coreutils::MString sessionId);
|
||||
void addSession(coreutils::MString sessionId, __mysql *mysql);
|
||||
void removeSession(coreutils::MString sessionId);
|
||||
coreutils::MString& processModifier(coreutils::MString &value, coreutils::MString &modifier);
|
||||
coreutils::ZString getVariable(coreutils::ZString &variable, std::map<coreutils::ZString, coreutils::MString> &lvariables);
|
||||
void renderVariableName(coreutils::ZString &variable, coreutils::MString &name, coreutils::MString &modifier, std::map<coreutils::ZString, coreutils::MString> &lvariables);
|
||||
__mysql * getSession(coreutils::MString sessionId);
|
||||
@ -29,6 +30,7 @@ namespace jet {
|
||||
std::map<coreutils::MString, __mysql *> sessions;
|
||||
std::map<coreutils::MString, coreutils::MString> headers;
|
||||
std::map<coreutils::MString, coreutils::MString> tags;
|
||||
coreutils::MString lastConverted;
|
||||
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<set name="var1var" value="Yet another test" />
|
||||
<set name="var11" value="it seems to work." />
|
||||
|
||||
$[$[ix]var$[ix]]
|
||||
$[$[ix]var$[ix];binary]
|
||||
$[var$[ix]]
|
||||
$[var$[ix]var]
|
||||
$[var$[i$[letterx]]var]
|
||||
|
Loading…
x
Reference in New Issue
Block a user