本文整理汇总了C++中QValueList::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueList::contains方法的具体用法?C++ QValueList::contains怎么用?C++ QValueList::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueList
的用法示例。
在下文中一共展示了QValueList::contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkNeighbourLiberty
void StoneHandler::checkNeighbourLiberty(int x, int y, QValueList<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->visible()))
{
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
}
}
示例2: log
void
CollectionScanner::scanFiles( const QStringList& entries )
{
DEBUG_BLOCK
typedef QPair<QString, QString> CoverBundle;
QStringList validImages; validImages << "jpg" << "png" << "gif" << "jpeg";
QStringList validPlaylists; validPlaylists << "m3u" << "pls";
QValueList<CoverBundle> covers;
QStringList images;
foreachType( QStringList, entries ) {
const QString path = *it;
const QString ext = extension( path );
const QString dir = directory( path );
// Write path to logfile
if( !m_logfile.isEmpty() ) {
QFile log( m_logfile );
if( log.open( IO_WriteOnly ) )
log.writeBlock( path.local8Bit(), path.length() );
}
if( validImages.contains( ext ) )
images += path;
else if( m_importPlaylists && validPlaylists.contains( ext ) ) {
AttributeMap attributes;
attributes["path"] = path;
writeElement( "playlist", attributes );
}
else {
MetaBundle::EmbeddedImageList images;
MetaBundle mb( KURL::fromPathOrURL( path ), true, TagLib::AudioProperties::Fast, &images );
const AttributeMap attributes = readTags( mb );
if( !attributes.empty() ) {
writeElement( "tags", attributes );
CoverBundle cover( attributes["artist"], attributes["album"] );
if( !covers.contains( cover ) )
covers += cover;
foreachType( MetaBundle::EmbeddedImageList, images ) {
AttributeMap attributes;
attributes["path"] = path;
attributes["hash"] = (*it).hash();
attributes["description"] = (*it).description();
writeElement( "embed", attributes );
}
}
}
示例3: slotRemoveRow
void TableEditor::slotRemoveRow()
{
if (m_row == -1)
m_row = m_dataTable->numRows() - 1;
int i = 0;
int j = 0;
for (QValueList<QValueList<TableNode> >::Iterator it = m_tableTags->begin(); it != m_tableTags->end(); ++it) {
j = 0;
for (QValueList<TableNode>::Iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2) {
if ((*it2).merged && (*it2).mergedRow == m_row) {
(*it2).merged = false;
setCellText(m_dataTable, i, j, tagContent((*it2).node));
m_dataTable->item(i, j)->setEnabled(true);
(*it2).node->tag->deleteAttribute("colspan");
(*it2).node->tag->deleteAttribute("rowspan");
}
j++;
}
i++;
}
QValueList<TableNode*> updatedMainNodes;
QValueList<QValueList<TableNode> >::Iterator it2 = m_tableTags->at(m_row);
for (QValueList<TableNode>::Iterator it3 = (*it2).begin(); it3 != (*it2).end(); ++it3) {
if ((*it3).merged)
{
TableNode *mainTableNode = &((*m_tableTags)[(*it3).mergedRow][(*it3).mergedCol]);
if (mainTableNode->node && !updatedMainNodes.contains(mainTableNode))
{
int rowspan = mainTableNode->node->tag->attributeValue("rowspan", true).toInt();
rowspan--;
if (rowspan > 1)
mainTableNode->node->tag->editAttribute("rowspan", QString("%1").arg(rowspan));
else
mainTableNode->node->tag->deleteAttribute("rowspan");
updatedMainNodes.append(mainTableNode);
}
}
Node::deleteNode((*it3).node);
(*it3).node = 0L;
newNum--;
}
m_tableTags->erase(it2);
m_dataTable->removeRow(m_row);
QValueList<TableNode>::Iterator it = m_tableRows->at(m_row);
Node::deleteNode((*it).node);
newNum--;
m_tableRows->erase(it);
m_rowSpin->setValue(m_dataTable->numRows());
}
示例4: checkNeighbourLibertyOnMatrix
void StoneHandler::checkNeighbourLibertyOnMatrix(int x, int y, QValueList<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 ++;
}
}
示例5: QString
bool Ts2Rtp::addChannels( QPtrList<ChannelDesc> *channels )
{
int i, j, k, pmtpid=8191;
ChannelDesc *desc, *d;
QValueList<int> pids;
if ( !rtpSocket && !makeSocket() )
return false;
sendList = "";
for ( i=0; i<(int)channels->count(); i++ ) {
desc = channels->at( i );
sendList = sendList+desc->name+"|"+QString().setNum(desc->vpid)+"|"+QString().setNum(desc->apid[0].pid)+"|";
if ( desc->apid[0].ac3 ) sendList+= "y|";
else sendList+= "n|";
sendList+= QString().setNum(desc->subpid[0].pid);
sendList+= "|";
sendList+= QString().setNum(desc->subpid[0].page);
sendList+= "|";
sendList+= QString().setNum(desc->subpid[0].id);
sendList+= "|";
sendList+= QString().setNum(desc->subpid[0].type);
sendList+= "|";
sendList+= desc->subpid[0].lang+"|";
for ( j=i; j<(int)channels->count(); j++ ) {
pids.clear();
d = channels->at( j );
if ( d->vpid )
pids.append( d->vpid );
for ( k=0; k<d->napid && k<MAX_AUDIO; k++ )
pids.append( d->apid[k].pid );
for ( k=0; k<d->nsubpid && k<MAX_DVBSUB; k++ )
pids.append( d->subpid[k].pid );
while ( pmtpid==17 || pids.contains( pmtpid ) )
--pmtpid;
}
desc->pmtpid = pmtpid--;
}
sendList+="\n";
psiTables( channels );
writePsi = true;
psiTimer.start( 500 );
return true;
}
示例6: canPlace
//.........这里部分代码省略.........
}
}
}
// Moves mobiles inside the multi out to the ban location
MapCharsIterator chars = MapObjects::instance()->listCharsAtCoord( point );
for ( P_CHAR pChar = chars.first(); pChar; pChar = chars.next() )
{
// Move them ALWAYS out, they could be trapped by the castle
// otherwise (or other strange multi forms)
moveOut.append( pChar );
}
// To keep roads house free, here's a specialized check for roads
if ( ( landId >= 0x71 && landId <= 0x8c ) || ( landId >= 0x14c && landId <= 0x14f ) || ( landId >= 0x161 && landId <= 0x174 ) || ( landId >= 0x1f0 && landId <= 0x1f3 ) || ( landId >= 0x26e && landId <= 0x279 ) || ( landId >= 0x27e && landId <= 0x281 ) || ( landId >= 0x324 && landId <= 0x3ac ) || ( landId >= 0x597 && landId <= 0x5a6 ) || ( landId >= 0x637 && landId <= 0x63a ) || ( landId >= 0x67d && landId <= 0x6a0 ) || ( landId >= 0x7ae && landId <= 0x7b1 ) || ( landId >= 0x442 && landId <= 0x479 ) || ( landId >= 0x501 && landId <= 0x510 ) || ( landId >= 0x009 && landId <= 0x015 ) || ( landId >= 0x150 && landId <= 0x15c ) )
{
return false; // Road Blocked
}
// For houses (they have a base you know...)
// we collect another list of points around the house that need to be checked
if ( hasBase )
{
int xOffset, yOffset;
// We have to do two loops since the yard size does play a role here
// but not for the border
for ( xOffset = -1; xOffset <= 1; ++xOffset )
{
for ( yOffset = -yard; yOffset <= yard; ++yOffset )
{
Coord pos = point + Coord( xOffset, yOffset );
if ( !yardList.contains( pos ) )
{
yardList.push_back( pos ); // Put this point into the yard checklist if it's not there
}
}
}
for ( xOffset = -1; xOffset <= 1; ++xOffset )
{
for ( yOffset = -1; yOffset <= 1; ++yOffset )
{
Coord pos = point + Coord( xOffset, yOffset );
// Only do the following if the current tiles position differs from the
// check position.
if ( xOffset != 0 || yOffset != 0 )
{
// The border list should not contain tiles that are actually below the multis
// floor and hence not visible and covered by a walkable multi tile.
// So what we do here is check if within 8 z units of the multis floor there is a
// walkable tile above the border tile
int multiX = x + xOffset; // Offset to the upper left corner of the multi
int multiY = y + yOffset; // Offset to the upper left corner of the multi
bool found = false; // Assume there is no such tile
// Only do this check if the to-be-checked tile is really within the multi
// boundaries
if ( multiX >= 0 && multiY >= 0 && multiX < width && multiY < height )
{
// Get the multi tiles at the to-check position
const QValueVector<multiItem_st> &tiles = multi->itemsAt( multiX + left, multiY + right );
QValueVector<multiItem_st>::const_iterator it;
for ( it = tiles.begin(); it != tiles.end(); ++it )