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


C++ QMap::end方法代码示例

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


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

示例1: loadFrom

bool KisXMPIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
{
    ioDevice->open(QIODevice::ReadOnly);
    dbgFile << "Load XMP Data";
    std::string xmpPacket_;
    QByteArray arr = ioDevice->readAll();
    xmpPacket_.assign(arr.data(), arr.length());
    dbgFile << xmpPacket_.length();
//     dbgFile << xmpPacket_.c_str();
    Exiv2::XmpData xmpData_;
    Exiv2::XmpParser::decode(xmpData_, xmpPacket_);
    QMap< const KisMetaData::Schema*, QMap<QString, QMap<QString, KisMetaData::Value> > > structures;
    QMap< const KisMetaData::Schema*, QMap<QString, QVector< QMap<QString, KisMetaData::Value> > > > arraysOfStructures;
    for (Exiv2::XmpData::iterator it = xmpData_.begin(); it != xmpData_.end(); ++it) {
        dbgFile << it->key().c_str();
        Exiv2::XmpKey key(it->key());
        dbgFile << key.groupName().c_str() << " " << key.tagName().c_str() << " " << key.ns().c_str();
        if ((key.groupName() == "exif" || key.groupName() == "tiff") && key.tagName() == "NativeDigest") {  // TODO: someone who has time to lose can look in adding support for NativeDigest, it's undocumented use by the XMP SDK to check if exif data has been changed while XMP hasn't been updated
            dbgFile << "dropped";
        } else {
            const KisMetaData::Schema* schema = KisMetaData::SchemaRegistry::instance()->schemaFromPrefix(key.groupName().c_str());
            if (!schema) {
                schema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(key.ns().c_str());
                if (!schema) {
                    schema = KisMetaData::SchemaRegistry::instance()->create(key.ns().c_str(), key.groupName().c_str());
                    Q_ASSERT(schema);
                }
            }
            const Exiv2::Value::AutoPtr value = it->getValue();
            // Decrypt key
            QString structName = "";
            QString tagName = key.tagName().c_str();
            int arrayIndex = -1;
            const KisMetaData::TypeInfo* typeInfo = 0;
            bool isStructureEntry = false;
            bool isStructureInArrayEntry = false;
            if (tagName.contains("/")) {
                QRegExp regexp("([A-Za-z]\\w+)/([A-Za-z]\\w+):([A-Za-z]\\w+)");
                if (regexp.indexIn(tagName) != -1) {
                    structName = regexp.capturedTexts()[1];
                    tagName =  regexp.capturedTexts()[3];
                    typeInfo = schema->propertyType(structName);
                    Q_ASSERT(typeInfo == schema->propertyType(structName));
                    if (typeInfo && typeInfo->propertyType() == KisMetaData::TypeInfo::StructureType) {
                        typeInfo = typeInfo->structureSchema()->propertyType(tagName);
                    }
                    isStructureEntry = true;
                } else {
                    QRegExp regexp2("([A-Za-z]\\w+)\\[(\\d+)\\]/([A-Za-z]\\w+):([A-Za-z]\\w+)");
                    if (regexp2.indexIn(tagName) != -1) {
                        dbgFile << ppVar(tagName);
                        structName = regexp2.capturedTexts()[1];
                        arrayIndex = regexp2.capturedTexts()[2].toInt() - 1;
                        tagName = regexp2.capturedTexts()[4];
                        dbgFile << ppVar(structName) << ppVar(regexp2.capturedTexts()[3]);
                        //Q_ASSERT(schema->propertyType(structName));
                        if (schema->propertyType(structName)) {
                            typeInfo = schema->propertyType(structName)->embeddedPropertyType();
                            Q_ASSERT(typeInfo);
                            if (typeInfo && typeInfo->propertyType() == KisMetaData::TypeInfo::StructureType) {
                                typeInfo = typeInfo->structureSchema()->propertyType(tagName);
                            }
                        }
                        isStructureInArrayEntry = true;
                    } else {
                        dbgFile << "Decoding structure name/entry failed: " << tagName;
                    }
                }
            } else {
                typeInfo = schema->propertyType(tagName);
            }
            KisMetaData::Value v;

            bool ignoreValue = false;
            // Compute the value
            if (value->typeId() == Exiv2::xmpBag
                    || value->typeId() == Exiv2::xmpSeq
                    || value->typeId() == Exiv2::xmpAlt) {
                const KisMetaData::TypeInfo* embeddedTypeInfo = 0;
                if (typeInfo) {
                    embeddedTypeInfo = typeInfo->embeddedPropertyType();
                }
                const KisMetaData::Parser* parser = 0;
                if (embeddedTypeInfo) {
                    parser = embeddedTypeInfo->parser();
                }
                const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get());
                Q_ASSERT(xav);
                QList<KisMetaData::Value> array;
                for (std::vector< std::string >::const_iterator it = xav->value_.begin();
                        it != xav->value_.end(); ++it) {
                    QString value = it->c_str();
                    if (parser) {
                        array.push_back(parser->parse(value));
                    } else {
                        dbgImage << "No parser " << tagName;
                        array.push_back(KisMetaData::Value(value));
                    }
                }
                KisMetaData::Value::ValueType vt = KisMetaData::Value::Invalid;
//.........这里部分代码省略.........
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:101,代码来源:kis_xmp_io.cpp

示例2: loadAccounts

void KInstitutionsView::loadAccounts(void)
{
  QMap<QString, bool> isOpen;

  ::timetrace("start load institutions view");
  // remember the id of the current selected item
  KMyMoneyAccountTreeBaseItem *item = m_accountTree->selectedItem();
  QString selectedItemId = (item) ? item->id() : QString();

  // keep a map of all 'expanded' accounts
  QListViewItemIterator it_lvi(m_accountTree);
  while(it_lvi.current()) {
    item = dynamic_cast<KMyMoneyAccountTreeItem*>(it_lvi.current());
    if(item && item->isOpen()) {
      isOpen[item->id()] = true;
    }
    ++it_lvi;
  }

  // remember the upper left corner of the viewport
  QPoint startPoint = m_accountTree->viewportToContents(QPoint(0, 0));

  // turn off updates to avoid flickering during reload
  m_accountTree->setUpdatesEnabled(false);

  // clear the current contents and recreate it
  m_accountTree->clear();
  m_accountMap.clear();
  m_securityMap.clear();
  m_transactionCountMap.clear();

  MyMoneyFile* file = MyMoneyFile::instance();

  QValueList<MyMoneyAccount> alist;
  file->accountList(alist);
  QValueList<MyMoneyAccount>::const_iterator it_a;
  for(it_a = alist.begin(); it_a != alist.end(); ++it_a) {
    m_accountMap[(*it_a).id()] = *it_a;
  }

  // we need to make sure we show stock accounts
  // under the right institution (the one of the parent account)
  QMap<QString, MyMoneyAccount>::iterator it_am;
  for(it_am = m_accountMap.begin(); it_am != m_accountMap.end(); ++it_am) {
    if((*it_am).isInvest()) {
      (*it_am).setInstitutionId(m_accountMap[(*it_am).parentAccountId()].institutionId());
    }
  }

  QValueList<MyMoneySecurity> slist = file->currencyList();
  slist += file->securityList();
  QValueList<MyMoneySecurity>::const_iterator it_s;
  for(it_s = slist.begin(); it_s != slist.end(); ++it_s) {
    m_securityMap[(*it_s).id()] = *it_s;
  }

  m_transactionCountMap = file->transactionCountMap();

  m_accountTree->setBaseCurrency(file->baseCurrency());

  // create the items
  try {
    const MyMoneySecurity& security = file->baseCurrency();
    m_accountTree->setBaseCurrency(security);

    MyMoneyInstitution none;
    none.setName(i18n("Accounts with no institution assigned"));
    KMyMoneyAccountTreeItem* noInstitutionItem = new KMyMoneyAccountTreeItem(m_accountTree, none);
    noInstitutionItem->setPixmap(0,none.pixmap());
    loadSubAccounts(noInstitutionItem, QString());

    // hide it, if unused
    noInstitutionItem->setVisible(noInstitutionItem->childCount() != 0);
    
    bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked()
      || !KMyMoneyGlobalSettings::hideClosedAccounts();

    QValueList<MyMoneyInstitution> list = file->institutionList();
    QValueList<MyMoneyInstitution>::const_iterator it_i;
    for(it_i = list.begin(); it_i != list.end(); ++it_i) {
      KMyMoneyAccountTreeItem* item = new KMyMoneyAccountTreeItem(m_accountTree, *it_i);
      item->setPixmap(0, none.pixmap());
      loadSubAccounts(item, (*it_i).id());
      if(!showClosedAccounts)
        item->setVisible(item->childCount() != 0);
    }

  } catch(MyMoneyException *e) {
    kdDebug(2) << "Problem in institutions view: " << e->what();
    delete e;
  }

  // scan through the list of accounts and re-expand those that were
  // expanded and re-select the one that was probably selected before
  it_lvi = QListViewItemIterator(m_accountTree);
  while(it_lvi.current()) {
    item = dynamic_cast<KMyMoneyAccountTreeItem*>(it_lvi.current());
    if(item) {
      if(item->id() == selectedItemId)
        m_accountTree->setSelected(item, true);
//.........这里部分代码省略.........
开发者ID:sajidji94,项目名称:kmymoney2,代码行数:101,代码来源:kinstitutionsview.cpp

示例3: execute


//.........这里部分代码省略.........
                }
                if ((column == 0 || column == DimType((m->getGeometryAs<ImageGeom>()->getXPoints() - 1)) || row == 0 || row == DimType((m->getGeometryAs<ImageGeom>()->getYPoints() - 1))) && m->getGeometryAs<ImageGeom>()->getZPoints() == 1)
                {
                    m_SurfaceFeatures[feature] = true;
                }
            }
            for (int32_t k = 0; k < 6; k++)
            {
                good = true;
                neighbor = static_cast<DimType>( j + neighpoints[k] );
                if (k == 0 && plane == 0) {
                    good = false;
                }
                if (k == 5 && plane == (m->getGeometryAs<ImageGeom>()->getZPoints() - 1)) {
                    good = false;
                }
                if (k == 1 && row == 0) {
                    good = false;
                }
                if (k == 4 && row == (m->getGeometryAs<ImageGeom>()->getYPoints() - 1)) {
                    good = false;
                }
                if (k == 2 && column == 0) {
                    good = false;
                }
                if (k == 3 && column == (m->getGeometryAs<ImageGeom>()->getXPoints() - 1)) {
                    good = false;
                }
                if (good == true && m_FeatureIds[neighbor] != feature && m_FeatureIds[neighbor] > 0)
                {
                    onsurf++;
                    nnum = m_NumNeighbors[feature];
                    neighborlist[feature].push_back(m_FeatureIds[neighbor]);
                    nnum++;
                    m_NumNeighbors[feature] = nnum;
                }
            }
        }
        if (m_StoreBoundaryCells == true) {
            m_BoundaryCells[j] = onsurf;
        }
    }

    // We do this to create new set of NeighborList objects
    for (size_t i = 1; i < totalFeatures; i++)
    {
        currentMillis = QDateTime::currentMSecsSinceEpoch();
        if (currentMillis - millis > 1000)
        {
            QString ss = QObject::tr("Finding Neighbors || Calculating Surface Areas || %1% Complete").arg(((float)i / totalFeatures) * 100);
            notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss);
            millis = QDateTime::currentMSecsSinceEpoch();
        }

        if(getCancel() == true) {
            return;
        }


        QMap<int32_t, int32_t> neighToCount;
        int32_t numneighs = static_cast<int32_t>( neighborlist[i].size() );

        // this increments the voxel counts for each feature
        for (int32_t j = 0; j < numneighs; j++)
        {
            neighToCount[neighborlist[i][j]]++;
        }

        QMap<int32_t, int32_t>::Iterator neighiter = neighToCount.find(0);
        neighToCount.erase(neighiter);
        neighiter = neighToCount.find(-1);
        neighToCount.erase(neighiter);
        // Resize the features neighbor list to zero
        neighborlist[i].resize(0);
        neighborsurfacearealist[i].resize(0);

        for (QMap<int32_t, int32_t>::iterator iter = neighToCount.begin(); iter != neighToCount.end(); ++iter)
        {
            int32_t neigh = iter.key(); // get the neighbor feature
            int32_t number = iter.value(); // get the number of voxels
            float area = float(number) * m->getGeometryAs<ImageGeom>()->getXRes() * m->getGeometryAs<ImageGeom>()->getYRes();

            // Push the neighbor feature id back onto the list so we stay synced up
            neighborlist[i].push_back(neigh);
            neighborsurfacearealist[i].push_back(area);
        }
        m_NumNeighbors[i] = int32_t(neighborlist[i].size());

        // Set the vector for each list into the NeighborList Object
        NeighborList<int32_t>::SharedVectorType sharedNeiLst(new std::vector<int32_t>);
        sharedNeiLst->assign(neighborlist[i].begin(), neighborlist[i].end());
        m_NeighborList.lock()->setList(static_cast<int32_t>(i), sharedNeiLst);

        NeighborList<float>::SharedVectorType sharedSAL(new std::vector<float>);
        sharedSAL->assign(neighborsurfacearealist[i].begin(), neighborsurfacearealist[i].end());
        m_SharedSurfaceAreaList.lock()->setList(static_cast<int32_t>(i), sharedSAL);
    }

    notifyStatusMessage(getHumanLabel(), "Complete");
}
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:101,代码来源:FindNeighbors.cpp

示例4: workget

void workget() {
    int x = 0;
    QApplication a(x,0);

    QString base ="http://www.zhanqi.tv/api/static/game.lives/66/30-";
    QString end = ".json";

    QMap < QString , QJsonObject >  mapintjo;
    QJsonDocument jd;
    bool ok = loadJsonFile("lolmasterdata.json",jd);
    QJsonArray ja;
    ja = jd.array();

    QFile file("outdata.txt");

    if (!file.open(QIODevice::WriteOnly | QIODevice::Text))             return ;

    QTextStream out(&file);


    for (int i=0; i<ja.size(); i++) {
        QJsonObject jo;
        jo = ja[i].toObject();
        mapintjo[jo["uid"].toString()] = jo;
        out<<jo["gameusername"].toString()<< "   " <<jo["nickname"].toString()<< "   "<<jo["url"].toString()<<endl;
    }
    file.close();

    while(true) {
        for (int x = 1; x< 145; x++) {
            QString s = QString::number(x);
            QString u = base+s+end;
            qDebug()<<u;
            HttpFileDownloader hfd;
            bool ok = hfd.sycGetPageFromURL(QUrl(u));
            qDebug()<<ok;
            if (!ok) continue;
            QString re = hfd.getPage();
            QJsonDocument jd = QJsonDocument::fromJson(re.toUtf8());
            qDebug()<<jd.object()["data"].toObject()["rooms"].toArray().size();
            QJsonArray ja = jd.object()["data"].toObject()["rooms"].toArray();

            for (int i=0; i< ja.size(); i++) {
                QJsonObject jo = ja[i].toObject() ;
                QString nickname = jo["nickname"].toString();
                QString url = jo["url"].toString();
                QString id,uid;
                id = jo["id"].toString();
                uid = jo["uid"].toString();
                //qDebug()<<uid;
                if (mapintjo.contains(uid)  &&  mapintjo[uid]["gameusername"].toString()!="") continue;
                QString bb = "http://www.zhanqi.tv";
                HttpFileDownloader hfd;
                bool ok = hfd.sycGetPageFromURL(QUrl(bb+url));
                //qDebug()<<ok;
                if (!ok) continue;
                QString re = hfd.getPage();

                int x = re.indexOf("getLols5Nickname");
                int a = re.indexOf(myTr("战旗TV丶"),x);
                int b = re.indexOf("</span>",x);
                if (x<0 ) continue;
                if (b<0) {
                    qDebug()<<nickname;
                    continue;
                }
                QString gameusername;
                if (a<0) {
                    gameusername = re.mid(x+22, b-x-22);

                }
                else {
                     gameusername = re.mid(a,b-a);
                }
                qDebug()<<gameusername;

                QJsonObject so;
                so["nickname"] = nickname;
                so["url"] = url;
                so["id"] = id;
                so["uid"] = uid;
                so["gameusername"] = gameusername;
                mapintjo[uid] = so;
            }



            {
                QJsonArray ja;
                for (auto a = mapintjo.begin(); a!= mapintjo.end(); a++) {
                    ja.push_back(a.value());
                }
                bool ok = saveJsonFile("lolmasterdata.json", QJsonDocument(ja));
                qDebug()<<"save file !! " <<ok;
            }
        }

    }
    a.exec();
}
开发者ID:xh286286,项目名称:hasee_project_swarm,代码行数:100,代码来源:main.cpp

示例5: readXML

void QgsAtlasComposition::readXML( const QDomElement& atlasElem, const QDomDocument& )
{
  mEnabled = atlasElem.attribute( "enabled", "false" ) == "true" ? true : false;
  emit toggled( mEnabled );
  if ( !mEnabled )
  {
    emit parameterChanged();
    return;
  }

  // look for stored layer name
  mCoverageLayer = 0;
  QMap<QString, QgsMapLayer*> layers = QgsMapLayerRegistry::instance()->mapLayers();
  for ( QMap<QString, QgsMapLayer*>::const_iterator it = layers.begin(); it != layers.end(); ++it )
  {
    if ( it.key() == atlasElem.attribute( "coverageLayer" ) )
    {
      mCoverageLayer = dynamic_cast<QgsVectorLayer*>( it.value() );
      break;
    }
  }
  //look for stored composer map, to upgrade pre 2.1 projects
  int composerMapNo = atlasElem.attribute( "composerMap", "-1" ).toInt();
  QgsComposerMap * composerMap = 0;
  if ( composerMapNo != -1 )
  {
    QList<QgsComposerMap*> maps;
    mComposition->composerItems( maps );
    for ( QList<QgsComposerMap*>::iterator it = maps.begin(); it != maps.end(); ++it )
    {
      if (( *it )->id() == composerMapNo )
      {
        composerMap = ( *it );
        composerMap->setAtlasDriven( true );
        break;
      }
    }
  }
  mHideCoverage = atlasElem.attribute( "hideCoverage", "false" ) == "true" ? true : false;

  //upgrade pre 2.1 projects
  double margin = atlasElem.attribute( "margin", "0.0" ).toDouble();
  if ( composerMap && margin != 0 )
  {
    composerMap->setAtlasMargin( margin );
  }
  bool fixedScale = atlasElem.attribute( "fixedScale", "false" ) == "true" ? true : false;
  if ( composerMap && fixedScale )
  {
    composerMap->setAtlasFixedScale( true );
  }

  mSingleFile = atlasElem.attribute( "singleFile", "false" ) == "true" ? true : false;
  mFilenamePattern = atlasElem.attribute( "filenamePattern", "" );

  mSortFeatures = atlasElem.attribute( "sortFeatures", "false" ) == "true" ? true : false;
  if ( mSortFeatures )
  {
    mSortKeyAttributeIdx = atlasElem.attribute( "sortKey", "0" ).toInt();
    mSortAscending = atlasElem.attribute( "sortAscending", "true" ) == "true" ? true : false;
  }
  mFilterFeatures = atlasElem.attribute( "filterFeatures", "false" ) == "true" ? true : false;
  if ( mFilterFeatures )
  {
    mFeatureFilter = atlasElem.attribute( "featureFilter", "" );
  }

  emit parameterChanged();
}
开发者ID:FlavioFalcao,项目名称:QGIS,代码行数:69,代码来源:qgsatlascomposition.cpp

示例6: GetFilteredRecordedList

DTC::ProgramList* Dvr::GetFilteredRecordedList( bool           bDescending,
                                                int            nStartIndex,
                                                int            nCount,
                                                const QString &sTitleRegEx,
                                                const QString &sRecGroup,
                                                const QString &sStorageGroup )
{
    QMap< QString, ProgramInfo* > recMap;

    if (gCoreContext->GetScheduler())
        recMap = gCoreContext->GetScheduler()->GetRecording();

    QMap< QString, uint32_t > inUseMap    = ProgramInfo::QueryInUseMap();
    QMap< QString, bool >     isJobRunning= ProgramInfo::QueryJobsRunning(JOB_COMMFLAG);

    ProgramList progList;

    int desc = 0;
    if (bDescending)
        desc = -1;

    LoadFromRecorded( progList, false, inUseMap, isJobRunning, recMap, desc );

    QMap< QString, ProgramInfo* >::iterator mit = recMap.begin();

    for (; mit != recMap.end(); mit = recMap.erase(mit))
        delete *mit;

    // ----------------------------------------------------------------------
    // Build Response
    // ----------------------------------------------------------------------

    DTC::ProgramList *pPrograms = new DTC::ProgramList();
    int nAvailable = 0;

    if ((sTitleRegEx.isEmpty()) &&
        (sRecGroup.isEmpty()) &&
        (sStorageGroup.isEmpty()))
    {
        nStartIndex   = min( nStartIndex, (int)progList.size() );
        nCount        = (nCount > 0) ? min( nCount, (int)progList.size() ) : progList.size();
        int nEndIndex = min((nStartIndex + nCount), (int)progList.size() );
        nCount        = nEndIndex - nStartIndex;

        nAvailable = progList.size();

        for( int n = nStartIndex; n < nEndIndex; n++)
        {
            ProgramInfo *pInfo = progList[ n ];
            DTC::Program *pProgram = pPrograms->AddNewProgram();

            FillProgramInfo( pProgram, pInfo, true );
        }
    }
    else
    {
        int nMax      = nCount;

        nAvailable = 0;
        nCount = 0;

        QRegExp rTitleRegEx        = QRegExp(sTitleRegEx, Qt::CaseInsensitive);

        for( unsigned int n = 0; n < progList.size(); n++)
        {
            ProgramInfo *pInfo = progList[ n ];

            if ((!sTitleRegEx.isEmpty() && !pInfo->GetTitle().contains(rTitleRegEx)) ||
                (!sRecGroup.isEmpty() && sRecGroup != pInfo->GetRecordingGroup()) ||
                (!sStorageGroup.isEmpty() && sStorageGroup != pInfo->GetStorageGroup()))
                continue;

            ++nAvailable;

            if ((nAvailable < nStartIndex) ||
                (nCount >= nMax))
                continue;

            ++nCount;

            DTC::Program *pProgram = pPrograms->AddNewProgram();

            FillProgramInfo( pProgram, pInfo, true );
        }
    }

    // ----------------------------------------------------------------------

    pPrograms->setStartIndex    ( nStartIndex     );
    pPrograms->setCount         ( nCount          );
    pPrograms->setTotalAvailable( nAvailable      );
    pPrograms->setAsOf          ( QDateTime::currentDateTime() );
    pPrograms->setVersion       ( MYTH_BINARY_VERSION );
    pPrograms->setProtoVer      ( MYTH_PROTO_VERSION  );

    return pPrograms;
}
开发者ID:killerkiwi,项目名称:mythtv,代码行数:97,代码来源:dvr.cpp

示例7: parse_chan_info

static bool parse_chan_info(const QString   &rawdata,
                            IPTVChannelInfo &info,
                            QString         &channum,
                            uint            &lineNum)
{
    // #EXTINF:0,2 - France 2                <-- duration,channum - channame
    // #EXTMYTHTV:xmltvid=C2.telepoche.com   <-- optional line (myth specific)
    // #EXTMYTHTV:bitrate=BITRATE            <-- optional line (myth specific)
    // #EXTMYTHTV:fectype=FECTYPE            <-- optional line (myth specific)
    //     The FECTYPE can be rfc2733, rfc5109, or smpte2022
    // #EXTMYTHTV:fecurl0=URL                <-- optional line (myth specific)
    // #EXTMYTHTV:fecurl1=URL                <-- optional line (myth specific)
    // #EXTMYTHTV:fecbitrate0=BITRATE        <-- optional line (myth specific)
    // #EXTMYTHTV:fecbitrate1=BITRATE        <-- optional line (myth specific)
    // #...                                  <-- ignored comments
    // rtsp://maiptv.iptv.fr/iptvtv/201 <-- url

    QString name;
    QMap<QString,QString> values;

    while (true)
    {
        QString line = rawdata.section("\n", lineNum, lineNum);
        if (line.isEmpty())
            return false;

        ++lineNum;
        if (line.startsWith("#"))
        {
            if (line.startsWith("#EXTINF:"))
            {
                parse_extinf(line.mid(line.indexOf(':')+1), channum, name);
            }
            else if (line.startsWith("#EXTMYTHTV:"))
            {
                QString data = line.mid(line.indexOf(':'));
                QString key = data.left(data.indexOf('='));
                if (!key.isEmpty())
                    values[key] = data.mid(data.indexOf('=')+1);
            }
            continue;
        }

        if (name.isEmpty())
            return false;

        QMap<QString,QString>::const_iterator it = values.begin();
        for (; it != values.end(); ++it)
        {
            LOG(VB_GENERAL, LOG_INFO,
                QString("parse_chan_info [%1]='%2'")
                .arg(it.key()).arg(*it));
        }
        info = IPTVChannelInfo(
            name, values["xmltvid"],
            line, values["bitrate"].toUInt(),
            values["fectype"],
            values["fecurl0"], values["fecbitrate0"].toUInt(),
            values["fecurl1"], values["fecbitrate1"].toUInt());
        return true;
    }
}
开发者ID:aravilife,项目名称:mythtv-stabilize2,代码行数:62,代码来源:iptvchannelfetcher.cpp

示例8: generateDefault

void TOCGenerator::generateDefault()
{
	if (m_doc == NULL)
		return;
	Q_ASSERT(!m_doc->masterPageMode());
	for(ToCSetupVector::Iterator tocSetupIt = m_doc->tocSetups().begin(); tocSetupIt != m_doc->tocSetups().end(); ++tocSetupIt )
	{
		PageItem* tocFrame = findTargetFrame(tocSetupIt->frameName);
		if (tocFrame == NULL)
			continue;

		PageItem *currentDocItem;
		QMap<QString, QString> tocMap;

		uint *pageCounter = new uint[m_doc->DocPages.count()];
		if (pageCounter == NULL)
			return;
		uint pageNumberWidth = QString("%1").arg(m_doc->DocPages.count()).length();
		for (int i = 0; i < m_doc->DocPages.count(); ++i)
			pageCounter[i] = 0;

		for (int d = 0; d < m_doc->DocItems.count(); ++d)
		{
			currentDocItem = m_doc->DocItems.at(d);
			if (currentDocItem == NULL)
				continue;
			//Item not on a page, continue
			if (currentDocItem->OwnPage == -1)
				continue;
			//If we dont want to list non printing frames and this one is set to not print, continue
			if (!tocSetupIt->listNonPrintingFrames && !currentDocItem->printEnabled())
				continue;

			ObjectAttribute objAttr;
			QList<ObjectAttribute> objAttrs = currentDocItem->getObjectAttributes(tocSetupIt->itemAttrName);
			if (objAttrs.count() <= 0)
				continue;

			QString pageID = QString("%1").arg(currentDocItem->OwnPage + m_doc->FirstPnum, pageNumberWidth);
			QString sectionID = m_doc->getSectionPageNumberForPageIndex(currentDocItem->OwnPage);

			for (int i = 0; i < objAttrs.count(); ++i)
			{
				objAttr = objAttrs.at(i);
				if (objAttr.name.isNull())
					continue;

				//The key is generated to produce a sequence of numbers for the page numbers
				//First is the page of the item
				//Second is an incremented counter for the item so multiple per page works
				//Third is the section based page number which is actually used in the TOC.
				QString tocID = QString("%1").arg(pageCounter[currentDocItem->OwnPage]++, 3 , 10, QChar('0'));
				QString key   = QString("%1,%2,%3").arg(pageID).arg(tocID).arg(sectionID);
				tocMap.insert(key, objAttr.value);
			}
		}

		//Set up the gtWriter instance with the selected paragraph style
		gtWriter writer(false, tocFrame);
		writer.setUpdateParagraphStyles(false);
		writer.setOverridePStyleFont(false);
		gtFrameStyle* fstyle = writer.getDefaultStyle();
		gtParagraphStyle* pstyle = new gtParagraphStyle(*fstyle);
		pstyle->setName(tocSetupIt->textStyle);
		writer.setParagraphStyle(pstyle);
		
		QString oldTocPage = QString::null;
		for (QMap<QString, QString>::Iterator tocIt=tocMap.begin(); tocIt != tocMap.end();++tocIt)
		{
			QString tocPage(tocIt.key().section( ',', 2, 2 ).trimmed());
			QString tocLine;
			//Start with text or numbers
			if (tocSetupIt->pageLocation == End || tocSetupIt->pageLocation == NotShown)
				tocLine = tocIt.value();
			if (tocSetupIt->pageLocation == Beginning && oldTocPage != tocPage)
				tocLine = tocPage;
			//Add in the tab for the leaders
			tocLine += "\t";
			//End with text or numbers
			if (tocSetupIt->pageLocation == Beginning)
				tocLine += tocIt.value();
			if (tocSetupIt->pageLocation == End && oldTocPage != tocPage)
				tocLine += tocPage;
			tocLine += "\n";
			writer.append(tocLine);
		}

		delete[] pageCounter;
	}
}
开发者ID:JLuc,项目名称:scribus,代码行数:90,代码来源:tocgenerator.cpp

示例9:

void
VatsimDataHandler::__clearFlags(QMap< QString, bool >& _flags) {
  for (auto it = _flags.begin(); it != _flags.end(); ++it)
    it.value() = false;
}
开发者ID:Ucchi98,项目名称:Vatsinator,代码行数:5,代码来源:vatsimdatahandler.cpp

示例10: setCustomFields

 void setCustomFields(const QMap<QString, QString> &fields)
 {
     QMap<QString, QString>::const_iterator it = fields.begin(), end = fields.end();
     for ( ; it != end; ++it)
         setCustomField(it.key(), it.value());
 }
开发者ID:rburchell,项目名称:messagingframework,代码行数:6,代码来源:qmailaccount.cpp

示例11: makeGraph

void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const QVector< QgsPoint >& additionalPoints,
    QVector< QgsPoint >& tiedPoint ) const
{
  QgsVectorLayer *vl = mVectorLayer;

  if ( !vl )
    return;

  int featureCount = ( int ) vl->featureCount() * 2;
  int step = 0;

  QgsCoordinateTransform ct;
  ct.setSourceCrs( vl->crs() );
  if ( builder->coordinateTransformationEnabled() )
  {
    ct.setDestinationCrs( builder->destinationCrs() );
  }
  else
  {
    ct.setDestinationCrs( vl->crs() );
  }

  tiedPoint = QVector< QgsPoint >( additionalPoints.size(), QgsPoint( 0.0, 0.0 ) );

  TiePointInfo tmpInfo;
  tmpInfo.mLength = std::numeric_limits<double>::infinity();

  QVector< TiePointInfo > pointLengthMap( additionalPoints.size(), tmpInfo );
  QVector< TiePointInfo >::iterator pointLengthIt;

  //Graph's points;
  QVector< QgsPoint > points;

  QgsFeatureIterator fit = vl->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QgsAttributeList() ) );

  // begin: tie points to the graph
  QgsAttributeList la;
  QgsFeature feature;
  while ( fit.nextFeature( feature ) )
  {
    QgsMultiPolyline mpl;
    if ( QgsWkbTypes::flatType( feature.geometry().geometry()->wkbType() ) == QgsWkbTypes::MultiLineString )
      mpl = feature.geometry().asMultiPolyline();
    else if ( QgsWkbTypes::flatType( feature.geometry().geometry()->wkbType() ) == QgsWkbTypes::LineString )
      mpl.push_back( feature.geometry().asPolyline() );

    QgsMultiPolyline::iterator mplIt;
    for ( mplIt = mpl.begin(); mplIt != mpl.end(); ++mplIt )
    {
      QgsPoint pt1, pt2;
      bool isFirstPoint = true;
      QgsPolyline::iterator pointIt;
      for ( pointIt = mplIt->begin(); pointIt != mplIt->end(); ++pointIt )
      {
        pt2 = ct.transform( *pointIt );
        points.push_back( pt2 );

        if ( !isFirstPoint )
        {
          int i = 0;
          for ( i = 0; i != additionalPoints.size(); ++i )
          {
            TiePointInfo info;
            if ( pt1 == pt2 )
            {
              info.mLength = additionalPoints[ i ].sqrDist( pt1 );
              info.mTiedPoint = pt1;
            }
            else
            {
              info.mLength = additionalPoints[ i ].sqrDistToSegment( pt1.x(), pt1.y(),
                             pt2.x(), pt2.y(), info.mTiedPoint );
            }

            if ( pointLengthMap[ i ].mLength > info.mLength )
            {
              Q_UNUSED( info.mTiedPoint );
              info.mFirstPoint = pt1;
              info.mLastPoint = pt2;

              pointLengthMap[ i ] = info;
              tiedPoint[ i ] = info.mTiedPoint;
            }
          }
        }
        pt1 = pt2;
        isFirstPoint = false;
      }
    }
    emit buildProgress( ++step, featureCount );
  }
  // end: tie points to graph

  // add tied point to graph
  int i = 0;
  for ( i = 0; i < tiedPoint.size(); ++i )
  {
    if ( tiedPoint[ i ] != QgsPoint( 0.0, 0.0 ) )
    {
      points.push_back( tiedPoint [ i ] );
//.........这里部分代码省略.........
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:101,代码来源:qgslinevectorlayerdirector.cpp


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