/*! * Создание или повторная инициализация вкладки канала. * * \param id Идентификатор канала. * \param create \b true если необходимо создать канал. * \param show \b true если необходимо выбрать эту вкладку. * * \return Возвращает указатель на вкладку или 0 в случае ошибки. */ ChannelBaseTab *TabWidget::channelTab(const QByteArray &id, bool create, bool show) { SLOG_DEBUG("id =" << SimpleID::encode(id) << "create =" << create << "show =" << show); if (!Channel::isCompatibleId(id)) return 0; ChannelBaseTab *tab = 0; if (m_channels.contains(id)) { tab = m_channels.value(id); create = false; } ClientChannel channel = ChatClient::channels()->get(id); if (!channel) { if (!m_prefetch.contains(id)) m_prefetch.append(id); return 0; } if (create) { if (channel->type() == SimpleID::UserId) tab = new PrivateTab(channel, this); else if (channel->type() == SimpleID::ChannelId) tab = new ChannelTab(channel, this); if (tab) { m_channels[id] = tab; tab->setOnline(); addTab(tab, tab->icon(), channel->name()); connect(tab, SIGNAL(actionTriggered(bool)), SLOT(openTab())); if (channel->type() == SimpleID::ChannelId && isAutoPin(channel->id())) tab->pin(); if (m_autoPin.contains(id)) { m_autoPin.removeAll(id); tab->pin(); emit pinned(tab); } } closePage(PROGRESS_TAB); closePage(WELCOME_TAB); } if (show && tab) setCurrentIndex(indexOf(tab)); return tab; }
Z3_ast Z3_API Z3_mk_quantifier_const_ex(Z3_context c, Z3_bool is_forall, unsigned weight, Z3_symbol quantifier_id, Z3_symbol skolem_id, unsigned num_bound, Z3_app const bound[], unsigned num_patterns, Z3_pattern const patterns[], unsigned num_no_patterns, Z3_ast const no_patterns[], Z3_ast body) { Z3_TRY; LOG_Z3_mk_quantifier_const_ex(c, is_forall, weight, quantifier_id, skolem_id, num_bound, bound, num_patterns, patterns, num_no_patterns, no_patterns, body); RESET_ERROR_CODE(); svector<Z3_symbol> names; svector<Z3_sort> types; ptr_vector<expr> bound_asts; if (num_patterns > 0 && num_no_patterns > 0) { SET_ERROR_CODE(Z3_INVALID_USAGE); RETURN_Z3(0); } if (num_bound == 0) { SET_ERROR_CODE(Z3_INVALID_USAGE); RETURN_Z3(0); } for (unsigned i = 0; i < num_bound; ++i) { app* a = to_app(bound[i]); if (a->get_kind() != AST_APP) { SET_ERROR_CODE(Z3_INVALID_ARG); RETURN_Z3(0); } symbol s(to_app(a)->get_decl()->get_name()); names.push_back(of_symbol(s)); types.push_back(of_sort(mk_c(c)->m().get_sort(a))); bound_asts.push_back(a); if (a->get_family_id() != null_family_id || a->get_num_args() != 0) { SET_ERROR_CODE(Z3_INVALID_ARG); RETURN_Z3(0); } } // Abstract patterns svector<Z3_pattern> _patterns; expr_ref_vector pinned(mk_c(c)->m()); for (unsigned i = 0; i < num_patterns; ++i) { expr_ref result(mk_c(c)->m()); app* pat = to_pattern(patterns[i]); SASSERT(mk_c(c)->m().is_pattern(pat)); expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), pat, result); SASSERT(result.get()->get_kind() == AST_APP); pinned.push_back(result.get()); SASSERT(mk_c(c)->m().is_pattern(result.get())); _patterns.push_back(of_pattern(result.get())); } svector<Z3_ast> _no_patterns; for (unsigned i = 0; i < num_no_patterns; ++i) { expr_ref result(mk_c(c)->m()); if (!is_app(to_expr(no_patterns[i]))) { SET_ERROR_CODE(Z3_INVALID_ARG); RETURN_Z3(0); } app* pat = to_app(to_expr(no_patterns[i])); expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), pat, result); SASSERT(result.get()->get_kind() == AST_APP); pinned.push_back(result.get()); _no_patterns.push_back(of_ast(result.get())); } expr_ref abs_body(mk_c(c)->m()); expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), to_expr(body), abs_body); Z3_ast result = mk_quantifier_ex_core(c, is_forall, weight, quantifier_id, skolem_id, num_patterns, _patterns.c_ptr(), num_no_patterns, _no_patterns.c_ptr(), names.size(), types.c_ptr(), names.c_ptr(), of_ast(abs_body.get())); RETURN_Z3(result); Z3_CATCH_RETURN(0); }