當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetResult函數代碼示例

本文整理匯總了C++中GetResult函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetResult函數的具體用法?C++ GetResult怎麽用?C++ GetResult使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetResult函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: Open

bool Open(V4V_CONTEXT& ctx, domid_t partner, uint32_t port)
{
    ATLTRACE(__FUNCTION__ " Entry\n");

    DWORD error(0);
    DWORD bytes(0);

    OVERLAPPED ov = { 0 };
    ov.hEvent = ::CreateEvent(0, true, false, 0);

    ::memset(&ctx, 0, sizeof(V4V_CONTEXT));
    ctx.flags = V4V_FLAG_OVERLAPPED;

    ATLTRACE(__FUNCTION__ " V4vOpen\n");

    if (!V4vOpen(&ctx, RingSize, &ov))
    {
        error = ::GetLastError();
    }
    else
    {
        error = GetResult(ctx, &ov, bytes);
    }

    if (error)
    {
        ATLTRACE(__FUNCTION__ " V4vOpen Error:%d\n", error);
    }
    else
    {
        v4v_ring_id_t v4vid = { 0 };
        v4vid.addr.domain = V4V_DOMID_NONE;
        v4vid.addr.port = port;
        v4vid.partner = partner;

        ATLTRACE(__FUNCTION__ " V4vBind\n");

        if (!V4vBind(&ctx, &v4vid, &ov))
        {
            error = ::GetLastError();
        }
        else
        {
            error = GetResult(ctx, &ov, bytes);
        }

        if (error)
        {
            ATLTRACE(__FUNCTION__ " V4vBind Error:%d\n", error);
        }
    }

    ::CloseHandle(ov.hEvent);

    ATLTRACE(__FUNCTION__ " Exit Result:%d\n", error);
    return (0 == error);
}
開發者ID:barryrandall,項目名稱:xc-windows,代碼行數:57,代碼來源:v4vmsg.cpp

示例2: main

/**
 * Lists all iam policies
 */
int main(int argc, char** argv)
{
    Aws::SDKOptions options;
    Aws::InitAPI(options);
    {
        Aws::IAM::IAMClient iam;
        Aws::IAM::Model::ListPoliciesRequest request;

        bool done = false;
        bool header = false;
        while (!done)
        {
            auto outcome = iam.ListPolicies(request);
            if (!outcome.IsSuccess())
            {
                std::cout << "Failed to list iam policies: " <<
                    outcome.GetError().GetMessage() << std::endl;
                break;
            }

            if (!header)
            {
                std::cout << std::left << std::setw(55) << "Name" <<
                    std::setw(30) << "ID" << std::setw(80) << "Arn" <<
                    std::setw(64) << "Description" << std::setw(12) <<
                    "CreateDate" << std::endl;
                header = true;
            }

            const auto &policies = outcome.GetResult().GetPolicies();
            for (const auto &policy : policies)
            {
                std::cout << std::left << std::setw(55) <<
                    policy.GetPolicyName() << std::setw(30) <<
                    policy.GetPolicyId() << std::setw(80) << policy.GetArn() <<
                    std::setw(64) << policy.GetDescription() << std::setw(12) <<
                    policy.GetCreateDate().ToGmtString(DATE_FORMAT) <<
                    std::endl;
            }

            if (outcome.GetResult().GetIsTruncated())
            {
                request.SetMarker(outcome.GetResult().GetMarker());
            }
            else
            {
                done = true;
            }
        }
    }
    Aws::ShutdownAPI(options);
    return 0;
}
開發者ID:gabordc,項目名稱:aws-doc-sdk-examples,代碼行數:56,代碼來源:list_policies.cpp

示例3: handleIterateFinished

	void GraffitiTab::handleIterateFinished ()
	{
		auto recIterator = qobject_cast<RecIterator*> (sender ());
		recIterator->deleteLater ();

		const auto& files = recIterator->GetResult ();

		FilesWatcher_->AddFiles (files);
		FilesModel_->AddFiles (files);

		auto resolver = LMPProxy_->GetTagResolver ();
		auto worker = [resolver, files] () -> QList<MediaInfo>
		{
			QList<MediaInfo> infos;
			for (const auto& file : files)
				try
				{
					infos << resolver->ResolveInfo (file.absoluteFilePath ());
				}
				catch (const std::exception& e)
				{
					qWarning () << Q_FUNC_INFO
							<< e.what ();
				}
			return infos;
		};

		auto scanWatcher = new QFutureWatcher<QList<MediaInfo>> ();
		connect (scanWatcher,
				SIGNAL (finished ()),
				this,
				SLOT (handleScanFinished ()));
		scanWatcher->setProperty ("LMP/Graffiti/Filename", recIterator->property ("LMP/Graffiti/Filename"));
		scanWatcher->setFuture (QtConcurrent::run (std::function<QList<MediaInfo> ()> (worker)));
	}
開發者ID:MellonQ,項目名稱:leechcraft,代碼行數:35,代碼來源:graffititab.cpp

示例4: AllocateAndAssociateAddress

void AllocateAndAssociateAddress(const Aws::String& instance_id)
{
    Aws::EC2::EC2Client ec2;

    Aws::EC2::Model::AllocateAddressRequest request;
    request.SetDomain(Aws::EC2::Model::DomainType::vpc);

    auto outcome = ec2.AllocateAddress(request);
    if(!outcome.IsSuccess()) {
        std::cout << "Failed to allocate elastic ip address:" <<
            outcome.GetError().GetMessage() << std::endl;
        return;
    }

    Aws::String allocation_id = outcome.GetResult().GetAllocationId();

    Aws::EC2::Model::AssociateAddressRequest associate_request;
    associate_request.SetInstanceId(instance_id);
    associate_request.SetAllocationId(allocation_id);

    auto associate_outcome = ec2.AssociateAddress(associate_request);
    if(!associate_outcome.IsSuccess()) {
        std::cout << "Failed to associate elastic ip address" << allocation_id
            << " with instance " << instance_id << ":" <<
            associate_outcome.GetError().GetMessage() << std::endl;
        return;
    }

    std::cout << "Successfully associated elastic ip address " << allocation_id
        << " with instance " << instance_id << std::endl;
}
開發者ID:ronhash10,項目名稱:aws-doc-sdk-examples,代碼行數:31,代碼來源:allocate_address.cpp

示例5: TEST

/// @brief 添加一個TestCase到一個TestSuite\n
/// TEST(TestICalc, ExceptionData)將測試所有異常的數據
TEST(TestICalc, ExceptionData)
{
    for (int i=0; i<8; i++)
    {
        EXPECT_EQ( ExceptionResult[i], GetResult(ExceptionData[i]) ) << "Error at index :" << i;
    }
}
開發者ID:testzzzz,項目名稱:hwccnet,代碼行數:9,代碼來源:testICalculator.cpp

示例6: nstring

//-----------------------------------------------------------------------------
C_NStrOutf::operator nstring () const
{
	bool bFormat = false;
	nstring szResult;
	nstring szFormat;
	std::vector<nstring>::size_type Pos = 0;

	for(const nstring::value_type &Itor : m_szFormat)
	{
		if(Itor == __T('{'))
		{
			bFormat = true;

			continue;
		}//if

		if(Itor == __T('}'))
		{
			bFormat = false;
			szResult += GetResult(szFormat, m_Data.size() > Pos ? m_Data[Pos] : __T(''));
			szFormat.clear();
			++Pos;

			continue;
		}//if

		if(bFormat)
			szFormat += Itor;
		else
			szResult += Itor;
	}//for

	return szResult;
}
開發者ID:yinweli,項目名稱:platform,代碼行數:35,代碼來源:_nstroutf.cpp

示例7: Load

bool ResourceShader::Load( ResourceMemoryAllocator &inAllocator, ResourceDirectory &inDir ) {
    allocator = &inAllocator;

    auto res = ResourceDirectory::instance->Open(GetLocation(), ResourceDirectory::PERMISSION_ReadOnly);
    auto resIo = res.GetResult();

    if(!resIo) return false;

    Int size = 0;
    Int realSize = 0;
    Int bytesRead;

    const Int increment = 1024;
    do {
        size += increment;
        string = (char*)allocator->Reallocate(string, size+1);
        
        bytesRead = resIo->Read(string+size-increment, increment).GetResult();
        realSize += bytesRead;

        if(bytesRead < increment) break;
    } while(true);

    string = (char*)allocator->Reallocate(string, realSize+1);
    string[realSize] = 0;

    return true;
}
開發者ID:prototypegames,項目名稱:polymania,代碼行數:28,代碼來源:shader.cpp

示例8: MakeCallback

void MakeCallback(uv_work_t* req) {
  Nan::HandleScope scope;

  Nan::TryCatch try_catch;
  sass_context_wrapper* ctx_w = static_cast<sass_context_wrapper*>(req->data);
  struct Sass_Context* ctx;

  if (ctx_w->dctx) {
    ctx = sass_data_context_get_context(ctx_w->dctx);
  }
  else {
    ctx = sass_file_context_get_context(ctx_w->fctx);
  }

  int status = GetResult(ctx_w, ctx);

  if (status == 0 && ctx_w->success_callback) {
    // if no error, do callback(null, result)
    ctx_w->success_callback->Call(0, 0);
  }
  else if (ctx_w->error_callback) {
    // if error, do callback(error)
    const char* err = sass_context_get_error_json(ctx);
    v8::Local<v8::Value> argv[] = {
      Nan::New<v8::String>(err).ToLocalChecked()
    };
    ctx_w->error_callback->Call(1, argv);
  }
  if (try_catch.HasCaught()) {
    Nan::FatalException(try_catch);
  }

  sass_free_context_wrapper(ctx_w);
}
開發者ID:jjcarey,項目名稱:starkiller-wordpress-theme,代碼行數:34,代碼來源:binding.cpp

示例9: pageIds

	void ExecuteCommandDialog::handleCurrentChanged (int id)
	{
		if (!dynamic_cast<WaitPage*> (currentPage ()))
			return;

		const auto& ids = pageIds ();

		const int pos = ids.indexOf (id);
		if (pos <= 0)
			return;

		const auto prevPage = page (ids.at (pos - 1));
		if (dynamic_cast<CommandsListPage*> (prevPage))
		{
			const AdHocCommand& cmd = dynamic_cast<CommandsListPage*> (prevPage)->GetSelectedCommand ();
			if (cmd.GetName ().isEmpty ())
				deleteLater ();
			else
				ExecuteCommand (cmd);
		}
		else if (dynamic_cast<CommandResultPage*> (prevPage))
		{
			const auto crp = dynamic_cast<CommandResultPage*> (prevPage);
			const auto& action = crp->GetSelectedAction ();
			if (action.isEmpty ())
				return;

			auto result = crp->GetResult ();
			result.SetDataForm (crp->GetForm ());
			ProceedExecuting (result, action);
		}
	}
開發者ID:ForNeVeR,項目名稱:leechcraft,代碼行數:32,代碼來源:executecommanddialog.cpp

示例10: SetPyException

void SetPyException(const std::exception& ex)
{
    const char* message = ex.what();
    if (dynamic_cast<const MI::TypeConversionException*>(&ex))
    {
        PyErr_SetString(PyExc_TypeError, message);
    }
    else
    {
        PyObject* d = PyDict_New();
        PyObject* pyEx = nullptr;
        if (dynamic_cast<const MI::MITimeoutException*>(&ex))
        {
            pyEx = PyMITimeoutError;
        }
        else
        {
            pyEx = PyMIError;
        }

        if (dynamic_cast<const MI::MIException*>(&ex))
        {
            auto miex = static_cast<const MI::MIException*>(&ex);
            PyDict_SetItemString(d, "error_code", PyLong_FromUnsignedLong(miex->GetErrorCode()));
            PyDict_SetItemString(d, "mi_result", PyLong_FromUnsignedLong(miex->GetResult()));
        }

        PyDict_SetItemString(d, "message", PyUnicode_FromString(message));
        PyErr_SetObject(pyEx, d);
        Py_DECREF(d);
    }
}
開發者ID:alinbalutoiu,項目名稱:PyMI,代碼行數:32,代碼來源:Utils.cpp

示例11: rangeObject

void rangeObject(ClientPtrType client, String bucketName, String key, String path, size_t min, size_t max)
{
    String base = "=== Range Object [" + bucketName + "/" + key;
    std::cout << base << "]: Start ===\n";
    std::cout << "Reading from " << path << "\n";
    String range(("byte=" + std::to_string(min) + "-" + std::to_string(max)).c_str());
    auto inpData = Aws::MakeShared<Aws::FStream>("GetObjectInputStream",
            path.c_str(), std::ios_base::in | std::ios_base::binary);
    auto objReq = Aws::S3::Model::GetObjectRequest();
    objReq.WithBucket(bucketName).WithKey(key).WithRange(range);
    auto objRes = client->GetObject(objReq);
    if (!objRes.IsSuccess())
    {
        std::cout << base << "]: Client Side failure ===\n";
        std::cout << objRes.GetError().GetExceptionName() << "\t" <<
                     objRes.GetError().GetMessage() << "\n";
        std::cout << base << "]: Failed ===\n";
    }
    else
    {
        Aws::IOStream& file = objRes.GetResult().GetBody();
        if (!doFilesMatch(inpData.get(), file, min, max))
        {
            std::cout << base << "]: Content not equal ===\n";
        }
    }
    std::cout << base << "]: End ===\n\n";
}
開發者ID:leo-project,項目名稱:leofs_client_tests,代碼行數:28,代碼來源:main.cpp

示例12: GetResult

void CExampleTest::TestCase02()
{
	char *input[] = {"10 10 10 10 10 10 9 xiaoyuanwang","0 0 0 0 0 0 0 beast"};
	char result[100] = {0};
	GetResult(input, 2, result);
	CPPUNIT_ASSERT(0 == strcmp(result, "xiaoyuanwang 10.00\nbeast 0.00") );
}
開發者ID:VicoandMe,項目名稱:HW,代碼行數:7,代碼來源:CExampleTest.cpp

示例13: main

int main()
{
	char input[20] = {0};
	int len = 0;
	int res = 0;
	int i = 0;
	int j = 0;
	ElementType infix[20] = {0};
	ElementType suffix[20] = {0};
	
	//StackNode* infix_head;
	//StackNode* top;
	
	fgets(input,20,stdin);
	len = ArrayToInfix(input,infix);
	//PrintFormula(infix, len);
	len = InfixToSuffix(infix,suffix,len);
	//PrintFormula(suffix, len);
	res = GetResult(suffix,len);
	printf("= %d\n", res);
	//PrintInfix(infix,len);
	/*InitStack(&infix_head, &top);
	for (i = 0; i < len; ++i)
	{
		StackPush(infix_head,&top,infix[i]);
	}
	PrintStack(infix_head);*/
	
}
開發者ID:KoenChiu,項目名稱:C-Projects,代碼行數:29,代碼來源:calc_Beta_v1.c

示例14: SendLibraNum

// Виконааня команди cmd з параметрами params
int XLibraLP::DoCmd(unsigned char cmd, char *params)
{
    SendLibraNum();

    Write(&cmd, 1);

    switch (cmd)
    {
        case 0x82:
            Write(params, 83);
         break;
        case 0x8a:
            Write(params, 9);
         break;
        case 0x8d:
            Write(params, 4);
         break;
        case 0x81:
            Write(params, 4);
            unsigned char ch;
            for (int i(0); i < 100; i++)
                Read(&ch, 1);
         break;
    };

    Listen();

    return GetResult()->error;
}
開發者ID:kilydz,項目名稱:tp-exchange,代碼行數:30,代碼來源:libraLP.cpp

示例15: PackWebRsp

/****************************************************************
** 功    能:應答報文組包
** 輸入參數:
**        ptApp                 app結構指針
** 輸出參數:
**        szRspBuf              交易應答報文
** 返 回 值:
**        >0                    報文長度
**        FAIL                  失敗
** 作    者:
**        fengwei
** 日    期:
**        2012/12/18
** 調用說明:
**
** 修改日誌:
****************************************************************/
int PackWebRsp(T_App *ptApp, char *szRspBuf)
{
    int     iIndex;                 /* buf索引 */
    int     iMsgCount;              /* 短信記錄數 */
    int     iRetDescLen;            /* 響應信息長度 */

    iIndex = 0;

    /* 交易代碼 */
    memcpy(szRspBuf+iIndex, ptApp->szTransCode, 8);
    iIndex += 8;

    /* 響應碼 */
    memcpy(szRspBuf+iIndex, ptApp->szRetCode, 2);
    iIndex += 2;

    /* 根據返回碼取返回信息 */
	if(strlen(ptApp->szRetDesc) == 0)
	{
		GetResult(ptApp->szRetCode, ptApp->szRetDesc);
	}

    /* 響應信息長度 */
    iRetDescLen = strlen(ptApp->szRetDesc);
    szRspBuf[iIndex] = iRetDescLen;
    iIndex += 1;

    /* 響應信息 */
	memcpy(szRspBuf+iIndex, ptApp->szRetDesc, iRetDescLen);
    iIndex += iRetDescLen;

    return iIndex;
}
開發者ID:Yifei0727,項目名稱:epay5,代碼行數:50,代碼來源:PackWebRsp.c


注:本文中的GetResult函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。