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


C++ Q3ValueVector::size方法代码示例

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


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

示例1: QVERIFY

void tst_Q3ValueVector::resize()
{
    Q3ValueVector<int> a;
    a.resize( 2 );

    QVERIFY( a.size() == 2 );

    Q3ValueVector<int> b;
    b.resize( 2, 42 );

    QVERIFY( b.size() == 2 );
    QCOMPARE( b[0], 42 );
    QCOMPARE( b[1], 42 );

    b.resize( 1 );
    QVERIFY( b.size() == 1 );

    b.resize( 4, 21 );
    QCOMPARE( b[0], 42 );
    QCOMPARE( b[1], 21 );
    QCOMPARE( b[2], 21 );
    QCOMPARE( b[3], 21 );

    b.resize( 0 );
    QVERIFY( b.empty() );

}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:27,代码来源:tst_q3valuevector.cpp

示例2: QCOMPARE

void tst_Q3ValueVector::size()
{
    Q3ValueVector<int> a;
    a.push_back( 1 );
    a.push_back( 2 );
    QCOMPARE( (int)a.size(), 2 );
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:7,代码来源:tst_q3valuevector.cpp

示例3: ds

void tst_Q3ValueVector::capacity()
{
    QFETCH( QByteArray, ba );
    Q3ValueVector<int> vector;

    QDataStream ds( &ba, IO_ReadWrite );
    ds >> vector;

    QVERIFY( vector.capacity() >= vector.size() );
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:10,代码来源:tst_q3valuevector.cpp

示例4: _ef_dump

void _ef_dump( const Q3ValueVector<T>& val )
{
    uint idx;
    uint cnt = val.size();

    cout << "[" << cnt << "]";
    for(idx = 0; idx < cnt; idx++)
    {
        cout << " " << val[idx];
    }
}
开发者ID:mishani99,项目名称:prsstudio,代码行数:11,代码来源:eclipsefile.cpp

示例5: renderCode128

void renderCode128(OROPage * page, const QRectF & r, const QString & _str, int align)
{
  Q3ValueVector<int> str;
  int i = 0;

  // create the list.. if the list is empty then just set a start code and move on
  if(_str.isEmpty())
    str.push_back(104);
  else
  {
    int rank_a = 0;
    int rank_b = 0;
    int rank_c = 0;

    QChar c;
    for(i = 0; i < _str.length(); i++)
    {
      c = _str.at(i);
      rank_a += (code128Index(c, SETA) != -1 ? 1 : 0);
      rank_b += (code128Index(c, SETB) != -1 ? 1 : 0);
      rank_c += (c >= '0' && c <= '9' ? 1 : 0);
    }
    if(rank_c == _str.length() && ((rank_c % 2) == 0 || rank_c > 4))
    {
      // every value in the is a digit so we are going to go with mode C
      // and we have an even number or we have more than 4 values
      i = 0;
      if((rank_c % 2) == 1)
      {
        str.push_back(104); // START B
        c = _str.at(0);
        str.push_back(code128Index(c, SETB));
        str.push_back(99); // MODE C
        i = 1;
      }
      else
        str.push_back(105); // START C

      for(i = i; i < _str.length(); i+=2)
      {
        char a, b;
        c = _str.at(i);
        a = c.toAscii();
        a -= 48;
        c = _str.at(i+1);
        b = c.toAscii();
        b -= 48;
        str.push_back(int((a * 10) + b));
      }
    }
    else
    {
      // start in the mode that had the higher number of hits and then
      // just shift into the opposite mode as needed
      int set = ( rank_a > rank_b ? SETA : SETB );
      str.push_back(( rank_a > rank_b ? 103 : 104 ));
      int v = -1;
      for(i = 0; i < _str.length(); i++)
      {
        c = _str.at(i);
        v = code128Index(c, set);
        if(v == -1)
        {
          v = code128Index(c, (set == SETA ? SETB : SETA));
          if(v != -1)
          {
            str.push_back(98); // SHIFT
            str.push_back(v);
          }
        }
        else
          str.push_back(v);
      }
    }
  }

  // calculate and append the checksum value to the list
  int checksum = str.at(0);
  for(i = 1; i < str.size(); i++)
    checksum += (str.at(i) * i);
  checksum = checksum % 103;
  str.push_back(checksum);

  // lets determine some core attributes about this barcode
  qreal bar_width = 0.01; // the width of the base unit bar 1/100 inch

  // this is are mandatory minimum quiet zone
  qreal quiet_zone = bar_width * 10;
  if(quiet_zone < 0.1)
    quiet_zone = 0.1;

  // what kind of area do we have to work with
  qreal draw_width = r.width();
  qreal draw_height = r.height();

  // how long is the value we need to encode?
  int val_length = str.size() - 2; // we include start and checksum in are list so
                                   // subtract them out for our calculations

  // L = (11C + 35)X 
//.........这里部分代码省略.........
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:101,代码来源:code128.cpp

示例6: formatMessage

QString EQStr::formatMessage(uint32_t formatid,
                             const char* arguments, size_t argsLen) const
{
    QString* formatStringRes = m_messageStrings.find(formatid);

    QString tempStr;

    if (formatStringRes == NULL)
    {
        tempStr.sprintf( "Unknown: %04x: ",
                         formatid);
        tempStr += QString::fromUtf8(arguments);

        size_t totalArgsLen = strlen(arguments) + 1;

        const char* curMsg;
        while (totalArgsLen < argsLen)
        {
            curMsg = arguments + totalArgsLen;
            tempStr += QString(", ") + QString::fromUtf8(curMsg);
            totalArgsLen += strlen(curMsg) + 1;
        }
    }
    else
    {
        Q3ValueVector<QString> argList;
        argList.reserve(5); // reserve space for 5 elements to handle most common sizes

        //
        size_t totalArgsLen = 0;
        const char* curArg;
        while (totalArgsLen < argsLen)
        {
            curArg = arguments + totalArgsLen;
            // insert argument into the argument list
            argList.push_back(QString::fromUtf8(curArg));
            totalArgsLen += strlen(curArg) + 1;
        }

        bool ok;
        int curPos;
        size_t substArg;
        int substArgValue;
        QString* substFormatStringRes;
        QString substFormatString;

        ////////////////////////////
        // replace template (%T) arguments in formatted string
        QString formatString = *formatStringRes;
        QRegExp rxt("%T(\\d{1,3})", true, false);

        // find first template substitution
        curPos = rxt.search(formatString, 0);

        while (curPos != -1)
        {
            substFormatStringRes = NULL;
            substArg = rxt.cap(1).toInt(&ok);
            if (ok && (substArg <= argList.size()))
            {
                substArgValue = argList[substArg-1].toInt(&ok);

                if (ok)
                    substFormatStringRes = m_messageStrings.find(substArgValue);
            }

            // replace template argument with subst string
            if (substFormatStringRes != NULL)
                formatString.replace(curPos, rxt.matchedLength(), *substFormatStringRes);
            else
                curPos += rxt.matchedLength(); // if no replacement string, skip over

            // find next substitution
            curPos = rxt.search(formatString, curPos);
        }

        ////////////////////////////
        // now replace substitution arguments in formatted string
        // NOTE: not using QString::arg() because not all arguments are always used
        //       and it will do screwy stuff in this situation
        QRegExp rx("%(\\d{1,3})", true, false);

        // find first template substitution
        curPos = rx.search(formatString, 0);

        while (curPos != -1)
        {
            substArg = rx.cap(1).toInt(&ok);

            // replace substitution argument with argument from list
            if (ok && (substArg <= argList.size()))
                formatString.replace(curPos, rx.matchedLength(), argList[substArg-1]);
            else
                curPos += rx.matchedLength(); // if no such argument, skip over

            // find next substitution
            curPos = rx.search(formatString, curPos);
        }

        return formatString;
//.........这里部分代码省略.........
开发者ID:xbackupx,项目名称:showeqx,代码行数:101,代码来源:eqstr.cpp


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