当前位置: 首页>>代码示例>>C++>>正文


C++ Failure函数代码示例

本文整理汇总了C++中Failure函数的典型用法代码示例。如果您正苦于以下问题:C++ Failure函数的具体用法?C++ Failure怎么用?C++ Failure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Failure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Wr_PutC_m

static void Wr_PutC_m (
        Wr_cl   *self,
        int8_t  ch      /* IN */ )
{
    Pipe_st *st = self->st;
    bool_t ok;

    wr_enter(st);

    ok=wr_put(st, &ch, 1);

    wr_leave(st);

    if (!ok) {
	RAISE_Wr$Failure(0); /* Reader closed */
    }
}
开发者ID:berkus,项目名称:nemesis,代码行数:17,代码来源:pipe.c

示例2: Wr_PutChars_m

static void Wr_PutChars_m (
        Wr_cl   *self,
        Wr_Buffer       s       /* IN */,
        uint64_t        nb      /* IN */ )
{
    Pipe_st *st = self->st;
    bool_t ok;

    wr_enter(st);

    ok=wr_put(st, s, nb);

    wr_leave(st);

    if (!ok) {
	RAISE_Wr$Failure(0);
    }
}
开发者ID:berkus,项目名称:nemesis,代码行数:18,代码来源:pipe.c

示例3: Failure

Future<Future<Nothing>> StandaloneMasterContender::contend()
{
  if (!initialized) {
    return Failure("Initialize the contender first");
  }

  if (promise != nullptr) {
    LOG(INFO) << "Withdrawing the previous membership before recontending";
    promise->set(Nothing());
    delete promise;
  }

  // Directly return a future that is always pending because it
  // represents a membership/leadership that is not going to be lost
  // until we 'withdraw'.
  promise = new Promise<Nothing>();
  return promise->future();
}
开发者ID:EronWright,项目名称:mesos,代码行数:18,代码来源:standalone.cpp

示例4: CheckHr

void ViewTest2::TestOverlay()
{
	OLECHAR rgchGuid[] = L"F121F260";
	IVwOverlayPtr qxvoTest1, qxvoTest2;
	qxvoTest1.CreateInstance(CLSID_VwOverlay);
	qxvoTest2.CreateInstance(CLSID_VwOverlay);

	CheckHr(qxvoTest1->SetTagInfo(rgchGuid, 5, kosmAll, SmartBstr(L"DDDDD"), SmartBstr(L"WWWWW"),
		0x00003300, 0x00000000, 0x00330033, 4, true));

	m_psts->Output("  FUNCTION: put_Overlay(qxvoTest1)\n");
	CheckHr(m_qrootb->put_Overlay(qxvoTest1));

	m_psts->Output("  FUNCTION: get_Overlay(&qxvoTest2)\n");
	CheckHr(m_qrootb->get_Overlay(&qxvoTest2));
	if (qxvoTest1 != qxvoTest2)
		Failure("Overlay returned wrong result");
}
开发者ID:agran147,项目名称:FieldWorks,代码行数:18,代码来源:ViewTest.cpp

示例5: Rd_UnGetC_m

static void Rd_UnGetC_m (
        Rd_cl   *self )
{
    Pipe_st *st = self->st;
    bool_t ok;

    rd_enter(st);

    if (st->ungetc || st->lastc==-1) {
	ok=False; /* Already done an UnGetC, or no last character */
    } else {
	st->ungetc=True;
	ok=True;
    }

    rd_leave(st);
    if (!ok) RAISE_Rd$Failure(3); /* Can't unget */
}
开发者ID:berkus,项目名称:nemesis,代码行数:18,代码来源:pipe.c

示例6: _T

void CTlsSocket::ContinueShutdown()
{
	m_pOwner->LogMessage(Debug_Verbose, _T("CTlsSocket::ContinueShutdown()"));

	int res = gnutls_bye(m_session, GNUTLS_SHUT_WR);
	if (!res)
	{
		m_tlsState = closed;

		CSocketEvent *evt = new CSocketEvent(m_pEvtHandler, this, CSocketEvent::close);
		CSocketEventDispatcher::Get().SendEvent(evt);

		return;
	}

	if (res != GNUTLS_E_INTERRUPTED && res != GNUTLS_E_AGAIN)
		Failure(res, ECONNABORTED);
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:18,代码来源:tlssocket.cpp

示例7: scoreOnTestCase

    Verdict scoreOnTestCase(string testCaseName) {
        string testCaseOutputFilename = generator->getTestCasesDir() + "/" + testCaseName + ".out";

        string diffCommand = "diff --unchanged-line-format=' %.2dn    %L' --old-line-format='(expected) [line %.2dn]    %L' --new-line-format='(received) [line %.2dn]    %L' " + testCaseOutputFilename + " _submission.out | head -n 10";
        ExecutionResult result = os->execute(testCaseName + "-submission-scoring", diffCommand, "", "_diff.out", "");

        string briefDiffCommand = "diff --brief _submission.out " + testCaseOutputFilename;
        ExecutionResult briefResult = os->execute(testCaseName + "-submission-scoring-brief", briefDiffCommand, "", "", "");

        if (briefResult.exitStatus == 0) {
            return Verdict::accepted();
        } else {
            string diff = string(istreambuf_iterator<char>(*result.outputStream), istreambuf_iterator<char>());
            return Verdict::wrongAnswer({
                Failure("Diff:\n" + diff, 0)
            });
        }
    }
开发者ID:frarteaga,项目名称:tcframe,代码行数:18,代码来源:Submitter.hpp

示例8: _T

void CTlsSocket::ContinueShutdown()
{
	m_pOwner->LogMessage(MessageType::Debug_Verbose, _T("CTlsSocket::ContinueShutdown()"));

	int res = gnutls_bye(m_session, GNUTLS_SHUT_WR);
	while ((res == GNUTLS_E_INTERRUPTED || res == GNUTLS_E_AGAIN) && m_canWriteToSocket)
		res = gnutls_bye(m_session, GNUTLS_SHUT_WR);
	if (!res) {
		m_tlsState = TlsState::closed;

		m_pEvtHandler->send_event<CSocketEvent>(this, SocketEventType::close, 0);

		return;
	}

	if (res != GNUTLS_E_INTERRUPTED && res != GNUTLS_E_AGAIN)
		Failure(res, true);
}
开发者ID:aswinpj,项目名称:FileZilla,代码行数:18,代码来源:tlssocket.cpp

示例9: curl_easy_escape

bool
CAudioScrobbler::SendNowPlaying(mpd_Song* song)
{
	bool retval = false;
	if(!song || !song->artist || !song->title) return retval;

	char* artist = curl_easy_escape(_handle, song->artist, 0);
	char* title = curl_easy_escape(_handle, song->title, 0);
	char* album = 0;
	if(song->album)
		album = curl_easy_escape(_handle, song->album, 0);

	std::ostringstream query, sig;
	query << "method=track.updateNowPlaying&track=" << title << "&artist=" << artist << "&duration=" << song->time << "&api_key=" << APIKEY << "&sk=" << _sessionid;
	if(album) {
		query << "&album=" << album;
		sig << "album" << song->album;
	}

    curl_free(artist);
    curl_free(title);
    curl_free(album);

	sig << "api_key" << APIKEY << "artist" << song->artist << "duration" << song->time << "methodtrack.updateNowPlaying" << "sk" << _sessionid << "track" << song->title << SECRET;

	std::string sighash(md5sum((char*)"%s", sig.str().c_str()));

	query << "&api_sig=" << sighash;

	OpenURL(ROOTURL, query.str().c_str());

	if(_response.find("<lfm status=\"ok\">") != std::string::npos) {
		iprintf("%s", "Updated \"Now Playing\" status successfully.");
		retval = true;
	}
	else if(_response.find("<lfm status=\"failed\">") != std::string::npos) {
		eprintf("%s%s", "Last.fm returned an error while updating the currently playing track:\n", _response.c_str());
		if(CheckFailure(_response))
			Failure();
	}

	CLEANUP();
	return retval;
}
开发者ID:CustaiCo,项目名称:mpdas,代码行数:44,代码来源:audioscrobbler.cpp

示例10: TrapAccess

unsigned TrapAccess( trap_elen num_in_mx, in_mx_entry_p mx_in, trap_elen num_out_mx, mx_entry_p mx_out  )
{
    trap_retval     result;

    if( ReqFunc == NULL )
        return( (unsigned)-1 );

    result = ReqFuncProxy( num_in_mx, mx_in, num_out_mx, mx_out );
    if( result == REQUEST_FAILED ) {
        Failure();
    }
    Access();
#if defined( __WINDOWS__ ) && !defined( SERVER )
    TrapHardModeCheck();
#endif
    if( result == REQUEST_FAILED )
        return( (unsigned)-1 );
    return( result );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:19,代码来源:trpsupp.c

示例11: QObject

NetworkManager::VpnPlugin::VpnPlugin(const QString &path, QObject *parent)
    : QObject(parent), d_ptr(new VpnPluginPrivate(path))
{
    Q_D(VpnPlugin);
    d->state = (NetworkManager::VpnConnection::State)d->iface.state();

    QObject::connect(&d->iface, SIGNAL(Config(QVariantMap)),
                     this, SLOT(setConfig(QVariantMap)));
    QObject::connect(&d->iface, SIGNAL(Failure(uint)),
                     this, SLOT(setFailure(QString)));
    QObject::connect(&d->iface, SIGNAL(Ip4Config(QVariantMap)),
                     this, SLOT(setIp4Config(QVariantMap)));
    QObject::connect(&d->iface, SIGNAL(Ip6Config(QVariantMap)),
                     this, SLOT(setIp6Config(QVariantMap)));
    //QObject::connect(&d->iface, SIGNAL(LoginBanner(QString)),
    //        this, SLOT(onLoginBanner(QString)));
    QObject::connect(&d->iface, SIGNAL(StateChanged(uint)),
                     this, SLOT(onStateChanged(uint)));
}
开发者ID:KDE,项目名称:networkmanager-qt,代码行数:19,代码来源:vpnplugin.cpp

示例12: _T

void CTlsSocket::ContinueShutdown()
{
	m_pOwner->LogMessage(Debug_Verbose, _T("CTlsSocket::ContinueShutdown()"));

	int res = gnutls_bye(m_session, GNUTLS_SHUT_WR);
	if (!res)
	{
		m_tlsState = closed;

		wxSocketEvent evt(GetId());
		evt.m_event = wxSOCKET_LOST;
		wxPostEvent(m_pEvtHandler, evt);

		return;
	}

	if (res != GNUTLS_E_INTERRUPTED && res != GNUTLS_E_AGAIN)
		Failure(res);
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:19,代码来源:tlssocket.cpp

示例13: name

AvahiService::AvahiService(const QString &n, const QString &type, const QString &domain)
    : name(n)
    , port(0)
{
    static bool registeredTypes=false;
    if (!registeredTypes) {
        qDBusRegisterMetaType<QList<QByteArray> >();
        registeredTypes=true;
    }

    org::freedesktop::Avahi::Server server("org.freedesktop.Avahi", "/", QDBusConnection::systemBus());
    QDBusReply<QDBusObjectPath> reply=server.ServiceResolverNew(-1, -1, name, type, Avahi::domainToDNS(domain), -1, 8 /*AVAHI_LOOKUP_NO_ADDRESS|AVAHI_LOOKUP_NO_TXT*/);

    if (reply.isValid()) {
        resolver=new OrgFreedesktopAvahiServiceResolverInterface("org.freedesktop.Avahi", reply.value().path(), QDBusConnection::systemBus());
        connect(resolver, SIGNAL(Found(int,int,const QString &,const QString &,const QString &,const QString &, int, const QString &,ushort,const QList<QByteArray>&, uint)),
                this, SLOT(resolved(int,int,const QString &,const QString &,const QString &,const QString &, int, const QString &,ushort, const QList<QByteArray>&, uint)));
        connect(resolver, SIGNAL(Failure(QString)), this, SLOT(error(QString)));
    }
开发者ID:BinChengfei,项目名称:cantata,代码行数:19,代码来源:avahiservice.cpp

示例14: Failure

Future<Owned<T>> Shared<T>::own()
{
  // If two threads simultaneously access this object and at least one
  // of them is a write, the behavior is undefined. This is similar to
  // boost::shared_ptr. For more details, please refer to the boost
  // shared_ptr document (section "Thread Safety").
  if (data.get() == NULL) {
    return Owned<T>(NULL);
  }

  bool false_value = false;
  if (!data->owned.compare_exchange_strong(false_value, true)) {
    return Failure("Ownership has already been transferred");
  }

  Future<Owned<T>> future = data->promise.future();
  data.reset();
  return future;
}
开发者ID:447327642,项目名称:mesos,代码行数:19,代码来源:shared.hpp

示例15: _T

void CTlsSocket::ContinueShutdown()
{
	m_pOwner->LogMessage(MessageType::Debug_Verbose, _T("CTlsSocket::ContinueShutdown()"));

	int res = gnutls_bye(m_session, GNUTLS_SHUT_WR);
	while ((res == GNUTLS_E_INTERRUPTED || res == GNUTLS_E_AGAIN) && m_canWriteToSocket)
		res = gnutls_bye(m_session, GNUTLS_SHUT_WR);
	if (!res) {
		m_tlsState = TlsState::closed;

		CSocketEvent *evt = new CSocketEvent(m_pEvtHandler, this, CSocketEvent::close);
		CSocketEventSource::dispatcher_.SendEvent(evt);

		return;
	}

	if (res != GNUTLS_E_INTERRUPTED && res != GNUTLS_E_AGAIN)
		Failure(res, true);
}
开发者ID:Typz,项目名称:FileZilla,代码行数:19,代码来源:tlssocket.cpp


注:本文中的Failure函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。