onion_connection_status Onion::render_to_response(::Onion::template_f fn, const ::Onion::Dict& context, ::Onion::Response &res) { ONION_DEBUG("Context: %s", context.toJSON().c_str()); onion_dict *d=onion_dict_dup( context.c_handler() ); fn(d, res.c_handler()); return OCS_PROCESSED; }
void t02_dup(){ INIT_LOCAL(); Onion::Dict normal; normal.add("Hello", "World"); Onion::Dict copy4; copy4=normal.c_handler(); FAIL_IF_NOT_EQUAL_STRING(copy4.get("Hello"), "World"); Onion::Dict copy2; copy2=normal; FAIL_IF_NOT_EQUAL_STRING(copy2.get("Hello"), "World"); Onion::Dict copy=normal; FAIL_IF_NOT_EQUAL_STRING(copy.get("Hello"), "World"); Onion::Dict copy3(normal); FAIL_IF_NOT_EQUAL_STRING(copy3.get("Hello"), "World"); Onion::Dict dup=normal.hard_dup(); FAIL_IF_NOT_EQUAL_STRING(dup.get("Hello"), "World"); dup.add("Hello","world!",OD_REPLACE|OD_DUP_ALL); FAIL_IF_EQUAL_STRING(dup.get("Hello"), "World"); FAIL_IF_NOT_EQUAL_STRING(dup.get("Hello"), "world!"); FAIL_IF_EQUAL_STRING(copy.get("Hello"), "world!"); FAIL_IF_EQUAL_STRING(copy2.get("Hello"), "world!"); normal.add("Tst","tst"); FAIL_IF_NOT_EQUAL_STRING(copy.get("Tst"), "tst"); FAIL_IF_NOT_EQUAL_STRING(copy2.get("Tst"), "tst"); FAIL_IF_EQUAL_STRING(dup.get("Tst"), "tst"); END_LOCAL(); }
onion_connection_status extended_html_template(Onion::Dict &d, Onion::Request &req, Onion::Response &res){ extended_html_template(onion_dict_dup(d.c_handler()),req.c_handler(), res.c_handler()); }