本文整理汇总了C++中eh函数的典型用法代码示例。如果您正苦于以下问题:C++ eh函数的具体用法?C++ eh怎么用?C++ eh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv, const char** envp)
{
// Setup Google Breakpad exception handler
#ifdef Q_OS_LINUX
google_breakpad::ExceptionHandler eh("/tmp", NULL, Utils::exceptionHandler, NULL, true);
#endif
#ifdef Q_OS_MAC
google_breakpad::ExceptionHandler eh("/tmp", NULL, Utils::exceptionHandler, NULL, true, NULL);
#endif
QApplication app(argc, argv);
app.setWindowIcon(QIcon(":/phantomjs-icon.png"));
app.setApplicationName("PhantomJS");
app.setOrganizationName("Ofi Labs");
app.setOrganizationDomain("www.ofilabs.com");
app.setApplicationVersion(PHANTOMJS_VERSION_STRING);
// Prepare the "env" singleton using the environment variables
Env::instance()->parse(envp);
// Get the Phantom singleton
Phantom *phantom = Phantom::instance();
// Registering an alternative Message Handler
Utils::printDebugMessages = phantom->printDebugMessages();
qInstallMsgHandler(Utils::messageHandler);
signal(SIGALRM, timeout);
FILE *in;
in = fopen("timeout.txt", "r");
if (in) {
int t;
fscanf(in, "%d", &t);
alarm(t);
fclose(in);
}
// Start script execution
if (phantom->execute()) {
app.exec();
}
alarm(0);
// End script execution: delete the phantom singleton and set execution return value
int retVal = phantom->returnValue();
delete phantom;
return retVal;
}
开发者ID:hadesgames,项目名称:phantomjs,代码行数:50,代码来源:main.cpp
示例2: RequireFeature
static cell_t RequireFeature(IPluginContext *pContext, const cell_t *params)
{
FeatureType type = (FeatureType)params[1];
char *name;
pContext->LocalToString(params[2], &name);
if (sharesys->TestFeature(pContext->GetRuntime(), type, name) != FeatureStatus_Available)
{
char buffer[255];
char *msg = buffer;
char default_message[255];
SMPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
DetectExceptions eh(pContext);
g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 3);
if (eh.HasException())
buffer[0] = '\0';
if (buffer[0] == '\0') {
g_pSM->Format(default_message, sizeof(default_message), "Feature \"%s\" not available", name);
msg = default_message;
}
pPlugin->SetErrorState(Plugin_Error, "%s", msg);
if (!eh.HasException())
pContext->ReportFatalError("%s", msg);
return 0;
}
return 1;
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:32,代码来源:smn_core.cpp
示例3: Z3_algebraic_eval
int Z3_API Z3_algebraic_eval(Z3_context c, Z3_ast p, unsigned n, Z3_ast a[]) {
Z3_TRY;
LOG_Z3_algebraic_eval(c, p, n, a);
RESET_ERROR_CODE();
polynomial::manager & pm = mk_c(c)->pm();
polynomial_ref _p(pm);
polynomial::scoped_numeral d(pm.m());
expr2polynomial converter(mk_c(c)->m(), pm, 0, true);
if (!converter.to_polynomial(to_expr(p), _p, d) ||
static_cast<unsigned>(max_var(_p)) >= n) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
algebraic_numbers::manager & _am = am(c);
scoped_anum_vector as(_am);
if (!to_anum_vector(c, n, a, as)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
{
cancel_eh<algebraic_numbers::manager> eh(_am);
api::context::set_interruptable si(*(mk_c(c)), eh);
scoped_timer timer(mk_c(c)->params().m_timeout, &eh);
vector_var2anum v2a(as);
int r = _am.eval_sign_at(_p, v2a);
if (r > 0) return 1;
else if (r < 0) return -1;
else return 0;
}
Z3_CATCH_RETURN(0);
}
开发者ID:CHolmes3,项目名称:z3,代码行数:31,代码来源:api_algebraic.cpp
示例4: SetFailState
static cell_t SetFailState(IPluginContext *pContext, const cell_t *params)
{
char *str;
SMPlugin *pPlugin;
pContext->LocalToString(params[1], &str);
pPlugin = scripts->FindPluginByContext(pContext->GetContext());
if (params[0] == 1)
{
pPlugin->SetErrorState(Plugin_Failed, "%s", str);
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", str);
}
else
{
char buffer[2048];
{
DetectExceptions eh(pContext);
g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 1);
if (eh.HasException()) {
pPlugin->SetErrorState(Plugin_Failed, "%s", str);
return 0;
}
pPlugin->SetErrorState(Plugin_Failed, "%s", buffer);
pContext->ReportFatalError("%s", buffer);
return 0;
}
}
return 0;
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:33,代码来源:smn_core.cpp
示例5: _solver_check
static Z3_lbool _solver_check(Z3_context c, Z3_solver s, unsigned num_assumptions, Z3_ast const assumptions[]) {
for (unsigned i = 0; i < num_assumptions; i++) {
if (!is_expr(to_ast(assumptions[i]))) {
SET_ERROR_CODE(Z3_INVALID_ARG, "assumption is not an expression");
return Z3_L_UNDEF;
}
}
expr * const * _assumptions = to_exprs(assumptions);
unsigned timeout = to_solver(s)->m_params.get_uint("timeout", mk_c(c)->get_timeout());
unsigned rlimit = to_solver(s)->m_params.get_uint("rlimit", mk_c(c)->get_rlimit());
bool use_ctrl_c = to_solver(s)->m_params.get_bool("ctrl_c", false);
cancel_eh<reslimit> eh(mk_c(c)->m().limit());
api::context::set_interruptable si(*(mk_c(c)), eh);
lbool result;
{
scoped_ctrl_c ctrlc(eh, false, use_ctrl_c);
scoped_timer timer(timeout, &eh);
scoped_rlimit _rlimit(mk_c(c)->m().limit(), rlimit);
try {
result = to_solver_ref(s)->check_sat(num_assumptions, _assumptions);
}
catch (z3_exception & ex) {
to_solver_ref(s)->set_reason_unknown(eh);
if (!mk_c(c)->m().canceled()) {
mk_c(c)->handle_exception(ex);
}
return Z3_L_UNDEF;
}
}
if (result == l_undef) {
to_solver_ref(s)->set_reason_unknown(eh);
}
return static_cast<Z3_lbool>(result);
}
开发者ID:levnach,项目名称:z3,代码行数:34,代码来源:api_solver.cpp
示例6: _settings
Server::Server(Settings& settings) :
_settings(settings),
_admMessageQueue(new Tools::SimpleMessageQueue(1))
{
Tools::debug << "Server::Server()\n";
this->_rcon = new Rcon::Rcon(*this);
this->_resourceManager = new Database::ResourceManager(*this);
this->_clientManager = new ClientManagement::ClientManager(*this, *this->_admMessageQueue);
this->_game = new Game::Game(*this, *this->_admMessageQueue);
Network::Network::NewConnectionHandler
nch(std::bind(&ClientManagement::ClientManager::HandleNewClient,
this->_clientManager,
std::placeholders::_1,
std::placeholders::_2));
Network::Network::PacketHandler
ph(std::bind(&ClientManagement::ClientManager::HandlePacket,
this->_clientManager,
std::placeholders::_1,
std::placeholders::_2));
Network::Network::ErrorHandler
eh(std::bind(&ClientManagement::ClientManager::HandleClientError,
this->_clientManager,
std::placeholders::_1));
this->_network = new Network::Network(*this, nch, ph, eh);
}
开发者ID:Pocsel,项目名称:pocsel,代码行数:26,代码来源:Server.cpp
示例7: main
int main(int argc, char* argv[]) {
google_breakpad::MinidumpDescriptor descriptor(".");
google_breakpad::ExceptionHandler eh(descriptor, NULL, DumpCallback,
NULL, true, -1);
Crash();
return 0;
}
开发者ID:mpercy,项目名称:breakpad,代码行数:7,代码来源:test_breakpad.cpp
示例8: execute
virtual void execute(cmd_context & ctx) {
if (m_target == 0)
throw cmd_exception("invalid simplify command, argument expected");
expr_ref r(ctx.m());
proof_ref pr(ctx.m());
if (m_params.get_bool("som", false))
m_params.set_bool("flat", true);
th_rewriter s(ctx.m(), m_params);
unsigned cache_sz;
unsigned num_steps = 0;
unsigned timeout = m_params.get_uint("timeout", UINT_MAX);
unsigned rlimit = m_params.get_uint("rlimit", UINT_MAX);
bool failed = false;
cancel_eh<reslimit> eh(ctx.m().limit());
{
scoped_rlimit _rlimit(ctx.m().limit(), rlimit);
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
cmd_context::scoped_watch sw(ctx);
try {
s(m_target, r, pr);
}
catch (z3_error & ex) {
throw ex;
}
catch (z3_exception & ex) {
ctx.regular_stream() << "(error \"simplifier failed: " << ex.msg() << "\")" << std::endl;
failed = true;
r = m_target;
}
cache_sz = s.get_cache_size();
num_steps = s.get_num_steps();
s.cleanup();
}
if (m_params.get_bool("print", true)) {
ctx.display(ctx.regular_stream(), r);
ctx.regular_stream() << std::endl;
}
if (!failed && m_params.get_bool("print_proofs", false)) {
ast_smt_pp pp(ctx.m());
pp.set_logic(ctx.get_logic().str().c_str());
pp.display_expr_smt2(ctx.regular_stream(), pr.get());
ctx.regular_stream() << std::endl;
}
if (m_params.get_bool("print_statistics", false)) {
shared_occs s1(ctx.m());
if (!failed)
s1(r);
unsigned long long max_mem = memory::get_max_used_memory();
unsigned long long mem = memory::get_allocation_size();
ctx.regular_stream() << "(:time " << std::fixed << std::setprecision(2) << ctx.get_seconds() << " :num-steps " << num_steps
<< " :memory " << std::fixed << std::setprecision(2) << static_cast<double>(mem)/static_cast<double>(1024*1024)
<< " :max-memory " << std::fixed << std::setprecision(2) << static_cast<double>(max_mem)/static_cast<double>(1024*1024)
<< " :cache-size: " << cache_sz
<< " :num-nodes-before " << get_num_exprs(m_target);
if (!failed)
ctx.regular_stream() << " :num-shared " << s1.num_shared() << " :num-nodes " << get_num_exprs(r);
ctx.regular_stream() << ")" << std::endl;
}
}
开发者ID:perillaseed,项目名称:z3,代码行数:60,代码来源:simplify_cmd.cpp
示例9: Z3_algebraic_roots
Z3_ast_vector Z3_API Z3_algebraic_roots(Z3_context c, Z3_ast p, unsigned n, Z3_ast a[]) {
Z3_TRY;
LOG_Z3_algebraic_roots(c, p, n, a);
RESET_ERROR_CODE();
polynomial::manager & pm = mk_c(c)->pm();
polynomial_ref _p(pm);
polynomial::scoped_numeral d(pm.m());
expr2polynomial converter(mk_c(c)->m(), pm, 0, true);
if (!converter.to_polynomial(to_expr(p), _p, d) ||
static_cast<unsigned>(max_var(_p)) >= n + 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
algebraic_numbers::manager & _am = am(c);
scoped_anum_vector as(_am);
if (!to_anum_vector(c, n, a, as)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
scoped_anum_vector roots(_am);
{
cancel_eh<algebraic_numbers::manager> eh(_am);
api::context::set_interruptable si(*(mk_c(c)), eh);
scoped_timer timer(mk_c(c)->params().m_timeout, &eh);
vector_var2anum v2a(as);
_am.isolate_roots(_p, v2a, roots);
}
Z3_ast_vector_ref* result = alloc(Z3_ast_vector_ref, mk_c(c)->m());
mk_c(c)->save_object(result);
for (unsigned i = 0; i < roots.size(); i++) {
result->m_ast_vector.push_back(au(c).mk_numeral(roots.get(i), false));
}
RETURN_Z3(of_ast_vector(result));
Z3_CATCH_RETURN(0);
}
开发者ID:CHolmes3,项目名称:z3,代码行数:35,代码来源:api_algebraic.cpp
示例10: Z3_check_and_get_model
Z3_lbool Z3_API Z3_check_and_get_model(Z3_context c, Z3_model * m) {
Z3_TRY;
LOG_Z3_check_and_get_model(c, m);
RESET_ERROR_CODE();
CHECK_SEARCHING(c);
cancel_eh<smt::kernel> eh(mk_c(c)->get_smt_kernel());
api::context::set_interruptable(*(mk_c(c)), eh);
flet<bool> _model(mk_c(c)->fparams().m_model, true);
lbool result;
try {
model_ref _m;
result = mk_c(c)->check(_m);
if (m) {
if (_m) {
Z3_model_ref * m_ref = alloc(Z3_model_ref);
m_ref->m_model = _m;
// Must bump reference counter for backward compatibility reasons.
// Don't need to invoke save_object, since the counter was bumped
m_ref->inc_ref();
*m = of_model(m_ref);
}
else {
*m = 0;
}
}
}
catch (z3_exception & ex) {
mk_c(c)->handle_exception(ex);
RETURN_Z3_check_and_get_model static_cast<Z3_lbool>(l_undef);
}
RETURN_Z3_check_and_get_model static_cast<Z3_lbool>(result);
Z3_CATCH_RETURN(Z3_L_UNDEF);
}
开发者ID:CharudattaSChitale,项目名称:sygus-comp14,代码行数:33,代码来源:api_solver_old.cpp
示例11: _tactic_apply
static Z3_apply_result _tactic_apply(Z3_context c, Z3_tactic t, Z3_goal g, params_ref p) {
goal_ref new_goal;
new_goal = alloc(goal, *to_goal_ref(g));
Z3_apply_result_ref * ref = alloc(Z3_apply_result_ref, mk_c(c)->m());
mk_c(c)->save_object(ref);
unsigned timeout = p.get_uint("timeout", UINT_MAX);
bool use_ctrl_c = p.get_bool("ctrl_c", false);
cancel_eh<reslimit> eh(mk_c(c)->m().limit());
to_tactic_ref(t)->updt_params(p);
api::context::set_interruptable si(*(mk_c(c)), eh);
{
scoped_ctrl_c ctrlc(eh, false, use_ctrl_c);
scoped_timer timer(timeout, &eh);
try {
exec(*to_tactic_ref(t), new_goal, ref->m_subgoals, ref->m_mc, ref->m_pc, ref->m_core);
return of_apply_result(ref);
}
catch (z3_exception & ex) {
mk_c(c)->handle_exception(ex);
return 0;
}
}
}
开发者ID:EinNarr,项目名称:z3,代码行数:26,代码来源:api_tactic.cpp
示例12: kDebug
void KNewStuff2Test::entryTest()
{
kDebug() << "-- test kns2 entry class";
QDomDocument doc;
QFile f(QString("%1/testdata/entry.xml").arg(KNSSRCDIR));
if (!f.open(QIODevice::ReadOnly)) {
kDebug() << "Error loading entry file.";
quitTest();
}
if (!doc.setContent(&f)) {
kDebug() << "Error parsing entry file.";
f.close();
quitTest();
}
f.close();
KNS::EntryHandler eh(doc.documentElement());
KNS::Entry e = eh.entry();
kDebug() << "-- xml->entry test result: " << eh.isValid();
KNS::EntryHandler eh2(e);
QDomElement exml = eh2.entryXML();
kDebug() << "-- entry->xml test result: " << eh.isValid();
if (!eh.isValid()) {
quitTest();
} else {
QTextStream out(stdout);
out << exml;
}
}
开发者ID:vasi,项目名称:kdelibs,代码行数:34,代码来源:knewstuff2_test.cpp
示例13: PrintHintText
static cell_t PrintHintText(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
if (!pPlayer->IsInGame())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
}
g_SourceMod.SetGlobalTarget(client);
char buffer[254];
{
DetectExceptions eh(pContext);
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
if (eh.HasException())
return 0;
}
if (!g_HL2.HintTextMsg(client, buffer))
{
return pContext->ThrowNativeError("Could not send a usermessage");
}
return 1;
}
开发者ID:FlaminSarge,项目名称:sourcemod,代码行数:32,代码来源:smn_halflife.cpp
示例14: LogToFileEx
static cell_t LogToFileEx(IPluginContext *pContext, const cell_t *params)
{
char *file;
pContext->LocalToString(params[1], &file);
char path[PLATFORM_MAX_PATH];
g_pSM->BuildPath(Path_Game, path, sizeof(path), "%s", file);
FILE *fp = fopen(path, "at");
if (!fp)
{
return pContext->ThrowNativeError("Could not open file \"%s\"", path);
}
char buffer[2048];
{
DetectExceptions eh(pContext);
g_pSM->SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 2);
if (eh.HasException()) {
fclose(fp);
return 0;
}
}
g_Logger.LogToOpenFile(fp, "%s", buffer);
fclose(fp);
return 1;
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:31,代码来源:smn_core.cpp
示例15: execute
virtual void execute(cmd_context& ctx) {
if (m_target == 0) {
throw cmd_exception("invalid query command, argument expected");
}
datalog::context& dlctx = m_dl_ctx->get_dl_context();
set_background(ctx);
dlctx.updt_params(m_params);
unsigned timeout = m_params.get_uint(":timeout", UINT_MAX);
cancel_eh<datalog::context> eh(dlctx);
lbool status = l_undef;
{
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
cmd_context::scoped_watch sw(ctx);
try {
status = dlctx.query(m_target);
}
catch (z3_error & ex) {
throw ex;
}
catch (z3_exception& ex) {
ctx.regular_stream() << "(error \"query failed: " << ex.msg() << "\")" << std::endl;
}
dlctx.cleanup();
}
switch (status) {
case l_false:
ctx.regular_stream() << "unsat\n";
print_certificate(ctx);
break;
case l_true:
ctx.regular_stream() << "sat\n";
print_answer(ctx);
print_certificate(ctx);
break;
case l_undef:
ctx.regular_stream() << "unknown\n";
switch(dlctx.get_status()) {
case datalog::INPUT_ERROR:
break;
case datalog::MEMOUT:
ctx.regular_stream() << "memory bounds exceeded\n";
break;
case datalog::TIMEOUT:
ctx.regular_stream() << "timeout\n";
break;
case datalog::OK:
break;
default:
UNREACHABLE();
}
break;
}
print_statistics(ctx);
m_target = 0;
}
开发者ID:sukwon0709,项目名称:byterun,代码行数:59,代码来源:dl_cmds.cpp
示例16: Z3_solver_get_consequences
Z3_lbool Z3_API Z3_solver_get_consequences(Z3_context c,
Z3_solver s,
Z3_ast_vector assumptions,
Z3_ast_vector variables,
Z3_ast_vector consequences) {
Z3_TRY;
LOG_Z3_solver_get_consequences(c, s, assumptions, variables, consequences);
ast_manager& m = mk_c(c)->m();
RESET_ERROR_CODE();
CHECK_SEARCHING(c);
init_solver(c, s);
expr_ref_vector _assumptions(m), _consequences(m), _variables(m);
ast_ref_vector const& __assumptions = to_ast_vector_ref(assumptions);
for (ast* e : __assumptions) {
if (!is_expr(e)) {
_assumptions.finalize(); _consequences.finalize(); _variables.finalize();
SET_ERROR_CODE(Z3_INVALID_USAGE, "assumption is not an expression");
return Z3_L_UNDEF;
}
_assumptions.push_back(to_expr(e));
}
ast_ref_vector const& __variables = to_ast_vector_ref(variables);
for (ast* a : __variables) {
if (!is_expr(a)) {
_assumptions.finalize(); _consequences.finalize(); _variables.finalize();
SET_ERROR_CODE(Z3_INVALID_USAGE, "variable is not an expression");
return Z3_L_UNDEF;
}
_variables.push_back(to_expr(a));
}
lbool result = l_undef;
unsigned timeout = to_solver(s)->m_params.get_uint("timeout", mk_c(c)->get_timeout());
unsigned rlimit = to_solver(s)->m_params.get_uint("rlimit", mk_c(c)->get_rlimit());
bool use_ctrl_c = to_solver(s)->m_params.get_bool("ctrl_c", false);
cancel_eh<reslimit> eh(mk_c(c)->m().limit());
api::context::set_interruptable si(*(mk_c(c)), eh);
{
scoped_ctrl_c ctrlc(eh, false, use_ctrl_c);
scoped_timer timer(timeout, &eh);
scoped_rlimit _rlimit(mk_c(c)->m().limit(), rlimit);
try {
result = to_solver_ref(s)->get_consequences(_assumptions, _variables, _consequences);
}
catch (z3_exception & ex) {
to_solver_ref(s)->set_reason_unknown(eh);
_assumptions.finalize(); _consequences.finalize(); _variables.finalize();
mk_c(c)->handle_exception(ex);
return Z3_L_UNDEF;
}
}
if (result == l_undef) {
to_solver_ref(s)->set_reason_unknown(eh);
}
for (expr* e : _consequences) {
to_ast_vector_ref(consequences).push_back(e);
}
return static_cast<Z3_lbool>(result);
Z3_CATCH_RETURN(Z3_L_UNDEF);
}
开发者ID:levnach,项目名称:z3,代码行数:59,代码来源:api_solver.cpp
示例17: main
int main(int argc, char *argv[]) {
google_breakpad::MinidumpDescriptor descriptor("/tmp");
google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL,
true, -1);
printf("pid: %d\n", getpid());
crash();
return 0;
}
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:8,代码来源:linux-x86_64.cpp
示例18: tst_sat_local_search
void tst_sat_local_search(char ** argv, int argc, int& i) {
if (argc < i + 2) {
std::cout << "require dimacs file name\n";
return;
}
reslimit limit;
params_ref params;
sat::solver solver(params, limit);
sat::local_search local_search;
local_search.import(solver, true);
char const* file_name = argv[i + 1];
++i;
int cutoff_time = 1;
int v;
while (i + 1 < argc) {
std::cout << argv[i + 1] << "\n";
// set other ad hoc parameters.
if (argv[i + 1][0] == '-' && i + 2 < argc) {
switch (argv[i + 1][1]) {
case 's': // seed
v = atoi(argv[i + 2]);
local_search.config().set_random_seed(v);
break;
case 't': // cutoff_time
v = atoi(argv[i + 2]);
cutoff_time = v;
break;
case 'b': // best_known_value
v = atoi(argv[i + 2]);
local_search.config().set_best_known_value(v);
break;
default:
++i;
v = -1;
break;
}
}
++i;
}
if (!build_instance(file_name, solver, local_search)) {
return;
}
//std::cout << "local instance built\n";
// set up cancellation/timeout environment.
cancel_eh<reslimit> eh(local_search.rlimit());
scoped_ctrl_c ctrlc(eh, false, true);
scoped_timer timer(cutoff_time*1000, &eh);
local_search.check();
}
开发者ID:bishoksan,项目名称:z3,代码行数:58,代码来源:sat_local_search.cpp
示例19: eh
void EditMode::slotAddHeadClicked()
{
EditHead eh(this, QLCFixtureHead(), m_mode);
if (eh.exec() == QDialog::Accepted)
{
m_mode->insertHead(-1, eh.head());
refreshHeadList();
}
}
开发者ID:jeromelebleu,项目名称:qlcplus,代码行数:9,代码来源:editmode.cpp
示例20: StartTrace
void LDAPConnectionTest::ConnectionTest()
{
StartTrace(LDAPConnectionTest.ConnectionTest);
ROAnything cConfig;
AnyExtensions::Iterator<ROAnything> aEntryIterator(GetTestCaseConfig());
while ( aEntryIterator.Next(cConfig) ) {
for ( long l = 0; l < cConfig["NumberOfConnects"].AsLong(1); l++ ) {
Anything params;
params["Server"] = cConfig["LDAPServer"].AsString();
params["Port"] = cConfig["LDAPPort"].AsLong();
params["Timeout"] = cConfig["LDAPTimeout"].AsLong();
params["ConnectionTimeout"] = cConfig["LDAPConnectionTimeout"].AsLong(0);
params["BindName"] = cConfig["LDAPBindName"].AsString();
params["BindPW"] = cConfig["LDAPBindPW"].AsString();
params["PooledConnections"] = cConfig["LDAPPooledConnections"].AsLong(0L);
params["RebindTimeout"] = cConfig["LDAPRebindTimeout"].AsLong(3600L);
params["TryAutoRebind"] = cConfig["LDAPTryAutoRebind"].AsLong(0L);
params["MaxConnections"] = cConfig["LDAPMaxConnections"].AsLong(2L);
Context ctx;
ParameterMapper pm("ConnectionTestParameterMapper");
ResultMapper rm("ConnectionTestResultMapper");
pm.Initialize("ParameterMapper");
rm.Initialize("ResultMapper");
String da("DataAccess_");
da << aEntryIterator.Index();
LDAPErrorHandler eh(ctx, &pm, &rm, da);
eh.PutConnectionParams(params);
// connect
LDAPConnection lc(params);
LDAPConnection::EConnectState eConnectState = lc.DoConnect(params, eh);
String result(LDAPConnection::ConnectRetToString(eConnectState));
Trace("Connect result: " << result);
// check for errors
Anything error;
if ( !eh.GetError(error) ) {
Trace("No error reported.");
} else {
TraceAny(error, "Error description:");
}
// compare result and expected error
assertEqual(cConfig["ConnectRet"].AsString(), result);
bool ret = LDAPConnection::IsConnectOk(eConnectState);
assertEqual(cConfig["ConnectIsOk"].AsBool(1), ret);
if (!ret) {
String where;
aEntryIterator.SlotName(where);
assertAnyCompareEqual(cConfig["Error"], error, String(getConfigFileName()) << ":" << where, '.',':');
}
// now release sema and lock
lc.ReleaseHandleInfo();
}
}
}
开发者ID:chenbk85,项目名称:CuteTestForCoastTest,代码行数:57,代码来源:LDAPConnectionTest.cpp
注:本文中的eh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论