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


C++ selection函数代码示例

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


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


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