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

C++ setAt函数代码示例

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

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



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


示例16: setAt

bool QPSQLResult::fetch(int i)
{
    if (!isActive())
        return false;
    if (i < 0)
        return false;
    if (i >= d->currentSize)
        return false;
    if (at() == i)
        return true;
    setAt(i);
    return true;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:13,代码来源:qsql_psql.cpp


示例17: setFrom

Camera::Camera()
{
	// initialize your data here
	aspect_ratio = 1.0;
	height = 600;
	width = 800;

	setFrom(Point3(3.0, 2.0, 6.0));
	setAt(Point3(0.0, 0.0, 0.0));
	setUp(Vector3(0.0, 1.0, 0.0));
	setZoom(90.0);
	setNearFar(0.1, 30.0);
}
开发者ID:moutaigua8183,项目名称:Computer-Graphics-CSE_452-,代码行数:13,代码来源:Camera.cpp


示例18: main

int main()
{
    List ls;
    ls.count = 0;
    ls.first = NULL;

    int number = 0;
    scanf("%d", &number);
    int i = 0, temp;
    while (i < number) {
        scanf("%d", &temp);
        insertAt(&ls, i, temp);
        i++;
    }
    print(&ls, stdout);
    printf("\n");

    i = 1;
    while (i < 6) {
        insertFront(&ls, i);
        i++;
    }
    print(&ls, stdout);
    printf("\n");

    i = 1;
    int nums = getSize(&ls);
    while (i < nums) {
        deleteAt(&ls, i);
        i++;
        nums--;
    }
    print(&ls, stdout);
    printf("\n");

    i = 0;
    nums = getSize(&ls);
    while (i < getSize(&ls)) {
        if (getAt(&ls, i) < 3) {
            deleteAt(&ls, i);
            i--;
        } else {
            setAt(&ls, i, getAt(&ls, i) * 10);           
        }
        i++;
    }
    print(&ls, stdout);


    return 0;
}
开发者ID:stoitsev,项目名称:University-homeworks,代码行数:51,代码来源:zadacha1.c


示例19: while

bool ZSqliteCipherCachedResult::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::AfterLastRow)
            return false;
        while(at() < i - 1) {
            if (!gotoNext(d->cache, -1))
                return false;
            setAt(at() + 1);
        }
        if (!gotoNext(d->cache, 0))
            return false;
        setAt(at() + 1);
        return true;
    }
    if (d->canSeek(i)) {
        setAt(i);
        return true;
    }
    if (d->rowCacheEnd > 0)
        setAt(d->cacheCount());
    while (at() < i + 1) {
        if (!cacheNext()) {
            if (d->canSeek(i))
                break;
            return false;
        }
    }
    setAt(i);

    return true;
}
开发者ID:kiraczgao,项目名称:kira,代码行数:37,代码来源:zsqliteciphercachedresult.cpp


示例20: FT_Get_Char_Index

//--------------------------------------------------------------
// get a character.  returns NULL if not found
const mgGenCharDefn* mgGenCharCache::getChar(
  void* font,
  DWORD letter)
{
  mgGenCharDefn* defn;
  if (lookup(font, letter, defn))
    return defn;

  // look for the character in the font
  FT_Face face = (FT_Face) font;

  FT_UInt glyphIndex = FT_Get_Char_Index(face, letter);

  int error = FT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER ); 
  if (error != 0)
  {
    mgDebug("FT_Load_Glyph returns %d", error);
    return NULL;
  }

  FT_GlyphSlot slot = face->glyph;
  FT_Bitmap bitmap = slot->bitmap;

  defn = new mgGenCharDefn();

  defn->m_advanceX = (slot->advance.x+31)/64;
  defn->m_advanceY = (slot->advance.y+31)/64;

  defn->m_bitmapX = slot->bitmap_left;
  defn->m_bitmapY = slot->bitmap_top;
  defn->m_bitmapWidth = bitmap.width;
  defn->m_bitmapHeight = bitmap.rows;

  // =-= for now, just allocate memory for bitmap
  defn->m_bitmapData = new BYTE[defn->m_bitmapWidth * defn->m_bitmapHeight];

  // copy data from FreeType bitmap
  for (int i = 0; i < bitmap.rows; i++)
  {
    BYTE* defnLine = defn->m_bitmapData + defn->m_bitmapWidth * i;
    BYTE* bitmapLine = bitmap.buffer + bitmap.pitch * i;
    memcpy(defnLine, bitmapLine, defn->m_bitmapWidth);
  }

  // save in hash table
  setAt(font, letter, defn);

  return defn;
}
开发者ID:duaneking,项目名称:SeaOfMemes,代码行数:51,代码来源:mgGenCharCache.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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