tools/assistant/lib/qhelpsearchindexreader_default.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
--- a/tools/assistant/lib/qhelpsearchindexreader_default.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/tools/assistant/lib/qhelpsearchindexreader_default.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -52,9 +52,8 @@
 
 QT_BEGIN_NAMESPACE
 
-namespace qt {
-    namespace fulltextsearch {
-        namespace std {
+namespace fulltextsearch {
+namespace std {
 
 namespace {
     QStringList split( const QString &str )
@@ -166,7 +165,7 @@
         const QString fileName = it.key();
         bool containsAll = true;
         QStringList split = fileName.split(QLatin1String("@"));
-        foreach (const QString attribute, attributes) {
+        foreach (const QString &attribute, attributes) {
             if (!split.contains(attribute, Qt::CaseInsensitive)) {
                 containsAll = false;
                 break;
@@ -180,9 +179,9 @@
 
 void Reader::setIndexFile(const QString &namespaceName, const QString &attributes)
 {
-    QString extention = namespaceName + QLatin1String("@") + attributes;
-    indexFile = indexPath + QLatin1String("/indexdb40.") + extention;
-    documentFile = indexPath + QLatin1String("/indexdoc40.") + extention;
+    QString extension = namespaceName + QLatin1String("@") + attributes;
+    indexFile = indexPath + QLatin1String("/indexdb40.") + extension;
+    documentFile = indexPath + QLatin1String("/indexdoc40.") + extension;
 }
 
 bool Reader::splitSearchTerm(const QString &searchTerm, QStringList *terms,
@@ -235,7 +234,7 @@
 
 void Reader::searchInIndex(const QStringList &terms)
 {
-    foreach (const QString term, terms) {
+    foreach (const QString &term, terms) {
         QVector<Document> documents;
 
         for(IndexTable::ConstIterator it = searchIndexTable.begin();
@@ -254,7 +253,7 @@
                 DocumentInfo info;
                 QString title, url;
                 QVector<DocumentInfo> documentsInfo;
-                foreach(const Document doc, documents) {
+                foreach(const Document &doc, documents) {
                     info.docNumber = doc.docNumber;
                     info.frequency = doc.frequency;
                     info.documentUrl = documentList.at(doc.docNumber).at(1);
@@ -519,7 +518,7 @@
     mutex.unlock();
 
     QString queryTerm;
-    foreach (const QHelpSearchQuery query, queryList) {
+    foreach (const QHelpSearchQuery &query, queryList) {
         if (query.fieldName == QHelpSearchQuery::DEFAULT) {
             queryTerm = query.wordList.at(0);
             break;
@@ -541,7 +540,7 @@
 
     // setup the reader
     m_reader.setIndexPath(indexPath);
-    foreach(const QString namespaceName, registeredDocs) {
+    foreach(const QString &namespaceName, registeredDocs) {
         mutex.lock();
         if (m_cancel) {
             mutex.unlock();
@@ -553,7 +552,7 @@
         const QList<QStringList> attributeSets =
             engine.filterAttributeSets(namespaceName);
 
-        foreach (QStringList attributes, attributeSets) {
+        foreach (const QStringList &attributes, attributeSets) {
             // read all index files
             m_reader.setIndexFile(namespaceName, attributes.join(QLatin1String("@")));
             if (!m_reader.readIndex()) {
@@ -577,7 +576,7 @@
         QVector<DocumentInfo> hits = m_reader.hits();
         if (!hits.isEmpty()) {
             if (termSeq.isEmpty()) {
-                foreach (const DocumentInfo docInfo, hits) {
+                foreach (const DocumentInfo &docInfo, hits) {
                     mutex.lock();
                     if (m_cancel) {
                         mutex.unlock();
@@ -588,7 +587,7 @@
                     hitList.append(qMakePair(docInfo.documentTitle, docInfo.documentUrl));
                 }
             } else {
-                foreach (const DocumentInfo docInfo, hits) {
+                foreach (const DocumentInfo &docInfo, hits) {
                     mutex.lock();
                     if (m_cancel) {
                         mutex.unlock();
@@ -607,8 +606,7 @@
     emit searchingFinished(hitList.count());
 }
 
-        }   // namespace std
-    }   // namespace fulltextsearch
-}   // namespace qt
+}   // namespace std
+}   // namespace fulltextsearch
 
 QT_END_NAMESPACE