qdoc: Removed several #if 0 blocks.
authorMartin Smith <martin.smith@nokia.com>
Thu, 5 Jul 2012 11:58:17 +0000 (13:58 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 6 Jul 2012 01:54:26 +0000 (03:54 +0200)
Removed a lot of dead code.

Change-Id: I237521efab7dd046d3a47ab92a6a0e083c59ab55
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
src/tools/qdoc/codemarker.cpp
src/tools/qdoc/config.cpp
src/tools/qdoc/ditaxmlgenerator.cpp
src/tools/qdoc/doc.cpp
src/tools/qdoc/htmlgenerator.cpp
src/tools/qdoc/main.cpp
src/tools/qdoc/node.cpp
src/tools/qdoc/node.h

index 122feeb..e82a4a0 100644 (file)
@@ -532,23 +532,7 @@ void CodeMarker::append(QList<Section>& sectionList, const FastSection& fs, bool
 
 static QString encode(const QString &string)
 {
-#if 0
-    QString result = string;
-
-    for (int i = string.size() - 1; i >= 0; --i) {
-        uint ch = string.at(i).unicode();
-        if (ch > 0xFF)
-            ch = '?';
-        if ((ch - '0') >= 10 && (ch - 'a') >= 26 && (ch - 'A') >= 26
-                && ch != '/' && ch != '(' && ch != ')' && ch != ',' && ch != '*'
-                && ch != '&' && ch != '_' && ch != '<' && ch != '>' && ch != ':'
-                && ch != '~')
-            result.replace(i, 1, QString("%") + QString("%1").arg(ch, 2, 16));
-    }
-    return result;
-#else
     return string;
-#endif
 }
 
 QStringList CodeMarker::macRefsForNode(Node *node)
@@ -558,12 +542,6 @@ QStringList CodeMarker::macRefsForNode(Node *node)
     case Node::Class:
     {
         const ClassNode *classe = static_cast<const ClassNode *>(node);
-#if 0
-        if (!classe->templateStuff().isEmpty()) {
-            result += QLatin1String("tmplt/");
-        }
-        else
-#endif
         {
             result += QLatin1String("cl/");
         }
@@ -598,11 +576,6 @@ QStringList CodeMarker::macRefsForNode(Node *node)
         if (func->metaness() == FunctionNode::MacroWithParams
                 || func->metaness() == FunctionNode::MacroWithoutParams) {
             result += QLatin1String("macro/");
-#if 0
-        }
-        else if (!func->templateStuff().isEmpty()) {
-            result += QLatin1String("ftmplt/");
-#endif
         }
         else if (func->isStatic()) {
             result += QLatin1String("clm/");
@@ -617,23 +590,6 @@ QStringList CodeMarker::macRefsForNode(Node *node)
         result += macName(func);
         if (result.endsWith(QLatin1String("()")))
             result.chop(2);
-#if 0
-        // this code is too clever for the Xcode documentation
-        // browser and/or pbhelpindexer
-        if (!isMacro) {
-            result += QLatin1Char('/') + QLatin1String(QMetaObject::normalizedSignature(func->returnType().toLatin1().constData())) + "/(";
-            const QList<Parameter> &params = func->parameters();
-            for (int i = 0; i < params.count(); ++i) {
-                QString type = params.at(i).leftType() +
-                        params.at(i).rightType();
-                type = QLatin1String(QMetaObject::normalizedSignature(type.toLatin1().constData()));
-                if (i != 0)
-                    result += QLatin1Char(',');
-                result += type;
-            }
-            result += QLatin1Char(')');
-        }
-#endif
     }
         break;
     case Node::Variable:
index 905dba6..7ab6570 100644 (file)
@@ -215,15 +215,6 @@ void Config::unload(const QString& fileName)
     QStringMultiMap::ConstIterator v = stringValueMap.constBegin();
     while (v != stringValueMap.constEnd()) {
         qDebug() << v.key() << " = " << v.value();
-#if 0
-        if (v.key().startsWith(varDot)) {
-            QString subVar = v.key().mid(varDot.length());
-            int dot = subVar.indexOf(QLatin1Char('.'));
-            if (dot != -1)
-                subVar.truncate(dot);
-            t.insert(subVar,v.value());
-        }
-#endif
         ++v;
     }
     qDebug() << "fileName:" << fileName;
index 8e36ab2..e5c500c 100644 (file)
@@ -608,10 +608,6 @@ QString DitaXmlGenerator::lookupGuid(QString text)
     QMap<QString, QString>::const_iterator i = name2guidMap.constFind(text);
     if (i != name2guidMap.constEnd())
         return i.value();
-#if 0
-    QString t = QUuid::createUuid().toString();
-    QString guid = "id-" + t.mid(1,t.length()-2);
-#endif
     QString guid = Node::cleanId(text);
     name2guidMap.insert(text,guid);
     return guid;
@@ -631,10 +627,6 @@ QString DitaXmlGenerator::lookupGuid(const QString& fileName, const QString& tex
     GuidMap::const_iterator i = gm->constFind(text);
     if (i != gm->constEnd())
         return i.value();
-#if 0
-    QString t = QUuid::createUuid().toString();
-    QString guid = "id-" + t.mid(1,t.length()-2);
-#endif
     QString guid = Node::cleanId(text);
     gm->insert(text,guid);
     return guid;
@@ -764,13 +756,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
     static bool in_para = false;
     QString guid, hc, attr;
 
-#if 0
-    // Leave this here for debugging.
-    if (outFileName() == "modules.dita") {
-        QString comment = "ATOM:" + atom->typeString();
-        xmlWriter().writeComment(comment);
-    }
-#endif
     switch (atom->type()) {
     case Atom::AbstractLeft:
         break;
@@ -1568,14 +1553,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
         }
         break;
     case Atom::SectionLeft:
-#if 0
-        if (inApiDesc) {
-            writeEndTag(); // </apiDesc>
-            inApiDesc = false;
-        }
-#endif
         enterSection("details",QString());
-        //writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString()));
         break;
     case Atom::SectionRight:
         leaveSection();
@@ -1876,15 +1854,6 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
         writeEndTag(); // <cxxClassDefinition>
 
         enterDesc(DT_apiDesc,QString(),title);
-#if 0
-        // To be removed, if really not needed.
-        Text brief = nsn->doc().briefText(); // zzz
-        if (!brief.isEmpty()) {
-            writeStartTag(DT_p);
-            generateText(brief, nsn, marker);
-            writeEndTag(); // </p>
-        }
-#endif
         generateStatus(nsn, marker);
         generateThreadSafeness(nsn, marker);
         generateSince(nsn, marker);
@@ -2012,15 +1981,6 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
         writeEndTag(); // <cxxClassDefinition>
 
         enterDesc(DT_apiDesc,QString(),title);
-#if 0
-        // To be removed, if really not needed.
-        Text brief = cn->doc().briefText(); // zzz
-        if (!brief.isEmpty()) {
-            writeStartTag(DT_p);
-            generateText(brief, cn, marker);
-            writeEndTag(); // </p>
-        }
-#endif
         generateStatus(cn, marker);
         generateInherits(cn, marker);
         generateInheritedBy(cn, marker);
@@ -2138,15 +2098,6 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
 
         writeStartTag(DT_cxxClassDetail);
         enterDesc(DT_apiDesc,QString(),title);
-#if 0
-        // To be removed, if really not needed.
-        Text brief = fn->doc().briefText(); // zzz
-        if (!brief.isEmpty()) {
-            writeStartTag(DT_p);
-            generateText(brief, fn, marker);
-            writeEndTag(); // </p>
-        }
-#endif
         generateStatus(fn, marker);
         generateThreadSafeness(fn, marker);
         generateSince(fn, marker);
@@ -2265,15 +2216,6 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
         generateQmlSince(qcn);
 
         enterDesc(DT_apiDesc,QString(),title);
-#if 0
-        // To be removed, if really not needed.
-        Text brief = qcn->doc().briefText(); // zzz
-        if (!brief.isEmpty()) {
-            writeStartTag(DT_p);
-            generateText(brief, qcn, marker);
-            writeEndTag(); // </p>
-        }
-#endif
         enterSection(QString(), QString());
         generateBody(qcn, marker);
         if (cn) {
@@ -3026,57 +2968,6 @@ void DitaXmlGenerator::generateCompactList(const Node* relative,
         QChar common(idx);
         commonPrefix = common;
         commonPrefixLen = 1;
-
-#if 0
-        /*
-          The algorithm below eventually failed, so it was replaced
-          with the simple (perhaps too simple) algorithm above.
-
-          The caller didn't pass in a common prefix, so get the common
-          prefix by looking at the class names of the first and last
-          classes in the class map. Discard any namespace names and
-          just use the bare class names. For Qt, the prefix is "Q".
-
-          Note that the algorithm used here to derive the common prefix
-          from the first and last classes in alphabetical order (QAccel
-          and QXtWidget in Qt 2.1), fails if either class name does not
-          begin with Q.
-        */
-        QString first;
-        QString last;
-        NodeMap::const_iterator iter = classMap.constBegin();
-        while (iter != classMap.constEnd()) {
-            if (!iter.key().contains("::")) {
-                first = iter.key();
-                break;
-            }
-            ++iter;
-        }
-
-        if (first.isEmpty())
-            first = classMap.constBegin().key();
-
-        iter = classMap.constEnd();
-        while (iter != classMap.constBegin()) {
-            --iter;
-            if (!iter.key().contains("::")) {
-                last = iter.key();
-                break;
-            }
-        }
-
-        if (last.isEmpty())
-            last = classMap.constBegin().key();
-
-        if (classMap.size() > 1) {
-            while (commonPrefixLen < first.length() + 1 &&
-                   commonPrefixLen < last.length() + 1 &&
-                   first[commonPrefixLen] == last[commonPrefixLen])
-                ++commonPrefixLen;
-        }
-
-        commonPrefix = first.left(commonPrefixLen);
-#endif
     }
 
     /*
@@ -3316,13 +3207,6 @@ void DitaXmlGenerator::generateQmlItem(const Node* node,
     }
     marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
                    "<i>\\1<sub>\\2</sub></i>");
-#if 0
-    marked.replace("<@param>", "<i>");
-    marked.replace("</@param>", "</i>");
-
-    marked.replace("<@extra>", "<tt>");
-    marked.replace("</@extra>", "</tt>");
-#endif
     if (summary) {
         marked.remove("<@type>");
         marked.remove("</@type>");
@@ -3542,10 +3426,6 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node,
     }
     marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
                    "<i> \\1<sub>\\2</sub></i>");
-#if 0
-    marked.replace("<@param>","<i>");
-    marked.replace("</@param>","</i>");
-#endif
     if (style == CodeMarker::Summary) {
         marked.remove("<@name>");   // was "<b>"
         marked.remove("</@name>");  // was "</b>"
@@ -3556,12 +3436,6 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node,
         extraRegExp.setMinimal(true);
         marked.remove(extraRegExp);
     }
-#if 0
-    else {
-        marked.replace("<@extra>","<tt>");
-        marked.replace("</@extra>","</tt>");
-    }
-#endif
 
     if (style != CodeMarker::Detailed) {
         marked.remove("<@type>");
@@ -3870,16 +3744,6 @@ QString DitaXmlGenerator::protect(const QString& string, const QString& ) //outp
         else if (ch == QLatin1Char('"')) {
             APPEND("&quot;");
         }
-#if 0
-        else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) ||
-                 (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) ||
-                 (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) {
-            // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator
-            APPEND("&#x");
-            xml += QString::number(ch.unicode(), 16);
-            xml += QLatin1Char(';');
-        }
-#endif
         else {
             if (!xml.isEmpty())
                 xml += ch;
@@ -3901,20 +3765,6 @@ QString DitaXmlGenerator::fileBase(const Node* node) const
 {
     QString result;
     result = Generator::fileBase(node);
-#if 0
-    if (!node->isInnerNode()) {
-        switch (node->status()) {
-        case Node::Compat:
-            result += "-qt3";
-            break;
-        case Node::Obsolete:
-            result += "-obsolete";
-            break;
-        default:
-            ;
-        }
-    }
-#endif
     return result;
 }
 
index b60563c..c52b44f 100644 (file)
@@ -1985,16 +1985,6 @@ void DocParser::parseAlso()
     }
 }
 
-//static bool debug = false;
-#if 0
-if (type == Atom::DivLeft)
-debug = true;
-if (debug)
-qDebug() << type << string;
-if (type == Atom::DivRight)
-debug = false;
-#endif
-
 void DocParser::append(Atom::Type type, const QString &string)
 {
     Atom::Type lastType = priv->text.lastAtom()->type();
index d5de02a..4923b23 100644 (file)
@@ -2373,57 +2373,6 @@ void HtmlGenerator::generateCompactList(const Node *relative,
         QChar common(idx);
         commonPrefix = common;
         commonPrefixLen = 1;
-
-#if 0
-        /*
-          The algorithm below eventually failed, so it was replaced
-          with the simple (perhaps too simple) algorithm above.
-
-          The caller didn't pass in a common prefix, so get the common
-          prefix by looking at the class names of the first and last
-          classes in the class map. Discard any namespace names and
-          just use the bare class names. For Qt, the prefix is "Q".
-
-          Note that the algorithm used here to derive the common prefix
-          from the first and last classes in alphabetical order (QAccel
-          and QXtWidget in Qt 2.1), fails if either class name does not
-          begin with Q.
-        */
-        QString first;
-        QString last;
-        NodeMap::const_iterator iter = classMap.constBegin();
-        while (iter != classMap.constEnd()) {
-            if (!iter.key().contains("::")) {
-                first = iter.key();
-                break;
-            }
-            ++iter;
-        }
-
-        if (first.isEmpty())
-            first = classMap.constBegin().key();
-
-        iter = classMap.constEnd();
-        while (iter != classMap.constBegin()) {
-            --iter;
-            if (!iter.key().contains("::")) {
-                last = iter.key();
-                break;
-            }
-        }
-
-        if (last.isEmpty())
-            last = classMap.constBegin().key();
-
-        if (classMap.size() > 1) {
-            while (commonPrefixLen < first.length() + 1 &&
-                   commonPrefixLen < last.length() + 1 &&
-                   first[commonPrefixLen] == last[commonPrefixLen])
-                ++commonPrefixLen;
-        }
-
-        commonPrefix = first.left(commonPrefixLen);
-#endif
     }
 
     /*
index 7686bd3..effeadf 100644 (file)
@@ -364,27 +364,6 @@ static void processQdocconfFile(const QString &fileName)
         sourceFileNames.insert(t,t);
     }
 
-#if 0
-    QFile* files = new QFile("/Users/msmith/depot/qt5/qtdoc/inputlist.txt");
-    files->open(QFile::WriteOnly);
-    QTextStream* filesout = new QTextStream(files);
-
-    {
-        QMultiMap<QString,QString>::ConstIterator i = headerFileNames.begin();
-        while (i != headerFileNames.end()) {
-            (*filesout) << i.key() << "\n";
-            ++i;
-        }
-        i = sourceFileNames.begin();
-        while (i != sourceFileNames.end()) {
-            (*filesout) << i.key() << "\n";
-            ++i;
-        }
-    }
-    filesout->flush();
-    files->close();
-#endif
-
     /*
       Parse each header file in the set using the appropriate parser and add it
       to the big tree.
index 4117c50..6cb72ca 100644 (file)
@@ -532,13 +532,6 @@ QString Node::guid() const
     return uuid_;
 }
 
-#if 0
-// fossil
-QUuid quuid = QUuid::createUuid();
-QString t = quuid.toString();
-uuid = "id-" + t.mid(1,t.length()-2);
-#endif
-
 /*!
   Composes a string to be used as an href attribute in DITA
   XML. It is composed of the file name and the UUID separated
@@ -2356,22 +2349,6 @@ QmlPropertyNode::QmlPropertyNode(QmlPropertyNode* parent,
     setPageType(ApiPage);
 }
 
-#if 0
-    const PropertyNode *correspondingProperty = 0;
-    ClassNode *correspondingClass = static_cast<QmlClassNode*>(qmlPropGroup->parent())->classNode();
-    if (correspondingClass) {
-        correspondingProperty = qmlPropNode->correspondingProperty(tree_);
-    }
-    if (correspondingProperty) {
-        bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*');
-        qmlPropNode->setReadOnly(!(writableList || correspondingProperty->isWritable()));
-    }
-
-    if (correspondingProperty) {
-        bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*');
-        qmlPropNode->setReadOnly(!(writableList || correspondingProperty->isWritable()));
-    }
-#endif
 /*!
   Returns true if a QML property or attached property is
   not read-only. The algorithm for figuring this out is long
index 72b5f6d..6255b27 100644 (file)
@@ -270,15 +270,6 @@ private:
     Status status_;
     bool indexNodeFlag_;
 
-#if 0
-    //ifdef Q_WS_WIN
-    //else
-    Type nodeType_ : 4;
-    Access access_ : 2;
-    ThreadSafeness safeness_ : 2;
-    PageType pageType_ : 4;
-    Status status_ : 3;
-#endif
     InnerNode* parent_;
     InnerNode* relatesTo_;
     QString name_;