more unknown work

This commit is contained in:
Brad Arant 2024-02-14 10:58:57 -08:00
parent fce97e04ff
commit d915714b4d
5 changed files with 29 additions and 25 deletions

View File

@ -1,33 +1,37 @@
#include "__if.h" #include "__if.h"
#include "Exception.h" #include "Exception.h"
#include <iostream> #include <iostream>
#include "Expression.h"
namespace jet { namespace jet {
__if::__if(coreutils::ZString &in, coreutils::MString &out) : Tag(in, out) { __if::__if(coreutils::ZString &in, coreutils::MString &out) : Tag(in, out) {
if(keywordExists(coreutils::ZString("value1"))) { coreutils::MString result;
if(keywordExists(coreutils::ZString("expr")))
if(keywordExists("value1")) {
if(keywordExists("expr"))
throw coreutils::Exception("Either value1 or expr can be specified but not both."); throw coreutils::Exception("Either value1 or expr can be specified but not both.");
if(keywordExists(coreutils::ZString("value2"))) { if(keywordExists("value2")) {
if(keywordExists(coreutils::ZString("type"))) { if(keywordExists("type")) {
// process here
} else } else
throw coreutils::Exception("type expected if value1 and value2 specified."); throw coreutils::Exception("type expected if value1 and value2 specified.");
} else } else
throw coreutils::Exception("value2 required if value1 specified."); throw coreutils::Exception("value2 required if value1 specified.");
} else if(keywordExists(coreutils::ZString("expr"))) { } else if(keywordExists("expr")) {
if(keywordExists(coreutils::ZString("value2"))) if(keywordExists("value2"))
throw coreutils::Exception("value2 should not be specified with expr."); throw coreutils::Exception("value2 should not be specified with expr.");
if(keywordExists(coreutils::ZString("type"))) if(keywordExists("type"))
throw coreutils::Exception("type should not be specified with expr."); throw coreutils::Exception("type should not be specified with expr.");
// process here result = Expression(keywords["expr"]);
std::cout << "result1: " << result << std::endl;
} }
std::cout << "result2: " << result << std::endl;
if(true) { if(result.boolValue()) {
parseContainer(container); parseContainer(container);
} }
} }
} }

8
__if.h
View File

@ -7,14 +7,14 @@
#include <sstream> #include <sstream>
namespace jet { namespace jet {
class __if : public Tag { class __if : public Tag {
public: public:
__if(coreutils::ZString &in, coreutils::MString &out); __if(coreutils::ZString &in, coreutils::MString &out);
}; };
} }
#endif #endif

View File

@ -2,9 +2,9 @@
#include <iostream> #include <iostream>
namespace jet { namespace jet {
__mysql::__mysql(coreutils::ZString &in, coreutils::MString &out) : Tag(in, out) { __mysql::__mysql(coreutils::ZString &in, coreutils::MString &out) : Tag(in, out) {
parseContainer(container); parseContainer(container);
} }
} }

BIN
testjet

Binary file not shown.

View File

@ -23,7 +23,7 @@ int main(int argc, char **argv) {
coreutils::MString out; coreutils::MString out;
jet::__jet *jet = new jet::__jet(data, out); jet::__jet *jet = new jet::__jet(data, out);
delete jet; delete jet;
std::cout << ">>-------" << std::endl << out << std::endl << "<<------"; std::cout << ">>-------" << std::endl << out << std::endl << "<<------";
} }