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


C++ QValueList::constBegin方法代码示例

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


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

示例1: getProbability

double NaiveBayesianClassifier::getProbability(QString category, const QStringList &text) {
    long totalWordCount = 0;

    // TODO: do caching
    QValueList<QString> categories = m_categories.keys();
    for( QValueList<QString>::const_iterator it = categories.constBegin(); it != categories.constEnd(); ++it ) {
        totalWordCount += getCount(*it);
    }

    double catCount = log(getCount(category));
    double probability = catCount;
    probability -= log(totalWordCount);

    for ( QStringList::ConstIterator iter = text.constBegin(); iter != text.constEnd(); ++iter ) {
        long wordCount = getWordCount(category, *iter);
        if( wordCount != 0) {
            //long wordProbability = wordCount;
            probability -= log(wordCount);
            probability += catCount;
        } else {
            probability -= log(MIN_CLASS_OCCURRENCE);
            probability += catCount;
        }
    }
    return probability;
}
开发者ID:BackupTheBerlios,项目名称:klassify-svn,代码行数:26,代码来源:naive_bayesian_classifier.cpp

示例2: appendFilters

//-----------------------------------------------------------------------------
void KMFilterMgr::appendFilters(const QValueList<KMFilter *> &filters,
                                bool replaceIfNameExists)
{
    mDirtyBufferedFolderTarget = true;
    beginUpdate();
    if(replaceIfNameExists)
    {
        QValueListConstIterator<KMFilter *> it1 = filters.constBegin();
        for(; it1 != filters.constEnd() ; ++it1)
        {
            QValueListConstIterator<KMFilter *> it2 = mFilters.constBegin();
            for(; it2 != mFilters.constEnd() ; ++it2)
            {
                if((*it1)->name() == (*it2)->name())
                {
                    mFilters.remove((*it2));
                    it2 = mFilters.constBegin();
                }
            }
        }
    }
    mFilters += filters;
    writeConfig(true);
    endUpdate();
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:26,代码来源:kmfiltermgr.cpp

示例3: kdDebug

QMap<QString,double> NaiveBayesianClassifier::getProbabilities(const QString &text)
{
    QStringList splitted = this->parse(text);
    QMap<QString,double> probabilities = QMap<QString,double>();

    QValueList<QString> categories = m_categories.keys();
    for( QValueList<QString>::const_iterator it = categories.constBegin(); it != categories.constEnd(); ++it ) {
        double probability = this->getProbability(*it, splitted);
        kdDebug() << "NaiveBayesianClassifiers::" << *it << " = " << probability << endl;
        probabilities.insert(*it, probability);
    }
    
    return probabilities;
}
开发者ID:BackupTheBerlios,项目名称:klassify-svn,代码行数:14,代码来源:naive_bayesian_classifier.cpp

示例4: cacheIndex

void DocumentationPlugin::cacheIndex(DocumentationCatalogItem *item)
{
    kdDebug() << "Creating index cache for " << item->text(0) << endl;
    
    QString cacheName = locateLocal("data", QString("kdevdocumentation/index/cache_") + item->text(0));
    QFile cacheFile(cacheName);
    if (!cacheFile.open(IO_WriteOnly))
        return;
    
    QTextStream str(&cacheFile);
    str.setEncoding(QTextStream::Unicode);
    str << CACHE_VERSION << endl;

    QValueList<IndexItemProto*> catalogIndexes = indexes[item];
    for (QValueList<IndexItemProto*>::const_iterator it = catalogIndexes.constBegin();
        it != catalogIndexes.constEnd(); ++it)
    {
        str << (*it)->text() << endl;
        str << (*it)->description() << endl;
        str << (*it)->url().url() << endl;
    }
   
    cacheFile.close();
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:24,代码来源:kdevdocumentationplugin.cpp

示例5: slotEditMember

void TeamMembersDlg::slotEditMember()
{
   QListViewItem *item =membersListView->currentItem();
   if (!item) return;
   KDialogBase editDlg(this, "edit_member", true, i18n("Edit Member"), KDialogBase::Ok | KDialogBase::Cancel);
   MemberEditDlg memberDlg(&editDlg);
   memberDlg.selectMember(item->text(NAME_COL));
   memberDlg.nicknameEdit->setText(item->text(NICKNAME_COL));
   memberDlg.emailEdit->setText(item->text(EMAIL_COL));
   QString role = item->text(ROLE_COL);
   for (int i = 0; i < memberDlg.roleCombo->count(); i++)
   {
      if (memberDlg.roleCombo->text(i) == role)
      {
         memberDlg.roleCombo->setCurrentItem(i);
         memberDlg.slotRoleSelected(role);
         break;
      }
   }
   memberDlg.taskEdit->setText(item->text(TASK_COL));
   int idx = 0;
   int subprojectIdx = 0;
   QValueList<SubProject> *subprojects = Project::ref()->subprojects();
   for (QValueList<SubProject>::ConstIterator it = subprojects->constBegin(); it != subprojects->constEnd(); ++it)
   {
      if (item->text(SUBPROJECT_COL) == (*it).name)
      {
        subprojectIdx = idx;
        break;
      }
      idx++;
   }
   memberDlg.subprojectCombo->setCurrentItem(subprojectIdx);

   editDlg.setMainWidget(&memberDlg);
   bool result;
   do {
     result = editDlg.exec();
     if (result)
     {
        QString name = memberDlg.nameCombo->currentText();
        QString nickName = memberDlg.nicknameEdit->text();
        QString email = memberDlg.emailEdit->text();
        QString role = memberDlg.roleCombo->currentText();
        QString task = memberDlg.taskEdit->text();
        QString subProject = memberDlg.subprojectCombo->currentText();
        if (name.isEmpty())
        {
           KMessageBox::error(this, i18n("The member name cannot be empty."));
           editDlg.show();
        } else
         if (nickName.isEmpty())
        {
           KMessageBox::error(this, i18n("The nickname cannot be empty as it is used as a unique identifier."));
           editDlg.show();
        } else
       if (!checkDuplicates(item, name, nickName, email, role, task, subProject))
        {
          editDlg.show();
        } else
        {
          item->setText(NAME_COL, name);
          item->setText(NICKNAME_COL, nickName);
          item->setText(EMAIL_COL, email);
          item->setText(ROLE_COL, role);
          item->setText(TASK_COL, task);
          if (memberDlg.subprojectCombo->isEnabled())
            item->setText(SUBPROJECT_COL, subProject);
          result = false;
        }
     }
   } while (result);
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:73,代码来源:teammembersdlg.cpp


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