void RoleCollection::get(const server::Request& req, server::Response& res) { auto r = make_prototype(); r[Common::ODATA_ID] = PathBuilder(req).build(); RoleManager::get_instance()->for_each([&r, &req](const auto& role) { json::Json link_elem(json::Json::value_t::object); link_elem[Common::ODATA_ID] = PathBuilder(req).append(role.get_id()).build(); r[Collection::MEMBERS].push_back(std::move(link_elem)); }); r[Collection::ODATA_COUNT] = r[Collection::MEMBERS].size(); set_response(res, r); }
void Role::get(const server::Request& req, server::Response& res) { auto role_id = req.params[PathParam::ROLE_ID]; auto role = RoleManager::get_instance()->get(role_id); auto r = make_prototype(); r[constants::Role::ASSIGNED_PRIVILEGES] = role.get_privileges(); r[Common::ODATA_ID] = PathBuilder(req).build(); r[Common::ID] = req.params[PathParam::ROLE_ID]; r[constants::Role::ROLE_ID] = role.get_role_id(); r[constants::Role::IS_PREDEFINED] = role.is_predefined(); set_response(res, r); }
bool genfun_method_sigs(compile_t* c, reachable_type_t* t) { size_t i = HASHMAP_BEGIN; reachable_method_name_t* n; while((n = reachable_method_names_next(&t->methods, &i)) != NULL) { size_t j = HASHMAP_BEGIN; reachable_method_t* m; while((m = reachable_methods_next(&n->r_methods, &j)) != NULL) make_prototype(c, t, m); } if(!genfun_allocator(c, t)) return false; return true; }
frame register_unfinished_fn(frame name, frame args, frame code, char st) { uffn ufn = allocate_uffn(); list l; int undef_found = (code->type == T_UNDEF); list bld = copy_list(block_decls, 0); string pr; DBG_TRACE_CALL("Registering unfinished '%s' with ", name->code, block_decls); DBG_TRACE_CALL("and%s : ", "", code->decls); for (l = block_decls; l && !undef_found; l = cdr(l)) if (car(l)[0] == T_UNDEF) { undef_found = 1; break; } ufn->name = name; ufn->args = args; ufn->code = code; ufn->code->decls = copy_list(code->decls, 0); ufn->block_decls = bld; ufn->next = unfinished_fns; ufn->undefs = code->undefs; unfinished_fns = ufn; if (!undef_found) { pr = make_prototype(name, args, code, st); register_finished_fn(pr, 1); } block_decls = delete_list(block_decls, 0); block_args = NULL; return NULL; }
Function:: Function() : Object(make_prototype()) { }