• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Failed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: disconnect

bool InstallWindow::Step2Finished()
{
    ui->animationLabel->hide();
    _movie.stop();
    disconnect(&_proc2, SIGNAL(finished(int)), this, SLOT(Step2Finished()));

    if (_proc2.exitCode() != 0)
        return Failed(tr("Cannot parse JSON: ") +
                   QString::fromLocal8Bit(_proc2.readAllStandardError()));

    QString result = QString::fromLocal8Bit(_proc2.readAllStandardOutput());

    // Parse returned Json answer
    if (!_game->ParseJson(result))
        return Failed(tr("Error parsing appinfo.json!"));

    // Check if ID matches
    QRegExp rx(_game->ID());
    if (!_game->JsonID().contains(rx))
        return Failed(tr("Seems to be wrong game or naming error!<br />"
                         "Ipk ID: %1<br />"
                         "Expected ID mask: %2")
                      .arg(_game->JsonID())
                      .arg(_game->ID()));

    PrintOK(_game->JsonTitle() + " " +
            _game->JsonVersion() + tr(" by ") +
            _game->JsonVendor());

    return Step3PrepareDirs();
}
开发者ID:divan,项目名称:wgames,代码行数:31,代码来源:installwindow.cpp


示例2: gfxCriticalError

bool
CompositorD3D11::UpdateConstantBuffers()
{
  HRESULT hr;
  D3D11_MAPPED_SUBRESOURCE resource;
  resource.pData = nullptr;

  hr = mContext->Map(mAttachments->mVSConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
  if (Failed(hr) || !resource.pData) {
    gfxCriticalError() << "Failed to map VSConstantBuffer. Result: " << hr;
    return false;
  }
  *(VertexShaderConstants*)resource.pData = mVSConstants;
  mContext->Unmap(mAttachments->mVSConstantBuffer, 0);
  resource.pData = nullptr;

  hr = mContext->Map(mAttachments->mPSConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
  if (Failed(hr) || !resource.pData) {
    gfxCriticalError() << "Failed to map PSConstantBuffer. Result: " << hr;
    return false;
  }
  *(PixelShaderConstants*)resource.pData = mPSConstants;
  mContext->Unmap(mAttachments->mPSConstantBuffer, 0);

  ID3D11Buffer *buffer = mAttachments->mVSConstantBuffer;

  mContext->VSSetConstantBuffers(0, 1, &buffer);

  buffer = mAttachments->mPSConstantBuffer;
  mContext->PSSetConstantBuffers(0, 1, &buffer);
  return true;
}
开发者ID:alexey-kalashnikov,项目名称:gecko-dev,代码行数:32,代码来源:CompositorD3D11.cpp


示例3: Failed

void CTraverseBySourceExchange::SendPacket()
{
	m_bFailed = m_dwState & NAT_E_NOPEER;

	try
	{
		if(!m_bFailed && (m_dwState&NAT_S_SYNC)==0 && time(NULL)-m_SendReqTime > m_dwNextSyncInterval) //  5 seconds
		{
			//  failed to connect
			if(m_nSendReqCount > SYNC_ATTEMPT_TIMES)
			{
				m_dwState|=NAT_E_TIMEOUT;
				Failed();
			}
			else
			{
				if(m_nSendReqCount==0)
					_AddLogLine(false, _T("Begin to connect %s."), UserHashToString(m_UserHash));
				SendConnectReq();
			}
		}

		if(m_bFailed)
		{
			if(m_Sock)// && pClientSock->client)
			{
				//m_Sock->m_bUseNat = false;
			}

			if(m_dwState & NAT_E_NOPEER)
			{
				_AddLogLine(false, _T("Unconnected NatSock was deleted. server return E_NOPEER. %s."), UserHashToString(m_UserHash));
			}
			else
			{
				_AddLogLine(false, _T("Unconnected NatSock was deleted. time out. %s."), UserHashToString(m_UserHash));
			}
		}

		if(m_dwState & NAT_S_SYNC && time(NULL)-m_SendPingTime > PING_ATTEMPT_INTERVAL)
		{
			if(m_nPassivePing> PING_ATTEMPT_TIMES)
			{
				_AddLogLine(false, _T("Passive Unconnected NatSock was deleted. timeout. %s."), UserHashToString(m_UserHash));
				Failed();
			}
			else 
			{
				SendPingPacket();
			}
		}
	}
	catch(...)
	{
		//  the CAsyncSocketEx maybe is deleted
		Failed();
	}
}
开发者ID:techpub,项目名称:archive-code,代码行数:58,代码来源:TraverseBySourceExchange.cpp


示例4: FT_GetStatus

int CKMotionIO::NumberBytesAvailToRead(int *navail, bool ShowMessage)
{
	FT_STATUS ftStatus;
	DWORD EventDWord;
	DWORD RxBytes;
	DWORD TxBytes;

	*navail = strlen(m_SaveChars);  // take into account any already read in
	
	Mutex->Lock();
	ftStatus = FT_GetStatus(ftHandle,&RxBytes,&TxBytes,&EventDWord);

	if (ftStatus != FT_OK) 
	{
		if (ShowMessage)
			Failed();
		else
			m_Connected=false;

		Mutex->Unlock();
		return 1;
	}
	else
	{
		*navail+=(int)RxBytes;
		Mutex->Unlock();
		return 0;
	}
}
开发者ID:tedenda,项目名称:KMotionX,代码行数:29,代码来源:KmotionIO.cpp


示例5: Update

 /* ---------------------------------------------------------------------------------------------
  * Send the payload to the associated server to keep the server alive in the master-list.
 */
 void Update(mg_mgr * manager)
 {
     // Is there a connection already waiting response and are we allowed to update?
     if (m_Conn || !m_Valid)
     {
         return; // Keep waiting for a reply and ignore this request
     }
     // Attempt to create a connection to the associated master-server
     m_Conn = mg_connect(manager, m_Addr.Addr(), EventHandler);
     // Make sure that the connection could be created
     if (!m_Conn)
     {
         MtVerboseError("Unable to create connection for '%s'", m_Addr.Addr());
         // This operation failed
         Failed();
     }
     else
     {
         // Set associated connection user data to this instance
         m_Conn->user_data = this;
         // Attach the HTTP protocol component
         mg_set_protocol_http_websocket(m_Conn);
         // Send the payload data
         mg_printf(m_Conn, "%s", m_Data);
         // Verbose status
         MtVerboseMessage("Connection created for '%s'", m_Addr.Addr());
     }
 }
开发者ID:iSLC,项目名称:VCMP-Announce,代码行数:31,代码来源:Main.cpp


示例6: MOZ_ASSERT

TemporaryRef<CompositingRenderTarget>
CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect,
                                    SurfaceInitMode aInit)
{
  MOZ_ASSERT(aRect.width != 0 && aRect.height != 0);

  if (aRect.width * aRect.height == 0) {
    return nullptr;
  }

  CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1,
                             D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);

  RefPtr<ID3D11Texture2D> texture;
  HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
  if (Failed(hr) || !texture) {
    return nullptr;
  }

  RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture, aRect.TopLeft());
  rt->SetSize(IntSize(aRect.width, aRect.height));

  if (aInit == INIT_MODE_CLEAR) {
    FLOAT clear[] = { 0, 0, 0, 0 };
    mContext->ClearRenderTargetView(rt->mRTView, clear);
  }

  return rt;
}
开发者ID:msliu,项目名称:gecko-dev,代码行数:29,代码来源:CompositorD3D11.cpp


示例7: Close

void Site::OnConnect(int iErrorCode)
{
    CIoKnockDlg *pDlg = theApp.GetDialog();

    if (!iErrorCode)
    {
        Close();
        m_bCloseNeeded = false;

        pDlg->SetKnock(m_dwCurrentKnock+1, true, _T("Knocked"));
        m_dwCurrentKnock++;
        NextKnock();
        return;
    }

    CString err;
    switch(iErrorCode)
    {
    case WSAECONNREFUSED:
        err.Format(_T("Error: Rejected"));
        break;
    case WSAENETUNREACH:
        err.Format(_T("Error: Unreachable"));
        break;
    case WSAETIMEDOUT:
        err.Format(_T("Error: Timeout"));
        break;
    default:
        err.Format(_T("Error: #%d"), iErrorCode);
    }
    pDlg->SetKnock(m_dwCurrentKnock+1, false, err);

    Failed(SITE_TIMEDOUT);
    pDlg->KnockDone();
}
开发者ID:as2120,项目名称:ZioFtpd,代码行数:35,代码来源:Site.cpp


示例8: HandleError

void
CompositorD3D11::VerifyBufferSize()
{
  DXGI_SWAP_CHAIN_DESC swapDesc;
  HRESULT hr;

  hr = mSwapChain->GetDesc(&swapDesc);
  if (Failed(hr)) {
    return;
  }

  if ((swapDesc.BufferDesc.Width == mSize.width &&
       swapDesc.BufferDesc.Height == mSize.height) ||
      mSize.width <= 0 || mSize.height <= 0) {
    return;
  }

  mDefaultRT = nullptr;

  if (IsRunningInWindowsMetro()) {
    hr = mSwapChain->ResizeBuffers(2, mSize.width, mSize.height,
                                   DXGI_FORMAT_B8G8R8A8_UNORM,
                                   0);
    HandleError(hr);
    mDisableSequenceForNextFrame = true;
  } else {
    hr = mSwapChain->ResizeBuffers(1, mSize.width, mSize.height,
                                   DXGI_FORMAT_B8G8R8A8_UNORM,
                                   0);
    HandleError(hr);
  }
}
开发者ID:msliu,项目名称:gecko-dev,代码行数:32,代码来源:CompositorD3D11.cpp


示例9: alarm

void XITServerTest::TearDown() {
    alarm(0);
    if (server.Pid() != -1) {
        if (!server.Terminate(3000))
            server.Kill(3000);
        EXPECT_EQ(server.GetState(), xorg::testing::Process::FINISHED_SUCCESS) << "Unclean server shutdown";
        failed = failed || (server.GetState() != xorg::testing::Process::FINISHED_SUCCESS);

        std::ifstream logfile(server.GetLogFilePath().c_str());
        std::string line;
        std::string bug_warn("BUG");
        if (logfile.is_open()) {
            while(getline(logfile, line)) {
                size_t found = line.find(bug_warn);
                bool error = (found != std::string::npos);
                EXPECT_FALSE(error) << "BUG warning found in log" << std::endl << line << std::endl;
                failed = failed || error;
                break;
            }
        }
    }

    if (!Failed()) {
        config.RemoveConfig();
        server.RemoveLogFile();
    }

    testing::TestEventListeners &listeners = ::testing::UnitTest::GetInstance()->listeners();
    listeners.Release(this);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__test__xorg-integration-tests,代码行数:30,代码来源:xit-server-test.cpp


示例10: LogFailure

void ezStatus::LogFailure(ezLogInterface* pLog)
{
  if (Failed())
  {
    ezLogInterface* pInterface = pLog ? pLog : ezLog::GetThreadLocalLogSystem();
    ezLog::Error(pInterface, "{0}", m_sMessage);
  }
}
开发者ID:ezEngine,项目名称:ezEngine,代码行数:8,代码来源:Status.cpp


示例11: VerifyResult

void VerifyResult(nsresult rv)
{
    if (NS_FAILED(rv))
    {
        Failed("rv failed");
        printf("rv = %d\n", rv);
    }
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:8,代码来源:nsIFileTest.cpp


示例12: CheckTime

void CInstance::CheckTime(uint32 tick)
{
	if (m_lastTimeCheck + 1000 <= tick && !Failed())
	{
		luautils::OnInstanceTimeUpdate(m_zone, this, GetElapsedTime(tick));
		m_lastTimeCheck = tick;
	}
}
开发者ID:Celyste,项目名称:darkstar,代码行数:8,代码来源:instance.cpp


示例13: __uuidof

void
CompositorD3D11::PaintToTarget()
{
  nsRefPtr<ID3D11Texture2D> backBuf;
  HRESULT hr;

  hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment());
  if (Failed(hr)) {
    return;
  }

  D3D11_TEXTURE2D_DESC bbDesc;
  backBuf->GetDesc(&bbDesc);

  CD3D11_TEXTURE2D_DESC softDesc(bbDesc.Format, bbDesc.Width, bbDesc.Height);
  softDesc.MipLevels = 1;
  softDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
  softDesc.Usage = D3D11_USAGE_STAGING;
  softDesc.BindFlags = 0;

  nsRefPtr<ID3D11Texture2D> readTexture;

  hr = mDevice->CreateTexture2D(&softDesc, nullptr, getter_AddRefs(readTexture));
  if (Failed(hr)) {
    return;
  }
  mContext->CopyResource(readTexture, backBuf);

  D3D11_MAPPED_SUBRESOURCE map;
  hr = mContext->Map(readTexture, 0, D3D11_MAP_READ, 0, &map);
  if (Failed(hr)) {
    return;
  }
  RefPtr<DataSourceSurface> sourceSurface =
    Factory::CreateWrappingDataSourceSurface((uint8_t*)map.pData,
                                             map.RowPitch,
                                             IntSize(bbDesc.Width, bbDesc.Height),
                                             SurfaceFormat::B8G8R8A8);
  mTarget->CopySurface(sourceSurface,
                       IntRect(0, 0, bbDesc.Width, bbDesc.Height),
                       IntPoint(-mTargetBounds.x, -mTargetBounds.y));

  mTarget->Flush();
  mContext->Unmap(readTexture, 0);
}
开发者ID:msliu,项目名称:gecko-dev,代码行数:45,代码来源:CompositorD3D11.cpp


示例14: assert

void ElevationLayeri3d::RequestTile(
   const std::string& sQuadcode, 
   boost::function<void(const std::string&, ElevationTile*)> cbfReady, 
   boost::function<void(const std::string&)> cbfFailed)
{
   if (Failed())
   {
      assert(false); // attempting to request tile from a failed image layer!!
      return;
   }

   if (!Ready())
   {
      assert(false); // attempting to request a tile from a non ready image layer!
      return;
   }

   // File-Format;
   std::string sExtension = ".elv";

   if (_oDatasetInfo.GetTileFormat() == "image/png")
   {
     
   }

   //  Check lod:
   
   unsigned int nRequestedLod = sQuadcode.length();
   unsigned int nLod = _oDatasetInfo.GetLevelOfDetail();
   bool bInterpolate = false;

   SElevationTileRequestI3D* pTileRequest = new SElevationTileRequestI3D;
   pTileRequest->cbfFailed = cbfFailed;
   pTileRequest->cbfReady = cbfReady;
   pTileRequest->pLayer = this;
   pTileRequest->sQuadcode = sQuadcode;

   if (nRequestedLod>nLod)
   {
      delete pTileRequest;
      // can't get!
   }
   else
   {
      pTileRequest->bInterpolate = false;
      pTileRequest->nLod = 0;
      std::string sFilename = FilenameUtils::DelimitPath(_servername + _layername);
      sFilename += sQuadcode;
      sFilename += sExtension;
      sFilename = FilenameUtils::MakeHierarchicalFileName(sFilename, 2);

      //ImageLoader::LoadFromUrl_ThreadedUnpack(eFormat, sFilename, ePixelformat, _OnImageReadyi3d, _OnImageFailedi3d, (void*) pTileRequest);

   }

  }
开发者ID:AsherBond,项目名称:Application-SDK,代码行数:56,代码来源:ElevationLayeri3d.cpp


示例15: outsync

 void
 outsync ()
 {
   if (!alone_ && ++silence_period_ >= Protocol::FATAL_SILENCE_FRAME)
   {
     // cerr << "Silence period has been passed." << endl;
     // cerr << "Decalring the node failed." << endl;
     throw Failed ();
   }
 }
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:10,代码来源:FaultDetector.hpp


示例16: PrintStep

//
// Step 3
// Check if directories are exists and
// create root directories if needed
//
bool InstallWindow::Step3PrepareDirs()
{
    PrintStep(tr("Prepare directories"));

    QSettings settings(ORGANIZATION_NAME,
                       APPLICATION_NAME);

    QString mainName(_game->JsonTitle());

    if (mainName.isEmpty())
        return Failed(tr("Main property not found in Json: ") +
                   mainName);

    _game->SetBinPath(settings.value("Main/BinDir",
                               BIN_DIR_ROOT).toString()  +
                       QString("/") + mainName);
    _game->SetDataPath(settings.value("Main/DataDir",
                               DATA_DIR_ROOT).toString() +
                       QString("/") + mainName);

    QDir dataDir(_game->DataPath());
    QDir binDir(_game->BinPath());

    if (dataDir.exists())
        if (!ConfirmRemoveDir(dataDir.path()))
            return false;
    if (binDir.exists())
        if (!ConfirmRemoveDir(binDir.path()))
            return false;

    if (!dataDir.mkpath(dataDir.path()))
        return Failed(QString(tr("Can't create directory %1"))
                   .arg(dataDir.path()));

    if (!binDir.mkpath(binDir.path()))
        return Failed(QString(tr("Can't create directory %1"))
                   .arg(binDir.path()));

    PrintOK();
    return Step4Unpack();
}
开发者ID:divan,项目名称:wgames,代码行数:46,代码来源:installwindow.cpp


示例17: Failed

int CKMotionIO::ReadBytesAvailable(char *RxBuffer, int maxbytes, DWORD *BytesReceived, int timeout_ms)
{
	FT_STATUS ftStatus;
	DWORD EventDWord;
	DWORD RxBytes;
	DWORD TxBytes;

	Mutex->Lock();
	ftStatus=FT_GetStatus(ftHandle,&RxBytes,&TxBytes,&EventDWord);

	if (ftStatus != FT_OK)
	{
		Failed();
		Mutex->Unlock();
		return 1;
	}

	if ((int)RxBytes > maxbytes) RxBytes = maxbytes-1; // leave room for null

	RxBuffer[0]=0;  // set buf empty initially
	*BytesReceived=0;

	if (RxBytes > 0) 
	{
		ftStatus = FT_Read(ftHandle,RxBuffer,RxBytes,BytesReceived);
		if (ftStatus == FT_OK) 
		{
			RxBuffer[*BytesReceived]=0;  // null terminate
		}
		else 
		{
			Failed();
			Mutex->Unlock();
			return 1;
		}
	}

	Mutex->Unlock();
	return 0;
}
开发者ID:tedenda,项目名称:KMotionX,代码行数:40,代码来源:KmotionIO.cpp


示例18: _T

BOOL
Site::CancelKnock()
{
    CIoKnockDlg *pDlg = theApp.GetDialog();

    if (m_Status != SITE_KNOCKED)
    {
        pDlg->SetKnock(m_dwCurrentKnock+1, false, _T("Aborted"));
        Failed(SITE_ABORTED);
    }
    pDlg->KnockDone();
    return TRUE;
}
开发者ID:as2120,项目名称:ZioFtpd,代码行数:13,代码来源:Site.cpp


示例19: GetArchive

ResultVal<std::shared_ptr<Directory>> ArchiveManager::OpenDirectoryFromArchive(
    ArchiveHandle archive_handle, const FileSys::Path& path) {
    ArchiveBackend* archive = GetArchive(archive_handle);
    if (archive == nullptr)
        return FileSys::ERR_INVALID_ARCHIVE_HANDLE;

    auto backend = archive->OpenDirectory(path);
    if (backend.Failed())
        return backend.Code();

    auto directory = std::shared_ptr<Directory>(new Directory(std::move(backend).Unwrap(), path));
    return MakeResult<std::shared_ptr<Directory>>(std::move(directory));
}
开发者ID:citra-emu,项目名称:citra,代码行数:13,代码来源:archive.cpp


示例20: Failed

void CTraverseByBuddy::SendPacket()
{
	try
	{
		if(!m_bFailed && (m_dwState&NAT_S_SYNC)==0 && time(NULL)-m_SendReqTime > 10)
		{
			//  failed to connect
			if(m_nSendReqCount>60)
			{
				m_dwState|=NAT_E_TIMEOUT;
				if(m_nSendReqCount>70)
					Failed();
				m_nSendReqCount++;
			}
			else
			{
				SendConnectReq();
				SendPingPacket();
			}
		}

		if(m_bFailed)
		{
			if(m_Sock)// && pClientSock->client)
			{
				//m_Sock->m_bUseNat = false;
			}
			_AddLogLine(false, _T("Unconnected NatSock was deleted. time out. %s."), UserHashToString(m_UserHash));
		}
	}
	catch(...)
	{
		//  the CAsyncSocketEx maybe is deleted
		TRACE("Exception: %s\n", __FUNCTION__);
		Failed();
	}
}
开发者ID:techpub,项目名称:archive-code,代码行数:37,代码来源:TraverseByBuddy.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Failure函数代码示例发布时间:2022-05-30
下一篇:
C++ Fail函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap