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

C++ selection函数代码示例

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

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



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

示例1: selection

/**
 * Retrieves the HTTP authentication username and password for a given host and realm pair. If
 * there are multiple username/password combinations for a host/realm, only the first one will
 * be returned.
 *
 * @param host the host the password applies to
 * @param realm the realm the password applies to
 * @return a String[] if found where String[0] is username (which can be null) and
 *         String[1] is password.  Null is returned if it can't find anything.
 */
AutoPtr< ArrayOf<String> > HttpAuthDatabase::GetHttpAuthUsernamePassword(
    /* [in] */ String host,
    /* [in] */ String realm)
{
    if (host == NULL || realm == NULL || !WaitForInit()) {
        return NULL;
    }

    AutoPtr< ArrayOf<String> > columns = ArrayOf<String> >::Alloc(2);
    (*columns)[0] = HTTPAUTH_USERNAME_COL;
    (*columns)[1] = HTTPAUTH_PASSWORD_COL;

    String selection("(");
    selection += HTTPAUTH_HOST_COL;
    selection += " == ?) AND ";
    selection += "(";
    selection += HTTPAUTH_REALM_COL;
    selection += " == ?)";

    AutoPtr< ArrayOf<String> > ret;
    AutoPtr<ICursor> cursor;
    // try {
        AutoPtr< ArrayOf<String> > hostRealm = ArrayOf<String>::Alloc(2);
        (*hostRealm)[0] = host;
        (*hostRealm)[1] = realm;
        mDatabase->Query(HTTPAUTH_TABLE_NAME, columns, selection,
                hostRealm, NULL, NULL, NULL, (ICursor**)&cursor);
        Boolean bMoveToFirst = FALSE;
        cursor->MoveToFirst(&bMoveToFirst);
        if (bMoveToFirst) {
            ret = ArrayOf<String>::Alloc(2);
            String str1, str2;
            Int32 index1, index2;
            cursor->GetColumnIndex(HTTPAUTH_USERNAME_COL, &index1);
            cursor->GetString(index1, &str1);
            cursor->GetColumnIndex(HTTPAUTH_USERNAME_COL, &index2);
            cursor->GetString(index2, &str2);
            (*ret)[0] = str1;
            (*ret)[1] = str2;
        }
    // } catch (IllegalStateException e) {
    //     Log.e(LOGTAG, "getHttpAuthUsernamePassword", e);
    // } finally {
    //     if (cursor != null) cursor.close();
    // }

    return ret;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:58,代码来源:HttpAuthDatabase.cpp


示例2: filtered_view_cmd

void
filtered_view_cmd (void)
{
    char *command;

    command =
	input_dialog (_(" Filtered view "),
		      _(" Filter command and arguments:"),
		      selection (current_panel)->fname);
    if (!command)
	return;

    view (command, "", 0, 0);

    g_free (command);
}
开发者ID:GalaxyTab4,项目名称:workbench,代码行数:16,代码来源:cmd.c


示例3: TEST_F

TEST_F(SelectionAdjusterTest, adjustSelectionInFlatTree)
{
    setBodyContent("<div id=sample>foo</div>");
    MockVisibleSelectionChangeObserver selectionObserver;
    VisibleSelectionInFlatTree selectionInFlatTree;
    selectionInFlatTree.setChangeObserver(selectionObserver);

    Node* const sample = document().getElementById("sample");
    Node* const foo = sample->firstChild();
    // Select "foo"
    VisibleSelection selection(Position(foo, 0), Position(foo, 3));
    SelectionAdjuster::adjustSelectionInFlatTree(&selectionInFlatTree, selection);
    EXPECT_EQ(PositionInFlatTree(foo, 0), selectionInFlatTree.start());
    EXPECT_EQ(PositionInFlatTree(foo, 3), selectionInFlatTree.end());
    EXPECT_EQ(1, selectionObserver.callCounter()) << "adjustSelectionInFlatTree() should call didChangeVisibleSelection()";
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:16,代码来源:SelectionAdjusterTest.cpp


示例4: main

void main()
{
       int x[MAXSIZE],n, i;
	printf("\n Enter number of elements ");
	scanf("%d",&n);
	for (i = 0; i < n; i++)
	{	printf("\n Enter element %d ",i+1);
		scanf("%d",&x[i]);
	}
	selection(x, n);
	printf("\n Sorted list is:\n\n");

	for (i = 0; i < n; i++)
		printf("%d ", x[i]);
	printf("\n");
}
开发者ID:maseeraali,项目名称:Data-structure,代码行数:16,代码来源:selection.c


示例5: main

void main()
{
	int n,a[50],i;
	printf("Enter the number of elements");
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	selection(a,n);
	for(i=0;i<n;i++)
	{
		printf("%d",a[i]);
	}
	return 0;
}
开发者ID:wolfdale,项目名称:Spaghetti-code,代码行数:16,代码来源:selectionsort.c


示例6: LOG_DEBUG

void TimelineDock::setSelection(QList<int> newSelection, int trackIndex, bool isMultitrack)
{
    if (newSelection != selection()
            || trackIndex != m_selection.selectedTrack
            || isMultitrack != m_selection.isMultitrackSelected) {
        LOG_DEBUG() << "Changing selection to" << newSelection << " trackIndex" << trackIndex << "isMultitrack" << isMultitrack;
        m_selection.selectedClips = newSelection;
        m_selection.selectedTrack = trackIndex;
        m_selection.isMultitrackSelected = isMultitrack;
        emit selectionChanged();

        if (!m_selection.selectedClips.isEmpty())
            emitSelectedFromSelection();
        else
            emit selected(0);
    }
}
开发者ID:bmatherly,项目名称:shotcut,代码行数:17,代码来源:timelinedock.cpp


示例7: filtered_view_cmd

void
filtered_view_cmd (void)
{
    char *command;

    command =
	input_dialog (_(" Filtered view "),
		      _(" Filter command and arguments:"),
		      MC_HISTORY_FM_FILTERED_VIEW,
		      selection (current_panel)->fname);
    if (!command)
	return;

    mc_internal_viewer (command, "", NULL, 0);

    g_free (command);
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:17,代码来源:cmd.c


示例8: TEST_F

TEST_F(FrameSelectionTest, InvalidateCaretRect)
{
    RefPtrWillBeRawPtr<Text> text = appendTextNode("Hello, World!");
    document().view()->updateAllLifecyclePhases();

    VisibleSelection validSelection(Position(text, 0), Position(text, 0));
    setSelection(validSelection);
    selection().setCaretRectNeedsUpdate();
    EXPECT_TRUE(selection().isCaretBoundsDirty());
    selection().invalidateCaretRect();
    EXPECT_FALSE(selection().isCaretBoundsDirty());

    document().body()->removeChild(text);
    document().updateLayoutIgnorePendingStylesheets();
    selection().setCaretRectNeedsUpdate();
    EXPECT_TRUE(selection().isCaretBoundsDirty());
    selection().invalidateCaretRect();
    EXPECT_FALSE(selection().isCaretBoundsDirty());
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:19,代码来源:FrameSelectionTest.cpp


示例9: selection

void Matrix::copySelection()
{
QString text;
int i,j;
int rows=d_table->numRows();
int cols=d_table->numCols();

QMemArray<int> selection(1);
int c=0;	
for (i=0;i<cols;i++)
	{
	if (d_table->isColumnSelected(i,TRUE))
		{
		c++;
		selection.resize(c);
		selection[c-1]=i;			
		}
	}
if (c>0)
	{	
	for (i=0; i<rows; i++)
		{
		for (j=0;j<c-1;j++)
			text+=d_table->text(i,selection[j])+"\t";
		text+=d_table->text(i,selection[c-1])+"\n";
		}	
	}
else
	{
	QTableSelection sel=d_table->selection(d_table->currentSelection());
	int top=sel.topRow();
	int bottom=sel.bottomRow();
	int left=sel.leftCol();
	int right=sel.rightCol();
	for (i=top; i<=bottom; i++)
		{
		for (j=left; j<right; j++)
			text+=d_table->text(i,j)+"\t";
		text+=d_table->text(i,right)+"\n";
		}
	}		
	
// Copy text into the clipboard
QApplication::clipboard()->setData(new QTextDrag(text,d_table,0));
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:45,代码来源:matrix.cpp


示例10: trackerTextF

    virtual QwtText trackerTextF( const QPointF &pos ) const
    {
        QwtText text;

        const QPolygon points = selection();
        if ( !points.isEmpty() )
        {
            QString num;
            num.setNum( QLineF( pos, invTransform( points[0] ) ).length() );

            QColor bg( Qt::green );
            bg.setAlpha( 200 );

            text.setBackgroundBrush( QBrush( bg ) );
            text.setText( num );
        }
        return text;
    }
开发者ID:Q55,项目名称:qtwinriver,代码行数:18,代码来源:plot.cpp


示例11: crossover

char * crossover(char **population, double p_crossover) {
	//selection
	int x = 0, y = 0; //x,y store the index of two selected parents
	selection(population, &x, &y);
	//printf("selected parents index: %d %d\n",x, y);

	char *child = (char *) malloc(LENGTH * sizeof(char));
	int crossover_point = p_crossover * LENGTH;
	int gene;
	for (gene = 0; gene < LENGTH; gene++) {
		if (gene < crossover_point)
			child[gene] = population[x][gene];
		else
			child[gene] = population[y][gene];
	}
	// printf("parents : %s %s\n", population[x], population[y]);
	return child;
}
开发者ID:CCJY,项目名称:coliru,代码行数:18,代码来源:main.cpp


示例12: active_cell

void worksheet::active_cell(const cell_reference &ref)
{
    if (!has_view())
    {
        d_->views_.push_back(sheet_view());
    }

    auto &primary_view = d_->views_.front();

    if (!primary_view.has_selections())
    {
        primary_view.add_selection(selection(pane_corner::bottom_right, ref));
    }
    else
    {
        primary_view.selection(0).active_cell(ref);
    }
}
开发者ID:tfussell,项目名称:xlnt,代码行数:18,代码来源:worksheet.cpp


示例13: main

int main (int argc, char **argv) {
  int i, flag;
  flag = 0;
  initiate();   // 产生初始化群体
  evaluation(0);  // 对初始化种群进行评估、排序
  for (i = 0; i < MAXloop; i++) {   // 进入进化循环,当循环次数超过MAXloop所规定的值时终止循环,flag值保持为0
    cross();    // 进行交叉操作
    evaluation(1);  // 对子种群进行评估、排序
    selection();    // 从父、子种群中选择最优的NUM个作为新的父种群
    if (record() == 1) {  // 如果满足终止规则1时将flag置1,停止循环
      flag = 1;
      break;
    }
    mutation();   // 进行变异操作
  }
  showresult(flag);   // 按flag值显示寻优结果
  return 0;
}
开发者ID:SmileAI,项目名称:Ink.Pavilion,代码行数:18,代码来源:94_实现遗传算法.c


示例14: view_file_cmd

void
view_file_cmd (void)
{
    char *filename;
    vfs_path_t *vpath;

    filename =
        input_expand_dialog (_("View file"), _("Filename:"),
                             MC_HISTORY_FM_VIEW_FILE, selection (current_panel)->fname,
                             INPUT_COMPLETE_FILENAMES);
    if (filename == NULL)
        return;

    vpath = vfs_path_from_str (filename);
    g_free (filename);
    view_file (vpath, FALSE, use_internal_view != 0);
    vfs_path_free (vpath);
}
开发者ID:NoSeungHwan,项目名称:mc_kor_dev,代码行数:18,代码来源:cmd.c


示例15: selection

void Cena::mousePressEvent( QMouseEvent* event )
{
    if (smgr) {
        selection();

        mouseXi = device->getCursorControl()->getPosition().X;
        mouseYi = device->getCursorControl()->getPosition().Y;

        if(selectedSceneNode){
            xi = selectedSceneNode->getPosition().X;
            yi = selectedSceneNode->getPosition().Y;
            zi = selectedSceneNode->getPosition().Z;
        }
        sendMouseEventToIrrlicht(event, true);
        drawIrrlichtScene();
    }
    event->ignore();
}
开发者ID:pvmocbel,项目名称:Lane3dViewer,代码行数:18,代码来源:cena.cpp


示例16: main

int main()
{
	char finame[64],foname[64]={0};
	int chal,chud;
	FILE *fi,*fo;
	
	printf("入力ファイル名を入力してください.\n");
	scanf("%s",finame);
	
	fi=fileOpen(finame,"r");
	
	strncpy(foname,finame,strlen(finame)-strlen(strrchr(finame,'.')));
	strcat(foname,".out");
	
	fo=fileOpen(foname,"w");
	
	
	printf("実行するアルゴリズムを選択してください.\n|バブルソート---1   選択ソート---2   挿入ソート---3|");
	scanf("%d",&chal);
	printf("並べ替え方法を選択してください.\n|昇順---1   降順---2|");
	scanf("%d",&chud);
	
	switch(chal){
		case 1:
			bubble(chud,fi,fo);
			break;
			
		case 2:
			selection(chud,fi,fo);
			break;
			
		case 3:
			insertion(chud,fi,fo);
			break;
			
		default:
			printf("おかしな値を入力しないでください.\n");
	}
	
	fclose(fi);
	fclose(fo);
	
	return 0;
}
开发者ID:kekke-gk,项目名称:TNCT,代码行数:44,代码来源:3J18五味京祐_0104.c


示例17: swGPUParamSearch

extern void swGPUParamSearch(Chain* rowChainL, Chain* columnChainL, 
    SWPrefs* swPrefsL) {

    SWResult* swResult = 
        swDataGetResult(swSolveGPU(rowChainL, columnChainL, swPrefsL), 0);

    rowChain = rowChainL;
    columnChain = columnChainL;
    swPrefs = swPrefsL;
    columns = chainGetLength(columnChainL);
    expectedResult = swResultGetScore(swResult);

    srand(time(NULL));

    Cromosome child;

    initPopulation();
    evaluatePopulation();

    int generationIdx;
    int childIdx;

    for (generationIdx = 0; generationIdx < GENERATION_NMR; ++generationIdx) {

        sortCromosomes(population, 0, POPULATION_NMR - 1);

        printf(".............................................\n");
        printf("Generation: %d\n", generationIdx);

        for (childIdx = 0; childIdx < CHILD_NMR; ++childIdx) {

            child = crossover(selection());
            mutation(&child);

            children[childIdx] = child;
        }

        evaluateChildren();

        for (childIdx = 0; childIdx < CHILD_NMR; ++childIdx) {
            population[POPULATION_NMR - childIdx - 1] = children[childIdx];
        }
    }
}
开发者ID:brahle,项目名称:swSharp,代码行数:44,代码来源:sw_gpu_param_search.c


示例18: handle

// Subclassed handle() for keyboard searching
int EDE_Browser::handle(int e) {
	if (e==FL_FOCUS) { fprintf(stderr, "EB::focus\n"); }
	if (e==FL_KEYBOARD && Fl::event_state()==0) {
		// when user presses a key, jump to row starting with that character
		int k=Fl::event_key();
		if ((k>='a'&&k<='z') || (k>='A'&&k<='Z') || (k>='0'&&k<='9')) {
			if (k>='A'&&k<='Z') k+=('a'-'A');
			int ku = k - ('a'-'A'); //upper case
			int p=lineno(selection());
			for (int i=1; i<=size(); i++) {
				int mi = (i+p-1)%size() + 1; // search from currently selected one
				if (text(mi)[0]==k || text(mi)[0]==ku) {
					// select(line,0) just moves focus to line without selecting
					// if line was already selected, it won't be anymore
					select(mi,selected(mi));
					middleline(mi);
					//break;
					return 1; // menu will get triggered on key press :(
				}
			}
		}
		// Attempt to fix erratic behavior on enter key
		// Fl_Browser seems to do the following on enter key:
		// - when item is both selected and focused, callback isn't called at all (even FL_WHEN_ENTER_KEY_ALWAYS)
		// - when no item is selected, callback is called 2 times on focused item
		// - when one item is selected and other is focused, callback is first called on selected then on
		//   focused item, then the focused becomes selected
		// This partial fix at least ensures that callback is always called. Callback function should
		// deal with being called many times repeatedly.
		if ((when() & FL_WHEN_ENTER_KEY_ALWAYS) && k == FL_Enter) {
//			if (changed()!=0) {
				//fprintf(stderr,"do_callback()\n"); 
				do_callback();
//			}
		}

		if (k == FL_Tab) {
fprintf (stderr, "TAB\n");
			
//			Fl_Icon_Browser::handle(FL_UNFOCUS); return 1;
		}
	}
	return Fl_Icon_Browser::handle(e);
}
开发者ID:edeproject,项目名称:svn,代码行数:45,代码来源:EDE_Browser.cpp


示例19: selection

    //_______________________________________________________
    void ExceptionListWidget::up( void )
    {

        InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) );
        if( selection.empty() ) { return; }

        // retrieve selected indexes in list and store in model
        QModelIndexList selectedIndices( m_ui.exceptionListView->selectionModel()->selectedRows() );
        InternalSettingsList selectedExceptions( model().get( selectedIndices ) );

        InternalSettingsList currentException( model().get() );
        InternalSettingsList newExceptions;

        for( InternalSettingsList::const_iterator iter = currentException.constBegin(); iter != currentException.constEnd(); ++iter )
        {

            // check if new list is not empty, current index is selected and last index is not.
            // if yes, move.
            if(
                !( newExceptions.empty() ||
                selectedIndices.indexOf( model().index( *iter ) ) == -1 ||
                selectedIndices.indexOf( model().index( newExceptions.back() ) ) != -1
                ) )
            {
                InternalSettingsPtr last( newExceptions.back() );
                newExceptions.removeLast();
                newExceptions.append( *iter );
                newExceptions.append( last );
            } else newExceptions.append( *iter );

        }

        model().set( newExceptions );

        // restore selection
        m_ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ),  QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
        for( InternalSettingsList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter )
        { m_ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); }

        setChanged( true );

        return;

    }
开发者ID:anexation,项目名称:test,代码行数:45,代码来源:mendaexceptionlistwidget.cpp


示例20: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QStandardItemModel *model = new QStandardItemModel(7, 4, this);
    for (int row = 0; row < 7; ++row) {
        for (int column = 0; column < 4; ++column) {
            QStandardItem *item = new QStandardItem(QString("%1")
                                                    .arg(row * 4 + column));
            model->setItem(row, column, item);
        }
    }
    tableView = new QTableView;
    tableView->setModel(model);
    setCentralWidget(tableView);

    // 获取视图的项目选择模型
    QItemSelectionModel *selectionModel = tableView->selectionModel();
    // 定义左上角和右下角的索引,然后使用这两个索引创建选择
    QModelIndex topLeft;
    QModelIndex bottomRight;
    topLeft = model->index(1, 1, QModelIndex());
    bottomRight = model->index(5, 2, QModelIndex());
    QItemSelection selection(topLeft, bottomRight);
    // 使用指定的选择模式来选择项目
    selectionModel->select(selection, QItemSelectionModel::Select);

    ui->mainToolBar->addAction(tr("当前项目"), this, SLOT(getCurrentItemData()));
    ui->mainToolBar->addAction(tr("切换选择"), this, SLOT(toggleSelection()));

    connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(updateSelection(QItemSelection,QItemSelection)));
    connect(selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(changeCurrent(QModelIndex,QModelIndex)));

    // 多个视图共享选择
    tableView2 = new QTableView;
    tableView2->setWindowTitle("tableView2");
    tableView2->resize(400, 300);
    tableView2->setModel(model);
    tableView2->setSelectionModel(selectionModel);
    tableView2->show();
}
开发者ID:Rookiee,项目名称:Qt_Codes,代码行数:44,代码来源:mainwindow.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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