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


C++ Result函数代码示例

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


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

示例1: AddOrTally

Result
RSS14Reader::decodeRow(int rowNumber, const BitArray& row_, std::unique_ptr<DecodingState>& state) const
{
	RSS14DecodingState* prevState = nullptr;
	if (state == nullptr) {
		state.reset(prevState = new RSS14DecodingState);
	}
	else {
#if !defined(ZX_HAVE_CONFIG)
		#error "You need to include ZXConfig.h"
#elif !defined(ZX_NO_RTTI)
		prevState = dynamic_cast<RSS14DecodingState*>(state.get());
#else
		prevState = static_cast<RSS14DecodingState*>(state.get());
#endif
	}

	if (prevState == nullptr) {
		throw std::runtime_error("Invalid state");
	}

	BitArray row = row_.copy();
	AddOrTally(prevState->possibleLeftPairs, DecodePair(row, false, rowNumber));
	row.reverse();
	AddOrTally(prevState->possibleRightPairs, DecodePair(row, true, rowNumber));
//	row.reverse();

	for (const auto& left : prevState->possibleLeftPairs) {
		if (left.count() > 1) {
			for (const auto& right : prevState->possibleRightPairs) {
				if (right.count() > 1) {
					if (CheckChecksum(left, right)) {
						return ConstructResult(left, right);
					}
				}
			}
		}
	}
	return Result(DecodeStatus::NotFound);
}
开发者ID:huycn,项目名称:zxing-cpp,代码行数:40,代码来源:ODRSS14Reader.cpp

示例2: Result

void cSlotAreaCrafting::ShiftClickedResult(cPlayer & a_Player)
{
	cItem Result(*GetSlot(0, a_Player));
	if (Result.IsEmpty())
	{
		return;
	}
	cItem * PlayerSlots = GetPlayerSlots(a_Player) + 1;
	for (;;)
	{
		// Try distributing the result. If it fails, bail out:
		cItem ResultCopy(Result);
		m_ParentWindow.DistributeStack(ResultCopy, a_Player, this, false);
		if (!ResultCopy.IsEmpty())
		{
			// Couldn't distribute all of it. Bail out
			return;
		}
		
		// Distribute the result, this time for real:
		ResultCopy = Result;
		m_ParentWindow.DistributeStack(ResultCopy, a_Player, this, true);

		// Remove the ingredients from the crafting grid and update the recipe:
		cCraftingRecipe & Recipe = GetRecipeForPlayer(a_Player);
		cCraftingGrid Grid(PlayerSlots, m_GridSize, m_GridSize);
		Recipe.ConsumeIngredients(Grid);
		Grid.CopyToItems(PlayerSlots);
		UpdateRecipe(a_Player);

		// Broadcast the window, we sometimes move items to different locations than Vanilla, causing needless desyncs:
		m_ParentWindow.BroadcastWholeWindow();
		
		// If the recipe has changed, bail out:
		if (!Recipe.GetResult().IsEqual(Result))
		{
			return;
		}
	}
}
开发者ID:RedEnraged96,项目名称:MCServer-1,代码行数:40,代码来源:SlotArea.cpp

示例3: MyStoreEID

void CBaseDialog::OnComputeStoreHash()
{
	HRESULT hRes = S_OK;

	CEditor MyStoreEID(
		this,
		IDS_COMPUTESTOREHASH,
		IDS_COMPUTESTOREHASHPROMPT,
		4,
		CEDITOR_BUTTON_OK | CEDITOR_BUTTON_CANCEL);

	MyStoreEID.InitPane(0, CreateSingleLinePane(IDS_STOREEID, NULL, false));
	MyStoreEID.InitPane(1, CreateCheckPane(IDS_EIDBASE64ENCODED, false, false));
	MyStoreEID.InitPane(2, CreateSingleLinePane(IDS_FILENAME, NULL, false));
	MyStoreEID.InitPane(3, CreateCheckPane(IDS_PUBLICFOLDERSTORE, false, false));

	WC_H(MyStoreEID.DisplayDialog());
	if (S_OK != hRes) return;

	// Get the entry ID as a binary
	LPENTRYID lpEntryID = NULL;
	size_t cbBin = NULL;
	EC_H(MyStoreEID.GetEntryID(0, MyStoreEID.GetCheck(1), &cbBin, &lpEntryID));

	DWORD dwHash = ComputeStoreHash((ULONG)cbBin, (LPBYTE)lpEntryID, NULL, MyStoreEID.GetStringW(2), MyStoreEID.GetCheck(3));

	CString szHash;
	szHash.FormatMessage(IDS_STOREHASHVAL, dwHash);

	CEditor Result(
		this,
		IDS_STOREHASH,
		NULL,
		(ULONG)0,
		CEDITOR_BUTTON_OK);
	Result.SetPromptPostFix(szHash);
	(void)Result.DisplayDialog();

	delete[] lpEntryID;
} // CBaseDialog::OnComputeStoreHash
开发者ID:JasonSchlauch,项目名称:mfcmapi,代码行数:40,代码来源:BaseDialog.cpp

示例4: Result

Recordinfo API::createIndex(sqlcommand& sql, bool flag){
	std::string tablename=sql.createIndexInfo[1];
    std::string indexname=sql.createIndexInfo[0];
    std::string attrname=sql.createIndexInfo[2];
//    if(catalogmanager->attrname)
    // 保证index一定会在unique上面创建,primary key
    //
    if(!catalogmanager->isUnique(tablename, attrname) && !catalogmanager->isPK(tablename, attrname) ){
        Recordinfo result=Recordinfo(false, "You can only create an index on unique/primary attribute!", Result(), 0);
        return result;
    }
    int attrtype=catalogmanager->getAttrType(tablename, sql.createIndexInfo[2]);
    catalogmanager->insertIndex(sql);
    int valuecharlen=0;
    if(attrtype>0)
        valuecharlen=catalogmanager->getCharLength(tablename, sql.createIndexInfo[2]);
    
    indexmanager->CreateIndex(indexname, attrtype, std::vector<Value>(), std::vector<slot>(), valuecharlen);
    // insert all records to index
    sqlcommand tempsql=sqlcommand();
    tempsql.sqlType=0;
    tempsql.selectInfo=std::vector<std::string>();
    tempsql.selectInfo.push_back(sql.createIndexInfo[2]);
    tempsql.tablename=tablename;
    tempsql.conditions=std::vector<std::vector<std::string> >();
    Table temptable=catalogmanager->getTable(tablename);
    std::vector<slot> tempslot=std::vector<slot>();
    Recordinfo result=recordmanager->Select_Record(tempsql, temptable, 0, tempslot);
    for(int i=0;i<tempslot.size();i++){
        Value v;
        switch(attrtype){
            case 0:v=Value(attrtype, std::stoi(result.res.rows[i+1].cols[0]));break;
            case 1:v=Value(attrtype, result.res.rows[i+1].cols[0]);break;
            case -1:v=Value(attrtype, std::stof(result.res.rows[i+1].cols[0]));break;
        }
        indexmanager->_insert(indexname, v, tempslot[i]);
    }
    
    return Recordinfo(1, "", Result(), 0); // further improve
}
开发者ID:smilenow,项目名称:Database-System-Design_miniSQL,代码行数:40,代码来源:API.cpp

示例5: main

int main(int argc, char ** argv) {

    MPI::Init(argc, argv);

    const int rank = MPI::COMM_WORLD.Get_rank();
    const int SLAVE_COUNT = MPI::COMM_WORLD.Get_size();

    //unit::Matrix<double> A, B, C;

    unit::Matrix<double> A(), B();
    unit::Matrix<double> Result();

    //std::printf("Hello world!\n");

    MPI::Finalize();

    if(rank == 0) {

        std::fflush(stdout);
    }

    return 0;
}
开发者ID:zerosign,项目名称:pkp-openmpi,代码行数:23,代码来源:main.cpp

示例6: Result

void ObjectMgr::LoadItemTemplates()
{
    QueryResult Result(sDatabase.Query("SELECT * FROM `item_template`"));

    ItemTemplate* pTemplate;

    while (Result->next())
    {
        pTemplate = new ItemTemplate;

        pTemplate->ItemID         = Result->getUInt64 (1);
        pTemplate->Class          = Result->getUInt   (2);
        pTemplate->SubClass       = Result->getUInt   (3);
        pTemplate->Name           = Result->getString (4);
        pTemplate->DisplayInfoID  = Result->getUInt   (5);
        pTemplate->InventoryType  = Result->getUInt   (6);
        pTemplate->ContainerSlots = Result->getUInt   (7);
        pTemplate->Description    = Result->getString (8);

        ItemTemplates[pTemplate->ItemID] = pTemplate;
    }
}
开发者ID:calkut,项目名称:Warrior-of-Dreamworld,代码行数:22,代码来源:ObjectMgr.cpp

示例7: Result

void ObjectMgr::LoadSpellTemplates()
{
    QueryResult Result(WorldDB->Query("SELECT * FROM `spell_template`"));

    SpellTemplate* pTemplate;

    while (Result->next())
    {
        pTemplate = new SpellTemplate;

        pTemplate->Entry     = Result->getUInt   (1);
        pTemplate->Name      = Result->getString (2);
        pTemplate->Tileset   = Result->getString (3);
        pTemplate->TextureX  = Result->getUInt   (4);
        pTemplate->TextureY  = Result->getUInt   (5);
        pTemplate->Flag      = Result->getUInt   (6);
        pTemplate->BaseValue = Result->getUInt   (7);
        pTemplate->BaseCost  = Result->getUInt   (8);

        SpellTemplates[pTemplate->Entry] = pTemplate;
    }
}
开发者ID:krofna,项目名称:Warrior-of-Dreamworld-r3,代码行数:22,代码来源:ObjectMgr.cpp

示例8: create_sem

status_t
PrintServerMessenger::SendRequest()
{
	fThreadCompleted = create_sem(0, "print_server_messenger_sem");
	if (fThreadCompleted < B_OK)
		return B_ERROR;

	thread_id id = spawn_thread(MessengerThread, "async_request",
		B_NORMAL_PRIORITY, this);
	if (id <= 0 || resume_thread(id) != B_OK)
		return B_ERROR;

	// Get the originating window, if it exists
	BWindow* window = dynamic_cast<BWindow*>(
		BLooper::LooperForThread(find_thread(NULL)));
	if (window != NULL) {
		status_t err;
		while (true) {
			do {
				err = acquire_sem_etc(fThreadCompleted, 1, B_RELATIVE_TIMEOUT,
					50000);
			// We've (probably) had our time slice taken away from us
			} while (err == B_INTERRUPTED);

			// Semaphore was finally nuked in SetResult(BMessage *)
			if (err == B_BAD_SEM_ID)
				break;
			window->UpdateIfNeeded();
		}
	} else {
		// No window to update, so just hang out until we're done.
		while (acquire_sem(fThreadCompleted) == B_INTERRUPTED);
	}

	status_t status;
	wait_for_thread(id, &status);

	return Result() != NULL ? B_OK : B_ERROR;
}
开发者ID:mariuz,项目名称:haiku,代码行数:39,代码来源:PrintJob.cpp

示例9: ConstructResult

static Result
ConstructResult(const RSS::Pair& leftPair, const RSS::Pair& rightPair)
{
	int64_t symbolValue = 4537077 * static_cast<int64_t>(leftPair.value()) + rightPair.value();
	std::wstringstream buffer;
	buffer << std::setw(13) << std::setfill(L'0') << symbolValue;

	int checkDigit = 0;
	for (int i = 0; i < 13; i++) {
		int digit = buffer.get() - '0';
		checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
	}
	checkDigit = 10 - (checkDigit % 10);
	if (checkDigit == 10) {
		checkDigit = 0;
	}
	buffer.put((wchar_t)(checkDigit + '0'));

	auto& leftPoints = leftPair.finderPattern().points();
	auto& rightPoints = rightPair.finderPattern().points();
	return Result(buffer.str(), ByteArray(), { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1] }, BarcodeFormat::RSS_14);
}
开发者ID:huycn,项目名称:zxing-cpp,代码行数:22,代码来源:ODRSS14Reader.cpp

示例10: assert

FunctionAnalysisManagerCGSCCProxy::Result
FunctionAnalysisManagerCGSCCProxy::run(LazyCallGraph::SCC &C,
                                       CGSCCAnalysisManager &AM,
                                       LazyCallGraph &CG) {
  // Collect the FunctionAnalysisManager from the Module layer and use that to
  // build the proxy result.
  //
  // This allows us to rely on the FunctionAnalysisMangaerModuleProxy to
  // invalidate the function analyses.
  auto &MAM = AM.getResult<ModuleAnalysisManagerCGSCCProxy>(C, CG).getManager();
  Module &M = *C.begin()->getFunction().getParent();
  auto *FAMProxy = MAM.getCachedResult<FunctionAnalysisManagerModuleProxy>(M);
  assert(FAMProxy && "The CGSCC pass manager requires that the FAM module "
                     "proxy is run on the module prior to entering the CGSCC "
                     "walk.");

  // Note that we special-case invalidation handling of this proxy in the CGSCC
  // analysis manager's Module proxy. This avoids the need to do anything
  // special here to recompute all of this if ever the FAM's module proxy goes
  // away.
  return Result(FAMProxy->getManager());
}
开发者ID:kraj,项目名称:llvm,代码行数:22,代码来源:CGSCCPassManager.cpp

示例11: Result

glm::mat4 Camera::GetViewMatrix(glm::vec3 _eye, glm::vec3 _center, glm::vec3 up ){

	centre = eye + direction;

	glm::vec3 dir = glm::normalize(_center - eye);
	glm::vec3 tup = glm::normalize(up);
	glm::vec3 s = glm::normalize(glm::cross(dir, tup));
	tup = glm::cross(s, dir);

	glm::mat4x4 Result(1);
        Result[0][0] = s.x;
        Result[1][0] = s.y;
        Result[2][0] = s.z;
        Result[0][1] = tup.x;
        Result[1][1] = tup.y;
        Result[2][1] = tup.z;
        Result[0][2] =-dir.x;
        Result[1][2] =-dir.y;
        Result[2][2] =-dir.z;

		return glm::translate(Result, -eye);
}
开发者ID:TeamGLPacman,项目名称:Pacman,代码行数:22,代码来源:Camera.cpp

示例12: FmtLoadStr

//---------------------------------------------------------------------------
UnicodeString FmtLoadStr(intptr_t Id, ...)
{
  UnicodeString Result(64, 0);
  wchar_t Format[1024];
  HINSTANCE hInstance = GetGlobalFunctions()->GetInstanceHandle();
  intptr_t Length = ::LoadString(hInstance, static_cast<UINT>(Id),
    Format, static_cast<int>(sizeof(Format)));
  if (!Length)
  {
    DEBUG_PRINTF(L"Unknown resource string id: %d\n", Id);
  }
  else
  {
    va_list Args;
    va_start(Args, Id);
    intptr_t Len = _vscwprintf(Format, Args);
    Result.SetLength(Len + sizeof(wchar_t));
    vswprintf_s(&Result[1], Result.Length(), Format, Args);
    va_end(Args);
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:23,代码来源:Sysutils.cpp

示例13: main

int main()
{
	uint64_t EndTarget = 24;

	std::vector<uint64_t> Result(EndTarget);

	Result[0] = 1;

	for (uint64_t i = 0; i < EndTarget - 1; i++)
	{
		uint64_t Summation = 0;

		for (uint64_t j = 0; j <= i; j++) Summation += Result[j] * NChooseK(i, j);

		Result[i + 1] = Result[i] + Summation;
	}

	for (size_t i = 0; i < EndTarget; i++)
	{
		std::cout << Result[i] << std::endl;
	}

	std::cout << std::endl;

	for (size_t i = 0; i < EndTarget; i++)
	{
		std::bitset<64> x(Result[i]);

		std::cout << x << std::endl;
	}

	std::cout << std::endl;

	for (size_t i = 0; i < EndTarget; i++)
	{
		std::cout << float(Result[i]) << std::endl;
	}

}
开发者ID:henry931,项目名称:RelayProject,代码行数:39,代码来源:main.cpp

示例14: in

//-----------------------------------------------------------------
void tStreamReceiveFile::ProcessError(QDataStream &)
{

    enabled=false;
    int num_error=1;
    QString error="Error in command 1";
    QString detail="File name: "+file_name+"\nFile size: "+QString::number(file_size);

    QString client_detail="Ошибка на стороне клиента \n"+error_reason;

    QByteArray block;
    QDataStream in(&block, QIODevice::WriteOnly);

    in << tr("Error");
    in << num_error;
    in << error;
    in << detail;
    in << client_detail;

    emit Result(block);
    emit EndCommand();

}
开发者ID:Balog,项目名称:Synchonization,代码行数:24,代码来源:tClientStreamCommands.cpp

示例15: GetTransform

FBox FKSphylElem::CalcAABB(const FTransform& BoneTM, float Scale) const
{
	FTransform ElemTM = GetTransform();
	ElemTM.ScaleTranslation( FVector(Scale) );
	ElemTM *= BoneTM;

	const FVector SphylCenter = ElemTM.GetLocation();

	// Get sphyl axis direction
	const FVector Axis = ElemTM.GetScaledAxis( EAxis::Z );
	// Get abs of that vector
	const FVector AbsAxis(FMath::Abs(Axis.X), FMath::Abs(Axis.Y), FMath::Abs(Axis.Z));
	// Scale by length of sphyl
	const FVector AbsDist = (Scale * 0.5f * Length) * AbsAxis;

	const FVector MaxPos = SphylCenter + AbsDist;
	const FVector MinPos = SphylCenter - AbsDist;
	const FVector Extent(Scale * Radius);

	FBox Result(MinPos - Extent, MaxPos + Extent);

	return Result;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:23,代码来源:KAggregateGeom.cpp


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