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


C++ QLinkedList::insert方法代码示例

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


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

示例1: sortZList

void QgsComposition::sortZList()
{
  if ( mItemZList.size() < 2 )
  {
    return;
  }

  QLinkedList<QgsComposerItem*>::const_iterator lIt = mItemZList.constBegin();
  QLinkedList<QgsComposerItem*> sortedList;

  for ( ; lIt != mItemZList.constEnd(); ++lIt )
  {
    QLinkedList<QgsComposerItem*>::iterator insertIt = sortedList.begin();
    for ( ; insertIt != sortedList.end(); ++insertIt )
    {
      if (( *lIt )->zValue() < ( *insertIt )->zValue() )
      {
        break;
      }
    }
    sortedList.insert( insertIt, ( *lIt ) );
  }

  mItemZList = sortedList;
}
开发者ID:namhh,项目名称:Quantum-GIS,代码行数:25,代码来源:qgscomposition.cpp

示例2: modifyOrder

void modifyOrder(QLinkedList<BidOrAsk> &queue, BidOrAsk &bidOrAsk) {
    auto r = std::find(queue.begin(), queue.end(), bidOrAsk);
    if (r != queue.end()) {
        BidOrAsk original = *r;
        Q_ASSERT (original.id() == bidOrAsk.id());

        if (original.price() != bidOrAsk.price() ||
                original.volume() > bidOrAsk.volume()) {

            // remove and re-add to loose position
            queue.erase(r);

            original.setPrice(bidOrAsk.price());
            original.setVolume(bidOrAsk.volume());

            // since this simulation happens long past,
            // we can't use the current time.
            original.setTime(bidOrAsk.time());
            original.setDate(bidOrAsk.date());

            queue.insert(std::lower_bound(queue.begin(),
                                          queue.end(),
                                          bidOrAsk),
                          bidOrAsk);
        } else {
            // if only the volume has decreased, it
            // doesn't loose its position.
            original.setVolume(bidOrAsk.volume());
        }
    }
}
开发者ID:shocklateboy92,项目名称:se3011,代码行数:31,代码来源:trading-engine.cpp

示例3: main

int main ()
{
  QLinkedList<int> myints;
  cout << "0. size: " << (int) myints.size() << endl;
  assert(myints.size() == 0);
  for (int i=0; i<10; i++) myints.push_back(i);
  cout << "1. size: " << (int) myints.size() << endl;
  assert(myints.size() == 10);
  myints.insert (myints.begin(),10);
  cout << "2. size: " << (int) myints.size() << endl;
  assert(myints.size() == 11);
  myints.pop_back();
  cout << "3. size: " << (int) myints.size() << endl;
  assert(myints.size() == 10);
  return 0;
}
开发者ID:xsery,项目名称:benchmarks-esbmc-qt,代码行数:16,代码来源:main.cpp

示例4: doNotVerifyBootBlock

void DeviceVerifyPlanner::doNotVerifyBootBlock(QLinkedList<Device::MemoryRange>& verifyList)
{
    Device::MemoryRange firstHalf;
    QLinkedList<Device::MemoryRange>::iterator it = verifyList.begin();
    while(it != verifyList.end())
    {
        //     S   E
        // S   |   E
        //     S   |  E
        // S   |   |  E
        //
        //     |   S  E
        // S   E   |
        if(!((it->start <= device->startBootloader && it->end <= device->startBootloader) ||
             (it->start >= device->endBootloader && it->end >= device->endBootloader)))
        {
            // This transaction would verify over bootloader memory, which may fail if
            // we haven't (or can't) read the device out.
            if(it->start == device->startBootloader && it->end == device->endBootloader)
            {
                it = verifyList.erase(it);
                continue;
            }
            if(it->start == device->startBootloader)
            {
                it->start = device->endBootloader;
            }
            else if(it->end == device->endBootloader)
            {
                it->end = device->startBootloader;
            }
            else
            {
                firstHalf.start = device->endBootloader;
                firstHalf.end = it->end;
                it->end = device->startBootloader;
                if(firstHalf.start < firstHalf.end)
                {
                    verifyList.insert(it, firstHalf);
                }
            }
        }
        it++;
    }
}
开发者ID:lamotriz,项目名称:motor-esferico,代码行数:45,代码来源:DeviceVerifyPlanner.cpp

示例5: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QLinkedList<QString> linkList;
    linkList.append("Bangaluru");
    linkList.append("Mumbai");
    linkList.append("Delhi");
    linkList.append("Gandhinagara");

    qDebug() << "1-Number of Items =" << linkList.count();

    QLinkedList<QString>::iterator j = qFind(linkList.begin(),linkList.end(),"Varanasi");
    linkList.insert(j,"Bhopal");

    QLinkedList<QString>::iterator i;
    for (i = linkList.begin(); i != linkList.end(); ++i)
         qDebug() << *i << endl;

    qDebug() << "2-Number of Items =" << linkList.count();

    return a.exec();
}
开发者ID:rpolepal,项目名称:practice,代码行数:23,代码来源:main.cpp


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