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


C++ Q3ValueList::contains方法代码示例

本文整理汇总了C++中Q3ValueList::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3ValueList::contains方法的具体用法?C++ Q3ValueList::contains怎么用?C++ Q3ValueList::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q3ValueList的用法示例。


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

示例1: checkNeighbourLiberty

void StoneHandler::checkNeighbourLiberty(int x, int y, Q3ValueList<int> &libCounted, int &liberties, Matrix *m)    //SL added eb 8
{
	if (!x || !y)
		return;
	
	Stone *s;
//  CHECK_PTR(m); // SL added eb 8

  if (m==NULL) //added eb 8 -> we don't have a matrix passed here, so we check on the board
  {
	  if (x <= boardHandler->board->getBoardSize() && y <= boardHandler->board->getBoardSize() && x >= 0 && y >= 0 &&
		  !libCounted.contains(100*x + y) &&
  		((s = stones->find(Matrix::coordsToKey(x, y))) == NULL ||
	  	!s->isVisible()))
	  {
		  libCounted.append(100*x + y);
		  liberties ++;
	  }
  }  
  else                                      
  {
    if (x <= boardHandler->board->getBoardSize() && y <= boardHandler->board->getBoardSize() && x >= 0 && y >= 0 &&
	    !libCounted.contains(100*x + y) &&
	    (m->at(x - 1, y - 1) == stoneNone ))         // ?? check stoneErase ?
	  {
		  libCounted.append(100*x + y);
		  liberties ++;
	  }            // end add eb 8
  }
}
开发者ID:alserkli,项目名称:q4Go,代码行数:30,代码来源:stonehandler.cpp

示例2: QCOMPARE

void tst_Q3ValueList::contains()
{
    Q3ValueList<int> a;
    a.append( 1 );
    a.append( 10 );
    a.append( 100 );
    a.append( 1000 );
    a.append( 1000 );

    QCOMPARE( (int)a.contains(1), 1 );
    QCOMPARE( (int)a.contains(10), 1 );
    QCOMPARE( (int)a.contains(99), 0 );
    QCOMPARE( (int)a.contains(1000), 2 );
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:14,代码来源:tst_q3valuelist.cpp

示例3: checkNeighbourLibertyOnMatrix

void StoneHandler::checkNeighbourLibertyOnMatrix(int x, int y, Q3ValueList<int> &libCounted, int &liberties, Matrix *m)
{
	if (!x || !y)
		return;
	
//	Stone *s;
	
	if (x <= boardHandler->board->getBoardSize() && y <= boardHandler->board->getBoardSize() && x >= 0 && y >= 0 &&
	    !libCounted.contains(100*x + y) &&
	    (m->at(x - 1, y - 1) == MARK_TERRITORY_DONE_BLACK ||
	     m->at(x - 1, y - 1) == MARK_TERRITORY_DONE_WHITE))
	{
		libCounted.append(100*x + y);
		liberties ++;
	}
}
开发者ID:alserkli,项目名称:q4Go,代码行数:16,代码来源:stonehandler.cpp


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