if(oobjType == ObjTypeBObj){
int first;
ofileImp.writeLine(BString("BString ") + typeName + "::getType(){ return \"" + typeName + "\"; }\n");
ofileImp.writeLine(BString("BError ") + typeName + "::getMembers(BDictString& members){\n");
ofileImp.indentMore();
ofileImp.writeLine("BError\terr;\n\n");
nl = &n->node(0)->nodes();
for(nl->start(i); !nl->isEnd(i); nl->next(i)){
s = nl->get(i)->node(1)->name();
if(s == "timePeriod")
ofileImp.writeLine(s + ".getMembers(members);\n");
else
ofileImp.writeLine(BString("toBString(") + s + ", members[\"" + s + "\"]);\n");
}
ofileImp.writeLine("return err;\n");
ofileImp.indentLess();
ofileImp.writeLine("}\n");
ofileImp.writeLine(BString("BError ") + typeName + "::getMember(BString name, BString& value){\n");
ofileImp.indentMore();
ofileImp.writeLine("BError\terr;\n\n");
nl = &n->node(0)->nodes();
first = 1;
for(nl->start(i); !nl->isEnd(i); nl->next(i)){
s = nl->get(i)->node(1)->name();
if(s != "timePeriod"){
if(first){
ofileImp.writeLine(BString("if(name == \"") + s + "\") toBString(" + s + ", value);\n");
first = 0;
}
else {
ofileImp.writeLine(BString("else if(name == \"") + s + "\") toBString(" + s + ", value);\n");
}
}
}
ofileImp.writeLine("return err;\n");
ofileImp.indentLess();
ofileImp.writeLine("}\n");
ofileImp.writeLine(BString("BError ") + typeName + "::setMembers(BDictString& members){\n");
ofileImp.indentMore();
ofileImp.writeLine("BError\terr;\n\n");
nl = &n->node(0)->nodes();
for(nl->start(i); !nl->isEnd(i); nl->next(i)){
s = nl->get(i)->node(1)->name();
if(s == "timePeriod")
ofileImp.writeLine(s + ".setMembers(members);\n");
else
ofileImp.writeLine(BString("fromBString(members[\"") + s + "\"], " + s + ");\n");
}
ofileImp.writeLine("return err;\n");
ofileImp.indentLess();
ofileImp.writeLine("}\n");
ofileImp.writeLine(BString("BError ") + typeName + "::setMember(BString name, BString value){\n");
ofileImp.indentMore();
ofileImp.writeLine("BError\terr;\n\n");
nl = &n->node(0)->nodes();
first = 1;
for(nl->start(i); !nl->isEnd(i); nl->next(i)){
s = nl->get(i)->node(1)->name();
if(s != "timePeriod"){
if(first){
ofileImp.writeLine(BString("if(name == \"") + s + "\") fromBString(value, " + s + ");\n");
first = 0;
}
else {
ofileImp.writeLine(BString("else if(name == \"") + s + "\") fromBString(value, " + s + ");\n");
}
}
}
ofileImp.writeLine("return err;\n");
ofileImp.indentLess();
ofileImp.writeLine("}\n");
}