diff --git a/__if.cpp b/__if.cpp index 024db5e..6c15e22 100644 --- a/__if.cpp +++ b/__if.cpp @@ -1,33 +1,37 @@ #include "__if.h" #include "Exception.h" #include +#include "Expression.h" namespace jet { - + __if::__if(coreutils::ZString &in, coreutils::MString &out) : Tag(in, out) { - if(keywordExists(coreutils::ZString("value1"))) { - if(keywordExists(coreutils::ZString("expr"))) + coreutils::MString result; + + if(keywordExists("value1")) { + if(keywordExists("expr")) throw coreutils::Exception("Either value1 or expr can be specified but not both."); - if(keywordExists(coreutils::ZString("value2"))) { - if(keywordExists(coreutils::ZString("type"))) { - // process here + if(keywordExists("value2")) { + if(keywordExists("type")) { + } else throw coreutils::Exception("type expected if value1 and value2 specified."); } else throw coreutils::Exception("value2 required if value1 specified."); - } else if(keywordExists(coreutils::ZString("expr"))) { - if(keywordExists(coreutils::ZString("value2"))) - throw coreutils::Exception("value2 should not be specified with expr."); - if(keywordExists(coreutils::ZString("type"))) - throw coreutils::Exception("type should not be specified with expr."); - // process here + } else if(keywordExists("expr")) { + if(keywordExists("value2")) + throw coreutils::Exception("value2 should not be specified with expr."); + if(keywordExists("type")) + throw coreutils::Exception("type should not be specified with expr."); + result = Expression(keywords["expr"]); + std::cout << "result1: " << result << std::endl; } - - if(true) { - parseContainer(container); + std::cout << "result2: " << result << std::endl; + if(result.boolValue()) { + parseContainer(container); } - + } - + } diff --git a/__if.h b/__if.h index bd7fdc4..cd688f3 100644 --- a/__if.h +++ b/__if.h @@ -7,14 +7,14 @@ #include namespace jet { - + class __if : public Tag { - + public: __if(coreutils::ZString &in, coreutils::MString &out); - + }; - + } #endif diff --git a/__mysql.cpp b/__mysql.cpp index 6033991..0c37f48 100644 --- a/__mysql.cpp +++ b/__mysql.cpp @@ -2,9 +2,9 @@ #include namespace jet { - + __mysql::__mysql(coreutils::ZString &in, coreutils::MString &out) : Tag(in, out) { - parseContainer(container); + parseContainer(container); } - + } diff --git a/testjet b/testjet index 9fdfb41..a7eb98a 100755 Binary files a/testjet and b/testjet differ diff --git a/testjet.cpp b/testjet.cpp index 9fd1245..4a28fa5 100644 --- a/testjet.cpp +++ b/testjet.cpp @@ -23,7 +23,7 @@ int main(int argc, char **argv) { coreutils::MString out; jet::__jet *jet = new jet::__jet(data, out); - delete jet; + delete jet; std::cout << ">>-------" << std::endl << out << std::endl << "<<------"; }