diff options
author | Martin Smith <martin.smith@nokia.com> | 2011-02-24 10:48:32 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2011-02-24 10:48:32 (GMT) |
commit | e51fda7db531628b54297ae020dda4a5f962d394 (patch) | |
tree | 846fa261f80459529235e890ed897cf6186e9351 /tools/qdoc3/generator.cpp | |
parent | 66aba9ad196c24d6844e39901bf152d0951ccfb7 (diff) | |
parent | c881e33e7e510204fabd061dac08a00b10b432fb (diff) | |
download | Qt-e51fda7db531628b54297ae020dda4a5f962d394.zip Qt-e51fda7db531628b54297ae020dda4a5f962d394.tar.gz Qt-e51fda7db531628b54297ae020dda4a5f962d394.tar.bz2 |
Merge branch 'mimir' of git@scm.dev.nokia.troll.no:qt/qt-doc-team into mimir
Diffstat (limited to 'tools/qdoc3/generator.cpp')
-rw-r--r-- | tools/qdoc3/generator.cpp | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 26f8de1..b4768db 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -43,7 +43,9 @@ generator.cpp */ #include <qdir.h> +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES #include <qdebug.h> +#endif #include "codemarker.h" #include "config.h" #include "doc.h" @@ -73,6 +75,7 @@ QStringList Generator::styleFiles; QStringList Generator::styleDirs; QString Generator::outDir; QString Generator::project; +QHash<QString, QString> Generator::outputPrefixes; static void singularPlural(Text& text, const NodeList& nodes) { @@ -262,7 +265,6 @@ void Generator::initialize(const Config &config) } else { int paramPos = def.indexOf("\1"); - qDebug() << "ZZZZZ:" << *n << def.left(paramPos) << def.mid(paramPos + 1); fmtLeftMaps[*f].insert(*n, def.left(paramPos)); fmtRightMaps[*f].insert(*n, def.mid(paramPos + 1)); } @@ -273,6 +275,14 @@ void Generator::initialize(const Config &config) } project = config.getString(CONFIG_PROJECT); + + QStringList prefixes = config.getStringList(CONFIG_OUTPUTPREFIXES); + if (!prefixes.isEmpty()) { + foreach (QString prefix, prefixes) + outputPrefixes[prefix] = config.getString( + CONFIG_OUTPUTPREFIXES + Config::dot + prefix); + } else + outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-"); } void Generator::terminate() @@ -525,8 +535,9 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) Quoter quoter; Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); QString code = quoter.quoteTo(fake->location(), "", ""); - text << Atom(Atom::Code, code); - generateText(text, fake, CodeMarker::markerForFileName(fake->name())); + CodeMarker *codeMarker = CodeMarker::markerForFileName(fake->name()); + text << Atom(codeMarker->atomType(), code); + generateText(text, fake, codeMarker); } } } @@ -684,26 +695,17 @@ QString Generator::indent(int level, const QString& markedCode) int i = 0; while (i < (int) markedCode.length()) { - if (markedCode.at(i) == QLatin1Char('<')) { - while (i < (int) markedCode.length()) { - t += markedCode.at(i++); - if (markedCode.at(i - 1) == QLatin1Char('>')) - break; - } + if (markedCode.at(i) == QLatin1Char('\n')) { + column = 0; } else { - if (markedCode.at(i) == QLatin1Char('\n')) { - column = 0; - } - else { - if (column == 0) { - for (int j = 0; j < level; j++) - t += QLatin1Char(' '); - } - column++; + if (column == 0) { + for (int j = 0; j < level; j++) + t += QLatin1Char(' '); } - t += markedCode.at(i++); + column++; } + t += markedCode.at(i++); } return t; } @@ -1268,4 +1270,9 @@ QString Generator::fullName(const Node *node, return marker->plainFullName(node, relative); } +QString Generator::outputPrefix(const QString &nodeType) +{ + return outputPrefixes[nodeType]; +} + QT_END_NAMESPACE |