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


C++ setAt函数代码示例

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


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

示例1: setAt

bool QSymSQLResult::fetch(int i)
{
    //Single return point modified according to review
    bool retVal = true;
    
    if (i < 0 || !isActive()) {
        retVal = false;
    } else {
        if (at() <= -1 || i < at()) {
            d->stmt.Reset();
            setAt(-1);
            d->skipRow = false;
        }
    
        while (at() < i) {
            if (!d->fetchNext(false)) {
                retVal = false;
                break;
            }
        
            setAt(at() + 1);
        }
    }
    
    return retVal;
}
开发者ID:maxxant,项目名称:qt,代码行数:26,代码来源:qsql_symsql.cpp

示例2: while

bool QtSqlCachedResult::fetch(int i)
{
    if ((!isActive()) || (i < 0))
	return FALSE;
    if (at() == i)
	return TRUE;
    if (d->forwardOnly) {
	// speed hack - do not copy values if not needed
	if (at() > i || at() == QSql::AfterLast)
	    return FALSE;
	while(at() < i - 1) {
	    if (!gotoNext(0))
		return FALSE;
	    setAt(at() + 1);
	}
	if (!gotoNext(d->current))
	    return FALSE;
	setAt(at() + 1);
	return TRUE;
    }
    if (d->seek(i)) {
	setAt(i);
	return TRUE;
    }
    setAt(d->rowCacheEnd - 1);
    while (at() < i) {
	if (!cacheNext())
	    return FALSE;
    }
    return TRUE;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:31,代码来源:qsqlcachedresult.cpp

示例3: setAt

void fj::Image::setAt(const int x, const int y, const int R, const int G, const int B, const int A)
{
    if (m_coord == CoordY::kDown)
    {
        setAt(x, getHeight() - y, fj::NormalizedColor(R, G, B, A));
    }
    else
    {
        setAt(x, y, fj::NormalizedColor(R, G, B, A));
    }
}
开发者ID:dearshuto,项目名称:Image,代码行数:11,代码来源:Image.cpp

示例4: setAt

//--------------------------------------------------------------------
// grow the table
void mgMapXYZToPtr::grow()
{
  int newSize = 1+2*m_tableSize;
  mgMapXYZToPtrEntry* newEntries = new mgMapXYZToPtrEntry[newSize];
  for (int i = 0; i < newSize; i++)
  {
    newEntries[i].x = 0;
    newEntries[i].y = 0;
    newEntries[i].z = 0;
    newEntries[i].value = NULL;
  }
    
  mgMapXYZToPtrEntry* oldEntries = m_entries;
  int oldSize = m_tableSize;
  
  m_entries = newEntries;
  m_tableSize = newSize;
  m_tableCount = 0;
  for (int i = 0; i < oldSize; i++)
  {
    mgMapXYZToPtrEntry *entry = &oldEntries[i];
    if (entry->value != NULL)
      setAt(entry->x, entry->y, entry->z, entry->value);
  }
  // done with old table
  delete oldEntries;
}
开发者ID:duaneking,项目名称:SeaOfMemes,代码行数:29,代码来源:mgMapXYZToPtr.cpp

示例5: mysql_stmt_fetch

bool embeddedResult::fetchNext()
{
    if(!d->driver)
        return false;
    if (d->preparedQuery) {
#if MYSQL_VERSION_ID >= 40108
        int nRC = mysql_stmt_fetch(d->stmt);
        if (nRC) {
#ifdef MYSQL_DATA_TRUNCATED
            if (nRC == 1 || nRC == MYSQL_DATA_TRUNCATED)
#else
            if (nRC == 1)
#endif // MYSQL_DATA_TRUNCATED
                setLastError(qMakeStmtError(QCoreApplication::translate("embeddedResult",
                                    "Unable to fetch data"), QSqlError::StatementError, d->stmt));
            return false;
        }
#else
        return false;
#endif
    } else {
        d->row = mysql_fetch_row(d->result);
        if (!d->row)
            return false;
    }
    setAt(at() + 1);
    return true;
}
开发者ID:qlands,项目名称:mysqldualconnection,代码行数:28,代码来源:embdriver.cpp

示例6: while

long MainPlayer::edgeStabilityHeuristic(const GameBoard &gameBoard, Tile tile) const {
    auto gameSize = gameBoard.getGameSize();
    std::vector<Direction> directions{{0,  1},
                                      {0,  -1},
                                      {1,  0},
                                      {-1, 0}};

    std::vector<Cell> corners{{0,            0},
                              {0,            gameSize - 1},
                              {gameSize - 1, 0},
                              {gameSize - 1, gameSize - 1}};
    auto board = gameBoard;
//    board.print(std::cerr);
    long stableCellsCount = 0;
    for (Cell corner : corners) {
        if (board.getAt(corner) != tile) {
            continue;
        }
        ++stableCellsCount;
        for (Direction direction : directions) {
            auto current = corner;
            current.move(direction);
            while (board.isCorrect(current) && board.getAt(current) == tile) {
                ++stableCellsCount;
                board.setAt(current, EMPTY);
//                board.print(std::cerr);
                current.move(direction);
            }
        }
    }
    return stableCellsCount;
}
开发者ID:max-dankow,项目名称:Reversi,代码行数:32,代码来源:MainPlayer.cpp

示例7: setAt

/**
	@brief	説明、引数、戻り値はMonapi2リファレンス参照。
	@date	2005/08/20	junjunn 作成
*/
void IniManager::setAt(cpchar1 cszDir,cpchar1 cszKey,float fValue)
{
	char1 szValue[32];
	StringFn::format(szValue,"%f",fValue);

	setAt(cszDir,cszKey,szValue);
}
开发者ID:mumurik,项目名称:mona,代码行数:11,代码来源:IniManager.cpp

示例8: setAt

bool ZSqliteCipherCachedResult::fetchNext()
{
    if (d->canSeek(at() + 1)) {
        setAt(at() + 1);
        return true;
    }
    return cacheNext();
}
开发者ID:kiraczgao,项目名称:kira,代码行数:8,代码来源:zsqliteciphercachedresult.cpp

示例9: Vector4

void Camera::rotateYaw(double angle) {
	// rotate the camera left/right (around the up vector)
	Matrix4 rot = Matrix4::rotation(Up_Vector, angle);
	Vector4 temp = Vector4(eye[0], eye[1], eye[2], 1) + rot*Vector4(Look_Vector[0], Look_Vector[1], Look_Vector[2], 1);
	Point3 at = Point3(temp[0],temp[1],temp[2]);
	setAt(at);
	setUp(Up);
}
开发者ID:moutaigua8183,项目名称:Computer-Graphics-CSE_452-,代码行数:8,代码来源:Camera.cpp

示例10: setAt

bool QtSqlCachedResult::fetchNext()
{
    if (d->seek(at() + 1)) {
	setAt(at() + 1);
	return TRUE;
    }
    return cacheNext();
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:8,代码来源:qsqlcachedresult.cpp

示例11: mysql_fetch_row

bool QMYSQLResult::fetchNext()
{
    d->row = mysql_fetch_row( d->result );
    if ( !d->row )
	return FALSE;
    setAt( at() + 1 );
    return TRUE;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:8,代码来源:qsql_mysql.cpp

示例12: dbnextrow

bool QTDSResult::gotoNext(QSqlCachedResult::ValueCache &values, int index)
{
    STATUS stat = dbnextrow(d->dbproc);
    if (stat == NO_MORE_ROWS) {
        setAt(QSql::AfterLastRow);
        return false;
    }
    if ((stat == FAIL) || (stat == BUF_FULL)) {
        setLastError(d->lastError);
        return false;
    }

    if (index < 0)
        return true;

    for (int i = 0; i < d->rec.count(); ++i) {
        int idx = index + i;
        switch (d->rec.field(i).type()) {
            case QVariant::DateTime:
                if (qIsNull(d->buffer.at(i * 2 + 1))) {
                    values[idx] = QVariant(QVariant::DateTime);
                } else {
                    DBDATETIME *bdt = (DBDATETIME*) d->buffer.at(i * 2);
                    QDate date = QDate::fromString(QLatin1String("1900-01-01"), Qt::ISODate);
                    QTime time = QTime::fromString(QLatin1String("00:00:00"), Qt::ISODate);
                    values[idx] = QDateTime(date.addDays(bdt->dtdays), time.addMSecs(int(bdt->dttime / 0.3)));
                }
                break;
            case QVariant::Int:
                if (qIsNull(d->buffer.at(i * 2 + 1)))
                    values[idx] = QVariant(QVariant::Int);
                else
                    values[idx] = *((int*)d->buffer.at(i * 2));
                break;
            case QVariant::Double:
            case QVariant::String:
                if (qIsNull(d->buffer.at(i * 2 + 1)))
                    values[idx] = QVariant(QVariant::String);
                else
                    values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i * 2)).trimmed();
                break;
            case QVariant::ByteArray: {
                if (qIsNull(d->buffer.at(i * 2 + 1)))
                    values[idx] = QVariant(QVariant::ByteArray);
                else
                    values[idx] = QByteArray((const char*)d->buffer.at(i * 2));
                break;
            }
            default:
                // should never happen, and we already fired
                // a warning while binding.
                values[idx] = QVariant();
                break;
        }
    }

    return true;
}
开发者ID:Suneal,项目名称:qt,代码行数:58,代码来源:qsql_tds.cpp

示例13: PQclear

void QPSQLResult::cleanup()
{
    if (d->result)
        PQclear(d->result);
    d->result = 0;
    setAt(QSql::BeforeFirstRow);
    d->currentSize = -1;
    setActive(false);
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:9,代码来源:qsql_psql.cpp

示例14: setActive

bool SqliteResult::reset(const QString &q)
{
  if (!driver)
    return false;

  if (!driver->isOpen() || driver->isOpenError())
    return false;

  setActive(false);
  setAt(QSql::BeforeFirst);
  query = q.stripWhiteSpace();
  if (q.find("select", 0, false) == 0)
    setSelect(true);
  else
    setSelect(false);
  query.replace("'true'", "'1'");
  query.replace("'false'", "'0'");
  query.replace("=;", "= NULL;");
  while (query.endsWith(";"))
    query.truncate(query.length() - 1);
  if (query.upper().endsWith("NOWAIT"))
    query.truncate(query.length() - 6);
  if (query.upper().endsWith("FOR UPDATE"))
    query.truncate(query.length() - 10);
  if (!isSelect()) {
    if (query.find("CREATE TABLE", 0, false) == 0) {
      Dataset *ds = ((SqliteDriver *) driver) ->dataBase() ->CreateDataset();

      if (!ds)
        return false;

      if (!ds->exec(query.latin1())) {
        delete ds;
        return false;
      }
      delete ds;
    } else {
      if (dataSet)
        delete dataSet;
      dataSet = ((SqliteDriver *) driver) ->dataBase() ->CreateDataset();
      if (!dataSet->exec(query.latin1()))
        return false;
    }

    return true;
  }

  if (dataSet)
    delete dataSet;
  dataSet = ((SqliteDriver *) driver) ->dataBase() ->CreateDataset();
  if (dataSet->query(query.latin1())) {
    setActive(true);
    return true;
  } else
    return false;
}
开发者ID:gestiweb,项目名称:eneboo,代码行数:56,代码来源:qsqlite.cpp

示例15: mysql_free_result

void QMYSQLResult::cleanup()
{
    if ( d->result ) {
	mysql_free_result( d->result );
    }
    d->result = NULL;
    d->row = NULL;
    setAt( -1 );
    setActive( FALSE );
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:10,代码来源:qsql_mysql.cpp


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