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

C++ entry函数代码示例

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

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



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

示例1: entry

void MozJSImplScope::setNumber(const char* field, double val) {
    MozJSEntry entry(this);

    ObjectWrapper(_context, _global).setNumber(field, val);
}
开发者ID:stevelyall,项目名称:mongol-db,代码行数:5,代码来源:implscope.cpp


示例2: getblocktemplate


//.........这里部分代码省略.........
        // Create new block
        CScript scriptDummy = CScript() << OP_TRUE;
        pblocktemplate = BlockAssembler(Params()).CreateNewBlock(scriptDummy, miningAlgo, fSupportsSegwit);
        if (!pblocktemplate)
            throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");

        // Need to update only after we know CreateNewBlock succeeded
        pindexPrev = pindexPrevNew;
    }
    assert(pindexPrev);
    CBlock* pblock = &pblocktemplate->block; // pointer for convenience
    const Consensus::Params& consensusParams = Params().GetConsensus();

    // Update nTime
    UpdateTime(pblock, consensusParams, pindexPrev, miningAlgo);
    pblock->nNonce = 0;

    // NOTE: If at some point we support pre-segwit miners post-segwit-activation, this needs to take segwit support into consideration
    const bool fPreSegWit = (ThresholdState::ACTIVE != VersionBitsState(pindexPrev, consensusParams, Consensus::DEPLOYMENT_SEGWIT, versionbitscache));

    UniValue aCaps(UniValue::VARR); aCaps.push_back("proposal");

    UniValue transactions(UniValue::VARR);
    std::map<uint256, int64_t> setTxIndex;
    int i = 0;
    for (const auto& it : pblock->vtx) {
        const CTransaction& tx = *it;
        uint256 txHash = tx.GetHash();
        setTxIndex[txHash] = i++;

        if (tx.IsCoinBase())
            continue;

        UniValue entry(UniValue::VOBJ);

        entry.pushKV("data", EncodeHexTx(tx));
        entry.pushKV("txid", txHash.GetHex());
        entry.pushKV("hash", tx.GetWitnessHash().GetHex());

        UniValue deps(UniValue::VARR);
        for (const CTxIn &in : tx.vin)
        {
            if (setTxIndex.count(in.prevout.hash))
                deps.push_back(setTxIndex[in.prevout.hash]);
        }
        entry.pushKV("depends", deps);

        int index_in_template = i - 1;
        entry.pushKV("fee", pblocktemplate->vTxFees[index_in_template]);
        int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost[index_in_template];
        if (fPreSegWit) {
            assert(nTxSigOps % WITNESS_SCALE_FACTOR == 0);
            nTxSigOps /= WITNESS_SCALE_FACTOR;
        }
        entry.pushKV("sigops", nTxSigOps);
        entry.pushKV("weight", GetTransactionWeight(tx));

        transactions.push_back(entry);
    }

    UniValue aux(UniValue::VOBJ);
    aux.pushKV("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end()));

    arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits);

    UniValue aMutable(UniValue::VARR);
开发者ID:DigiByte-Core,项目名称:digibyte,代码行数:67,代码来源:mining.cpp


示例3: entry

void Translation::addPair(const wstring& english, const wstring& translated)
// Add a wstring pair to the translation vector.
{
	pair<wstring, wstring> entry (english, translated);
	m_translation.push_back(entry);
}
开发者ID:execunix,项目名称:usrsrc,代码行数:6,代码来源:ASLocalizer.cpp


示例4: TwoSidedTrsmUVar2

inline void
TwoSidedTrsmUVar2( UnitOrNonUnit diag, Matrix<F>& A, const Matrix<F>& U )
{
#ifndef RELEASE
    CallStackEntry entry("internal::TwoSidedTrsmUVar2");
    if( A.Height() != A.Width() )
        LogicError("A must be square");
    if( U.Height() != U.Width() )
        LogicError("Triangular matrices must be square");
    if( A.Height() != U.Height() )
        LogicError("A and U must be the same size");
#endif
    // Matrix views
    Matrix<F>
        ATL, ATR,  A00, A01, A02,
        ABL, ABR,  A10, A11, A12,
                   A20, A21, A22;
    Matrix<F>
        UTL, UTR,  U00, U01, U02,
        UBL, UBR,  U10, U11, U12,
                   U20, U21, U22;

    // Temporary products
    Matrix<F> Y01;

    PartitionDownDiagonal
    ( A, ATL, ATR,
         ABL, ABR, 0 );
    LockedPartitionDownDiagonal
    ( U, UTL, UTR,
         UBL, UBR, 0 );
    while( ATL.Height() < A.Height() )
    {
        RepartitionDownDiagonal
        ( ATL, /**/ ATR,  A00, /**/ A01, A02,
         /*************/ /******************/
               /**/       A10, /**/ A11, A12,
          ABL, /**/ ABR,  A20, /**/ A21, A22 );

        LockedRepartitionDownDiagonal
        ( UTL, /**/ UTR,  U00, /**/ U01, U02,
         /*************/ /******************/
               /**/       U10, /**/ U11, U12,
          UBL, /**/ UBR,  U20, /**/ U21, U22 );

        //--------------------------------------------------------------------//
        // Y01 := A00 U01
        Zeros( Y01, A01.Height(), A01.Width() );
        Hemm( LEFT, UPPER, F(1), A00, U01, F(0), Y01 );

        // A01 := A01 - 1/2 Y01
        Axpy( F(-1)/F(2), Y01, A01 );
        
        // A11 := A11 - (U01' A01 + A01' U01)
        Her2k( UPPER, ADJOINT, F(-1), U01, A01, F(1), A11 );

        // A11 := inv(U11)' A11 inv(U11)
        TwoSidedTrsmUUnb( diag, A11, U11 );

        // A12 := A12 - A02' U01
        Gemm( ADJOINT, NORMAL, F(-1), A02, U01, F(1), A12 );

        // A12 := inv(U11)' A12
        Trsm( LEFT, UPPER, ADJOINT, diag, F(1), U11, A12 );
        
        // A01 := A01 - 1/2 Y01
        Axpy( F(-1)/F(2), Y01, A01 );

        // A01 := A01 inv(U11)
        Trsm( RIGHT, UPPER, NORMAL, diag, F(1), U11, A01 );
        //--------------------------------------------------------------------//

        SlidePartitionDownDiagonal
        ( ATL, /**/ ATR,  A00, A01, /**/ A02,
               /**/       A10, A11, /**/ A12,
         /*************/ /******************/
          ABL, /**/ ABR,  A20, A21, /**/ A22 );

        SlideLockedPartitionDownDiagonal
        ( UTL, /**/ UTR,  U00, U01, /**/ U02,
               /**/       U10, U11, /**/ U12,
         /*************/ /******************/
          UBL, /**/ UBR,  U20, U21, /**/ U22 );
    }
}
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:85,代码来源:UVar2.hpp


示例5: find_directory

status_t
FilePlaylistItem::RestoreFromTrash()
{
	if (fNameInTrash.Length() <= 0) {
		// Not in the trash!
		return B_ERROR;
	}

	char trashPath[B_PATH_NAME_LENGTH];
	status_t err = find_directory(B_TRASH_DIRECTORY, fRef.device,
		false /*create it*/, trashPath, B_PATH_NAME_LENGTH);
	if (err != B_OK) {
		fprintf(stderr, "failed to find Trash: %s\n", strerror(err));
		return err;
	}
	// construct the entry to the file in the trash
// TODO: BEntry(const BDirectory* directory, const char* path) is broken!
//	BEntry entry(trashPath, fNamesInTrash[i].String());
BPath path(trashPath, fNameInTrash.String());
BEntry entry(path.Path());
	err = entry.InitCheck();
	if (err != B_OK) {
		fprintf(stderr, "failed to init BEntry for %s: %s\n",
			fNameInTrash.String(), strerror(err));
		return err;
	}
//entry.GetPath(&path);
//printf("moving '%s'\n", path.Path());

	// construct the folder of the original entry_ref
	node_ref nodeRef;
	nodeRef.device = fRef.device;
	nodeRef.node = fRef.directory;
	BDirectory originalDir(&nodeRef);
	err = originalDir.InitCheck();
	if (err != B_OK) {
		fprintf(stderr, "failed to init original BDirectory for "
			"%s: %s\n", fRef.name, strerror(err));
		return err;
	}

//path.SetTo(&originalDir, fItems[i].name);
//printf("as '%s'\n", path.Path());

	// Reset the name here, the user may have already moved the entry
	// out of the trash via Tracker for example.
	fNameInTrash = "";

	// Finally, move the entry back into the original folder
	err = entry.MoveTo(&originalDir, fRef.name);
	if (err != B_OK) {
		fprintf(stderr, "failed to restore entry from trash "
			"%s: %s\n", fRef.name, strerror(err));
		return err;
	}

	// Remove the attribute that helps Tracker restore the entry.
	BNode node(&entry);
	node.RemoveAttr("_trk/original_path");

	return err;
}
开发者ID:mariuz,项目名称:haiku,代码行数:62,代码来源:FilePlaylistItem.cpp


示例6: BContainerWindow

TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target,
	const BEntry* startDir, uint32 nodeFlavors, bool multipleSelection,
	BMessage* message, BRefFilter* filter, uint32 containerWindowFlags,
	window_look look, window_feel feel, bool hideWhenDone)
	:
	BContainerWindow(0, containerWindowFlags, look, feel, 0,
		B_CURRENT_WORKSPACE, false),
	fDirMenu(NULL),
	fDirMenuField(NULL),
	fTextControl(NULL),
	fClientObject(NULL),
	fSelectionIterator(0),
	fMessage(NULL),
	fHideWhenDone(hideWhenDone),
	fIsTrackingMenu(false)
{
	InitIconPreloader();

	fIsSavePanel = (mode == B_SAVE_PANEL);

	BRect windRect(85, 50, 568, 296);
	MoveTo(windRect.LeftTop());
	ResizeTo(windRect.Width(), windRect.Height());

	fNodeFlavors = (nodeFlavors == 0) ? B_FILE_NODE : nodeFlavors;

	if (target)
		fTarget = *target;
	else
		fTarget = BMessenger(be_app);

	if (message)
		SetMessage(message);
	else if (fIsSavePanel)
		fMessage = new BMessage(B_SAVE_REQUESTED);
	else
		fMessage = new BMessage(B_REFS_RECEIVED);

	gLocalizedNamePreferred
		= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();

	// check for legal starting directory
	Model* model = new Model();
	bool useRoot = true;

	if (startDir) {
		if (model->SetTo(startDir) == B_OK && model->IsDirectory())
			useRoot = false;
		else {
			delete model;
			model = new Model();
		}
	}

	if (useRoot) {
		BPath path;
		if (find_directory(B_USER_DIRECTORY, &path) == B_OK) {
			BEntry entry(path.Path(), true);
			if (entry.InitCheck() == B_OK && model->SetTo(&entry) == B_OK)
				useRoot = false;
		}
	}

	if (useRoot) {
		BVolume volume;
		BDirectory root;
		BVolumeRoster volumeRoster;
		volumeRoster.GetBootVolume(&volume);
		volume.GetRootDirectory(&root);

		BEntry entry;
		root.GetEntry(&entry);
		model->SetTo(&entry);
	}

	fTaskLoop = new PiggybackTaskLoop;

	AutoLock<BWindow> lock(this);
	fBorderedView = new BorderedView;
	CreatePoseView(model);
	fPoseView->SetRefFilter(filter);
	if (!fIsSavePanel)
		fPoseView->SetMultipleSelection(multipleSelection);

	fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE);
	fPoseView->SetPoseEditing(false);
	AddCommonFilter(new BMessageFilter(B_KEY_DOWN, key_down_filter));
	AddCommonFilter(new BMessageFilter(B_SIMPLE_DATA,
		TFilePanel::MessageDropFilter));
	AddCommonFilter(new BMessageFilter(B_NODE_MONITOR, TFilePanel::FSFilter));

	// inter-application observing
	BMessenger tracker(kTrackerSignature);
	BHandler::StartWatching(tracker, kDesktopFilePanelRootChanged);

	Init();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:97,代码来源:FilePanelPriv.cpp


示例7: windRect

void
TFilePanel::Init(const BMessage*)
{
	BRect windRect(Bounds());
	fBackView = new BView(Bounds(), "View", B_FOLLOW_ALL, 0);
	fBackView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(fBackView);

	// add poseview menu bar
	fMenuBar = new BMenuBar(BRect(0, 0, windRect.Width(), 1), "MenuBar");
	fMenuBar->SetBorder(B_BORDER_FRAME);
	fBackView->AddChild(fMenuBar);

	// add directory menu and menufield
	fDirMenu = new BDirMenu(0, this, kSwitchDirectory, "refs");

	font_height ht;
	be_plain_font->GetHeight(&ht);
	float f_height = ht.ascent + ht.descent + ht.leading;

	BRect rect;
	rect.top = fMenuBar->Bounds().Height() + 8;
	rect.left = windRect.left + 8;
	rect.right = rect.left + 300;
	rect.bottom = rect.top + (f_height > 22 ? f_height : 22);

	fDirMenuField = new BMenuField(rect, "DirMenuField", "", fDirMenu);
	fDirMenuField->MenuBar()->SetFont(be_plain_font);
	fDirMenuField->SetDivider(0);
	fDirMenuField->MenuBar()->SetMaxContentWidth(rect.Width() - 26.0f);
		// Make room for the icon

	fDirMenuField->MenuBar()->RemoveItem((int32)0);
	fDirMenu->SetMenuBar(fDirMenuField->MenuBar());
		// the above is a weird call from BDirMenu
		// ToDo: clean up

	BEntry entry(TargetModel()->EntryRef());
	if (entry.InitCheck() == B_OK)
		fDirMenu->Populate(&entry, 0, true, true, false, true);
	else
		fDirMenu->Populate(0, 0, true, true, false, true);

	fBackView->AddChild(fDirMenuField);

	// add file name text view
	if (fIsSavePanel) {
		BRect rect(windRect);
		rect.top = rect.bottom - 35;
		rect.left = 8;
		rect.right = rect.left + 170;
		rect.bottom = rect.top + 13;

		fTextControl = new BTextControl(rect, "text view",
			B_TRANSLATE("save text"), "", NULL,
			B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
		DisallowMetaKeys(fTextControl->TextView());
		DisallowFilenameKeys(fTextControl->TextView());
		fBackView->AddChild(fTextControl);
		fTextControl->SetDivider(0.0f);
		fTextControl->TextView()->SetMaxBytes(B_FILE_NAME_LENGTH - 1);

		fButtonText.SetTo(B_TRANSLATE("Save"));
	} else
		fButtonText.SetTo(B_TRANSLATE("Open"));

	// Add PoseView
	fBorderedView->SetName("PoseView");
	fBorderedView->SetResizingMode(B_FOLLOW_ALL);
	fBorderedView->EnableBorderHighlight(true);

	rect = windRect;
	rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10);
	rect.bottom = windRect.bottom - 60;
	rect.right -= B_V_SCROLL_BAR_WIDTH + 20;
	fBorderedView->MoveTo(rect.LeftTop());
	fBorderedView->ResizeTo(rect.Width(), rect.Height());

	PoseView()->AddScrollBars();
	PoseView()->SetDragEnabled(false);
	PoseView()->SetDropEnabled(false);
	PoseView()->SetSelectionHandler(this);
	PoseView()->SetSelectionChangedHook(true);
	PoseView()->DisableSaveLocation();

	// horizontal
	rect = fBorderedView->Frame();
	rect.top = rect.bottom;
	rect.bottom = rect.top + (float)B_H_SCROLL_BAR_HEIGHT;
	PoseView()->HScrollBar()->MoveTo(rect.LeftTop());
	PoseView()->HScrollBar()->ResizeTo(rect.Size());
	PoseView()->HScrollBar()->SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
	fBackView->AddChild(PoseView()->HScrollBar());

	// vertical
	rect = fBorderedView->Frame();
	rect.left = rect.right;
	rect.right = rect.left + (float)B_V_SCROLL_BAR_WIDTH;
	PoseView()->VScrollBar()->MoveTo(rect.LeftTop());
	PoseView()->VScrollBar()->ResizeTo(rect.Size());
//.........这里部分代码省略.........
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:101,代码来源:FilePanelPriv.cpp


示例8: main

int main(int argc, char** argv)
{	
	if (argc == 1) return 1;
	
	Path entry(argv[1]);
	
	Base* base = new Base();
	
	// fs::canonical(fs::initial_path());
	Path exedir = boost::filesystem::system_complete(argv[0]).parent_path();
	//std::cout << exedir / "../lib" << std::endl;
	base->add(exedir / "../lib"); // Library folder
	
	if (fs::exists(entry)) {
		base->add(entry.parent_path());
	} else {
		if (fs::exists(fs::current_path() / entry))
		{
			entry = fs::current_path() / entry;
			base->add(entry.parent_path());
		}
		else 
		{
			std::cout << "Can't find entry " << entry << "" << std::endl; 
			return 1;
		}
	}
	
	Scope context(base);
	
	// Primairy types:
	context->create(Scope(new Primitive("void")));
	context->create(Scope(new Primitive("bool")));
	context->create(Scope(new Primitive("char")));
	context->create(Scope(new Primitive("byte"))); // unsigned char
	context->create(Scope(new Primitive("int")));
	context->create(Scope(new Primitive("uint")));
	context->create(Scope(new Primitive("short")));
	context->create(Scope(new Primitive("ushort")));
	context->create(Scope(new Primitive("float")));
	context->create(Scope(new Primitive("double")));
	
	Parser parser(entry, context, entry.stem().string());
	try
	{
		parser.parse();
		
		if (String(argv[2]) == "info") {
			std::cout << context->representate() << std::endl;
			std::cout << "Generating code..." << std::endl;
		}
		
		context->generate();
	}
	catch (p_Error e)
	{
		std::cout << context->representate() << std::endl << std::endl;
		
		std::cout << "An error occurred in: " << parser.scanner.file.filename() << std::endl << "on line " << parser.scanner.token_line << ", position " <<parser.scanner.token_pos << ":" << std::endl;

		std::cout << e->what() << std::endl;

	}
	catch (...)
	{
		std::cout << "Uknown exception occurred..." << std::endl;
	}
	return 0;
}
开发者ID:TimKorse,项目名称:Swift,代码行数:69,代码来源:main.cpp


示例9: switch

void
TFilePanel::MessageReceived(BMessage* message)
{
	entry_ref ref;

	switch (message->what) {
		case B_REFS_RECEIVED:
			// item was double clicked in file panel (PoseView)
			if (message->FindRef("refs", &ref) == B_OK) {
				BEntry entry(&ref, true);
				if (entry.InitCheck() == B_OK) {
					// Double-click on dir or link-to-dir ALWAYS opens the
					// dir. If more than one dir is selected, the first is
					// entered.
					if (entry.IsDirectory()) {
						entry.GetRef(&ref);
						bool isDesktop = SwitchDirToDesktopIfNeeded(ref);

						PoseView()->SetIsDesktop(isDesktop);
						entry.SetTo(&ref);
						PoseView()->SwitchDir(&ref);
						SwitchDirMenuTo(&ref);
					} else {
						// Otherwise, we have a file or a link to a file.
						// AdjustButton has already tested the flavor;
						// all we have to do is see if the button is enabled.
						BButton* button = dynamic_cast<BButton*>(
							FindView("default button"));
						if (button == NULL)
							break;

						if (IsSavePanel()) {
							int32 count = 0;
							type_code type;
							message->GetInfo("refs", &type, &count);

							// Don't allow saves of multiple files
							if (count > 1) {
								ShowCenteredAlert(
									B_TRANSLATE(
										"Sorry, saving more than one "
										"item is not allowed."),
									B_TRANSLATE("Cancel"));
							} else {
								// if we are a savepanel, set up the
								// filepanel correctly then pass control
								// so we follow the same path as if the user
								// clicked the save button

								// set the 'name' fld to the current ref's
								// name notify the panel that the default
								// button should be enabled
								SetSaveText(ref.name);
								SelectionChanged();

								HandleSaveButton();
							}
							break;
						}

					  	// send handler a message and close
						BMessage openMessage(*fMessage);
						for (int32 index = 0; ; index++) {
					  		if (message->FindRef("refs", index, &ref) != B_OK)
								break;
							openMessage.AddRef("refs", &ref);
					  	}
						OpenSelectionCommon(&openMessage);
					}
				}
			}
			break;

		case kSwitchDirectory:
		{
			entry_ref ref;
			// this comes from dir menu or nav menu, so switch directories
			if (message->FindRef("refs", &ref) == B_OK) {
				BEntry entry(&ref, true);
				if (entry.GetRef(&ref) == B_OK)
					SetTo(&ref);
			}
			break;
		}

		case kSwitchToHome:
		{
			BPath homePath;
			entry_ref ref;
			if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK
				|| get_ref_for_path(homePath.Path(), &ref) != B_OK) {
				break;
			}

			SetTo(&ref);
			break;
		}

		case kAddCurrentDir:
		{
//.........这里部分代码省略.........
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:101,代码来源:FilePanelPriv.cpp


示例10: ASSERT

filter_result
TFilePanel::MessageDropFilter(BMessage* message, BHandler**,
	BMessageFilter* filter)
{
	if (message == NULL || !message->WasDropped())
		return B_DISPATCH_MESSAGE;

	ASSERT(filter != NULL);
	if (filter == NULL)
		return B_DISPATCH_MESSAGE;

	TFilePanel* panel = dynamic_cast<TFilePanel*>(filter->Looper());
	ASSERT(panel != NULL);

	if (panel == NULL)
		return B_DISPATCH_MESSAGE;

	uint32 type;
	int32 count;
	if (message->GetInfo("refs", &type, &count) != B_OK)
		return B_SKIP_MESSAGE;

	if (count != 1)
		return B_SKIP_MESSAGE;

	entry_ref ref;
	if (message->FindRef("refs", &ref) != B_OK)
		return B_SKIP_MESSAGE;

	BEntry entry(&ref);
	if (entry.InitCheck() != B_OK)
		return B_SKIP_MESSAGE;

	// if the entry is a symlink
	// resolve it and see if it is a directory
	// pass it on if it is
	if (entry.IsSymLink()) {
		entry_ref resolvedRef;

		entry.GetRef(&resolvedRef);
		BEntry resolvedEntry(&resolvedRef, true);

		if (resolvedEntry.IsDirectory()) {
			// both entry and ref need to be the correct locations
			// for the last setto
			resolvedEntry.GetRef(&ref);
			entry.SetTo(&ref);
		}
	}

	// if not a directory, set to the parent, and select the child
	if (!entry.IsDirectory()) {
		node_ref child;
		if (entry.GetNodeRef(&child) != B_OK)
			return B_SKIP_MESSAGE;

		BPath path(&entry);

		if (entry.GetParent(&entry) != B_OK)
			return B_SKIP_MESSAGE;

		entry.GetRef(&ref);

		panel->fTaskLoop->RunLater(NewMemberFunctionObjectWithResult
			(&TFilePanel::SelectChildInParent, panel,
			const_cast<const entry_ref*>(&ref),
			const_cast<const node_ref*>(&child)),
			ref == *panel->TargetModel()->EntryRef() ? 0 : 100000, 200000,
				5000000);
				// if the target directory is already current, we won't
				// delay the initial selection try

		// also set the save name to the dragged in entry
		if (panel->IsSavePanel())
			panel->SetSaveText(path.Leaf());
	}

	panel->SetTo(&ref);

	return B_SKIP_MESSAGE;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:81,代码来源:FilePanelPriv.cpp


示例11: entry

inline void
TwoSidedTrsmUVar2
( UnitOrNonUnit diag, DistMatrix<F>& A, const DistMatrix<F>& U )
{
#ifndef RELEASE
    CallStackEntry entry("internal::TwoSidedTrsmUVar2");
    if( A.Height() != A.Width() )
        LogicError("A must be square");
    if( U.Height() != U.Width() )
        LogicError("Triangular matrices must be square");
    if( A.Height() != U.Height() )
        LogicError("A and U must be the same size");
#endif
    const Grid& g = A.Grid();

    // Matrix views
    DistMatrix<F>
        ATL(g), ATR(g),  A00(g), A01(g), A02(g),
        ABL(g), ABR(g),  A10(g), A11(g), A12(g),
                         A20(g), A21(g), A22(g);
    DistMatrix<F>
        UTL(g), UTR(g),  U00(g), U01(g), U02(g),
        UBL(g), UBR(g),  U10(g), U11(g), U12(g),
                         U20(g), U21(g), U22(g);

    // Temporary distributions
    DistMatrix<F,MC,  STAR> A01_MC_STAR(g);
    DistMatrix<F,VC,  STAR> A01_VC_STAR(g);
    DistMatrix<F,STAR,STAR> A11_STAR_STAR(g);
    DistMatrix<F,STAR,VR  > A12_STAR_VR(g);
    DistMatrix<F,MC,  STAR> F01_MC_STAR(g);
    DistMatrix<F,MC,  STAR> U01_MC_STAR(g);
    DistMatrix<F,VR,  STAR> U01_VR_STAR(g);
    DistMatrix<F,STAR,MR  > U01Adj_STAR_MR(g);
    DistMatrix<F,STAR,STAR> U11_STAR_STAR(g);
    DistMatrix<F,STAR,MR  > X11_STAR_MR(g);
    DistMatrix<F,MR,  STAR> X12Adj_MR_STAR(g);
    DistMatrix<F,MR,  MC  > X12Adj_MR_MC(g);
    DistMatrix<F,MR,  MC  > Y01_MR_MC(g);
    DistMatrix<F,MR,  STAR> Y01_MR_STAR(g);
    DistMatrix<F> X11(g);
    DistMatrix<F> Y01(g);

    Matrix<F> X12Local;

    PartitionDownDiagonal
    ( A, ATL, ATR,
         ABL, ABR, 0 );
    LockedPartitionDownDiagonal
    ( U, UTL, UTR,
         UBL, UBR, 0 );
    while( ATL.Height() < A.Height() )
    {
        RepartitionDownDiagonal
        ( ATL, /**/ ATR,  A00, /**/ A01, A02,
         /*************/ /******************/
               /**/       A10, /**/ A11, A12,
          ABL, /**/ ABR,  A20, /**/ A21, A22 );

        LockedRepartitionDownDiagonal
        ( UTL, /**/ UTR,  U00, /**/ U01, U02,
         /*************/ /******************/
               /**/       U10, /**/ U11, U12,
          UBL, /**/ UBR,  U20, /**/ U21, U22 );

        A01_MC_STAR.AlignWith( U01 );
        Y01.AlignWith( A01 );
        Y01_MR_STAR.AlignWith( A00 );
        U01_MC_STAR.AlignWith( A00 );
        U01_VR_STAR.AlignWith( A00 );
        U01Adj_STAR_MR.AlignWith( A00 );
        X11_STAR_MR.AlignWith( U01 );
        X11.AlignWith( A11 );
        X12Adj_MR_STAR.AlignWith( A02 );
        X12Adj_MR_MC.AlignWith( A12 );
        F01_MC_STAR.AlignWith( A00 );
        //--------------------------------------------------------------------//
        // Y01 := A00 U01
        U01_MC_STAR = U01;
        U01_VR_STAR = U01_MC_STAR;
        U01Adj_STAR_MR.AdjointFrom( U01_VR_STAR );
        Zeros( Y01_MR_STAR, A01.Height(), A01.Width() );
        Zeros( F01_MC_STAR, A01.Height(), A01.Width() );
        LocalSymmetricAccumulateLU
        ( ADJOINT, 
          F(1), A00, U01_MC_STAR, U01Adj_STAR_MR, F01_MC_STAR, Y01_MR_STAR );
        Y01_MR_MC.SumScatterFrom( Y01_MR_STAR );
        Y01 = Y01_MR_MC;
        Y01.SumScatterUpdate( F(1), F01_MC_STAR );

        // X11 := U01' A01
        LocalGemm( ADJOINT, NORMAL, F(1), U01_MC_STAR, A01, X11_STAR_MR );

        // A01 := A01 - Y01
        Axpy( F(-1), Y01, A01 );
        A01_MC_STAR = A01;
        
        // A11 := A11 - triu(X11 + A01' U01) = A11 - (U01 A01 + A01' U01)
        LocalGemm( ADJOINT, NORMAL, F(1), A01_MC_STAR, U01, F(1), X11_STAR_MR );
        X11.SumScatterFrom( X11_STAR_MR );
//.........这里部分代码省略.........
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:101,代码来源:UVar2.hpp


示例12: entry

void
SourceFileC::RemoveObjects(BuildInfo &info)
{
	BEntry entry(GetObjectPath(info).GetFullPath());
	entry.Remove();
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:6,代码来源:SourceTypeC.cpp


示例13: entry

const PString &PIni::entry(const pchar *name) const
{
    return entry(PString(name));
}
开发者ID:alonecat06,项目名称:FutureInterface,代码行数:4,代码来源:pini.cpp


示例14: bdecode_recursive

		void bdecode_recursive(InIt& in, InIt end, entry& ret, bool& err, int depth)
		{
			if (depth >= 100)
			{
				err = true;
				return;
			}

			if (in == end)
			{
				err = true;
#ifdef TORRENT_DEBUG
				ret.m_type_queried = false;
#endif
				return;
			}
			switch (*in)
			{

			// ----------------------------------------------
			// integer
			case 'i':
				{
				++in; // 'i' 
				std::string val = read_until(in, end, 'e', err);
				if (err) return;
				TORRENT_ASSERT(*in == 'e');
				++in; // 'e' 
				ret = entry(entry::int_t);
				char* end_pointer;
				ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
#ifdef TORRENT_DEBUG
				ret.m_type_queried = false;
#endif
				if (end_pointer == val.c_str())
				{
					err = true;
					return;
				}
				} break;

			// ----------------------------------------------
			// list
			case 'l':
				{
				ret = entry(entry::list_t);
				++in; // 'l'
				while (*in != 'e')
				{
					ret.list().push_back(entry());
					entry& e = ret.list().back();
					bdecode_recursive(in, end, e, err, depth + 1);
					if (err)
					{
#ifdef TORRENT_DEBUG
						ret.m_type_queried = false;
#endif
						return;
					}
					if (in == end)
					{
						err = true;
#ifdef TORRENT_DEBUG
						ret.m_type_queried = false;
#endif
						return;
					}
				}
#ifdef TORRENT_DEBUG
				ret.m_type_queried = false;
#endif
				TORRENT_ASSERT(*in == 'e');
				++in; // 'e'
				} break;

			// ----------------------------------------------
			// dictionary
			case 'd':
				{
				ret = entry(entry::dictionary_t);
				++in; // 'd'
				while (*in != 'e')
				{
					entry key;
					bdecode_recursive(in, end, key, err, depth + 1);
					if (err || key.type() != entry::string_t)
					{	
#ifdef TORRENT_DEBUG
						ret.m_type_queried = false;
#endif
						return;
					}
					entry& e = ret[key.string()];
					bdecode_recursive(in, end, e, err, depth + 1);
					if (err)
					{
#ifdef TORRENT_DEBUG
						ret.m_type_queried = false;
#endif
						return;
//.........这里部分代码省略.........
开发者ID:andreicristianpetcu,项目名称:popcorn-time,代码行数:101,代码来源:bencode.hpp


示例15: fprintf

ssize_t StringPool::add(const String16& value,
        bool mergeDuplicates, const String8* configTypeName, const ResTable_config* config)
{
    ssize_t vidx = mValues.indexOfKey(value);
    ssize_t pos = vidx >= 0 ? mValues.valueAt(vidx) : -1;
    ssize_t eidx = pos >= 0 ? mEntryArray.itemAt(pos) : -1;
    if (eidx < 0) {
        eidx = mEntries.add(entry(value));
        if (eidx < 0) {
            fprintf(stderr, "Failure adding string %s\n", String8(value).string());
            return eidx;
        }
    }

    if (configTypeName != NULL) {
        entry& ent = mEntries.editItemAt(eidx);
        NOISY(printf("*** adding config type name %s, was %s\n",
                configTypeName->string(), ent.configTypeName.string()));
        if (ent.configTypeName.size() <= 0) {
            ent.configTypeName = *configTypeName;
        } else if (ent.configTypeName != *configTypeName) {
            ent.configTypeName = " ";
        }
    }

    if (config != NULL) {
        // Add this to the set of configs associated with the string.
        entry& ent = mEntries.editItemAt(eidx);
        size_t addPos;
        for (addPos=0; addPos<ent.configs.size(); addPos++) {
            int cmp = ent.configs.itemAt(addPos).compareLogical(*config);
            if (cmp >= 0) {
                if (cmp > 0) {
                    NOISY(printf("*** inserting config: %s\n", config->toString().string()));
                    ent.configs.insertAt(*config, addPos);
                }
                break;
            }
        }
        if (addPos >= ent.configs.size()) {
            NOISY(printf("*** adding config: %s\n", config->toString().string()));
            ent.configs.add(*config);
        }
    }

    const bool first = vidx < 0;
    const bool styled = (pos >= 0 && (size_t)pos < mEntryStyleArray.size()) ?
        mEntryStyleArray[pos].spans.size() : 0;
    if (first || styled || !mergeDuplicates) {
        pos = mEntryArray.add(eidx);
        if (first) {
            vidx = mValues.add(value, pos);
        }
        entry& ent = mEntries.editItemAt(eidx);
        ent.indices.add(pos);
    }

    NOISY(printf("Adding string %s to pool: pos=%d eidx=%d vidx=%d\n",
            String8(value).string(), pos, eidx, vidx));
    
    return pos;
}
开发者ID:chocoletee,项目名称:platform_frameworks_base,代码行数:62,代码来源:StringPool.cpp


示例16: while


//.........这里部分代码省略.........
        mSkipBytes = mElement.mSize.mValue;
        mState = CHECK_INIT_FOUND;
        break;
      default:
        mSkipBytes = mElement.mSize.mValue;
        mState = SKIP_DATA;
        mNextState = READ_ELEMENT_ID;
        break;
      }
      break;
    case READ_VINT: {
      unsigned char c = *p++;
      uint32_t mask;
      mVInt.mLength = VIntLength(c, &mask);
      mVIntLeft = mVInt.mLength - 1;
      mVInt.mValue = mVIntRaw ? c : c & ~mask;
      mState = READ_VINT_REST;
      break;
    }
    case READ_VINT_REST:
      if (mVIntLeft) {
        mVInt.mValue <<= 8;
        mVInt.mValue |= *p++;
        mVIntLeft -= 1;
      } else {
        mState = mNextState;
      }
      break;
    case READ_TIMECODESCALE:
      MOZ_ASSERT(mGotTimecodeScale);
      mTimecodeScale = mVInt.mValue;
      mState = READ_ELEMENT_ID;
      break;
    case READ_CLUSTER_TIMECODE:
      mClusterTimecode = mVInt.mValue;
      mState = READ_ELEMENT_ID;
      break;
    case READ_BLOCK_TIMECODE:
      if (mBlockTimecodeLength) {
        mBlockTimecode <<= 8;
        mBlockTimecode |= *p++;
        mBlockTimecodeLength -= 1;
      } else {
        // It's possible we've parsed this data before, so avoid inserting
        // duplicate WebMTimeDataOffset entries.
        {
          ReentrantMonitorAutoEnter mon(aReentrantMonitor);
          int64_t endOffset = mBlockOffset + mBlockSize +
                              mElement.mID.mLength + mElement.mSize.mLength;
          uint32_t idx = aMapping.IndexOfFirstElementGt(endOffset);
          if (idx == 0 || aMapping[idx - 1] != endOffset) {
            // Don't insert invalid negative timecodes.
            if (mBlockTimecode >= 0 || mClusterTimecode >= uint16_t(abs(mBlockTimecode))) {
              MOZ_ASSERT(mGotTimecodeScale);
              uint64_t absTimecode = mClusterTimecode + mBlockTimecode;
              absTimecode *= mTimecodeScale;
              WebMTimeDataOffset entry(endOffset, absTimecode, mClusterOffset);
              aMapping.InsertElementAt(idx, entry);
            }
          }
        }

        // Skip rest of block header and the block's payload.
        mBlockSize -= mVInt.mLength;
        mBlockSize -= BLOCK_TIMECODE_LENGTH;
        mSkipBytes = uint32_t(mBlockSize);
        mState = SKIP_DATA;
        mNextState = READ_ELEMENT_ID;
      }
      break;
    case SKIP_DATA:
      if (mSkipBytes) {
        uint32_t left = aLength - (p - aBuffer);
        left = std::min(left, mSkipBytes);
        p += left;
        mSkipBytes -= left;
      } else {
        mState = mNextState;
      }
      break;
    case CHECK_INIT_FOUND:
      if (mSkipBytes) {
        uint32_t left = aLength - (p - aBuffer);
        left = std::min(left, mSkipBytes);
        p += left;
        mSkipBytes -= left;
      }
      if (!mSkipBytes) {
        if (mInitEndOffset < 0) {
          mInitEndOffset = mCurrentOffset + (p - aBuffer);
        }
        mState = READ_ELEMENT_ID;
      }
      break;
    }
  }

  NS_ASSERTION(p == aBuffer + aLength, "Must have parsed to end of data.");
  mCurrentOffset += aLength;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:101,代码来源:WebMBufferedParser.cpp


示例17: ofStringReplace

void testApp::loadURL_alphabet(ofHttpResponse &response) {
    newAlphabet.clear();
    int numberOfLettersAdded=0;
    vector<AlphabetEntry> allLetters;
    for (int i=0; i<allEntries.size(); i++) {
        ofStringReplace(allEntries[i], "letter\":\"", "");
        vector<string> cutEntries =ofSplitString(allEntries[i], "\",\"");
        //delete the first parts in all of them
        ofStringReplace(cutEntries[0], "\"ID\":\"","");
        ofStringReplace(cutEntries[0], "\"", "");
        ofStringReplace(cutEntries[1], "\"", "");
        string letter=cutEntries[1];
        if (i>1) {
            if (allLetters[numberOfLettersAdded-1]._letter!=letter) {
                AlphabetEntry entry(cutEntries[0], cutEntries[1], numberOfLettersAdded);
                allLetters.push_back(entry);
                numberOfLettersAdded++;
            }
        } else {
            AlphabetEntry entry(cutEntries[0], cutEntries[1], i);
            allLetters.push_back(entry);
            numberOfLettersAdded++;
        }
    }
    for (int j=0; j<42; j++) {
        //go through all letters we have
        for (int i=0; i<allLetters.size(); i++) {
            if (allLetters[i]._letter==alphabet[j]) {
                AlphabetEntry entry(ofToString(allLetters[i]._id), allLetters[i]._letter, j);
                newAlphabet.push_back(entry);
                break;
            } else if (i==allLetters.size()-1) {
                AlphabetEntry entry("0000", alphabet[j], j);
                newAlphabet.push_back(entry);
                break;
            }
        }
    }
    //if first time load > put the letters directly into the alphabet
    if (allAlphabet.size()<1) {
        for (int j=0; j<newAlphabet.size(); j++) {
            allAlphabet.push_back(newAlphabet[j]);
            if (allAlphabet[j]._id!=0) {
                allAlphabet[j].loadImage();
            } else {
                //load letter from image directory
                allAlphabet[j].loadImageDirectory();
            }

        }
    } else { //if there is already something in the alphabet
        for (int j=0; j<42; j++) {
            if (allAlphabet[j]._id!=newAlphabet[j]._id) {
                allAlphabet[j]=newAlphabet[j];
                allAlphabet.push_back(newAlphabet[j]);
                if (allAlphabet[j]._id!=0) {
                    allAlphabet[j].loadImage();
                } else {
                    //load letter from image directory
                    allAlphabet[j].loadImageDirectory();
                }

            } else {
                allAlphabet[j].reset();
            }
        }
    }
    if (response.status==200 && response.request.name=="async_req") {
        currImgNo1=0;
        currImgNo2=1;
        currImgNo3=2;
        currImgNo4=3;
        currImgNo5=4;
    }
}
开发者ID:ameyanaik1987,项目名称:Urban-Alphabets,代码行数:75,代码来源:testApp.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ entry_attr_timeout函数代码示例发布时间:2022-05-30
下一篇:
C++ entries函数代码示例发布时间: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