Changeset 846 for trunk/tools/qdoc3/pagegenerator.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/tools/qdoc3/pagegenerator.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 44 44 */ 45 45 46 #include <QtCore>47 46 #include <qfile.h> 48 47 #include <qfileinfo.h> 49 48 #include <qdebug.h> 50 49 #include "pagegenerator.h" 51 50 #include "tree.h" … … 70 69 } 71 70 71 static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); 72 static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)(</@func>)"); 73 static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)"); 74 static QRegExp spanTag("</@(?:comment|preprocessor|string|char)>"); 75 static QRegExp unknownTag("</?@[^>]*>"); 76 77 bool PageGenerator::parseArg(const QString& src, 78 const QString& tag, 79 int* pos, 80 int n, 81 QStringRef* contents, 82 QStringRef* par1, 83 bool debug) 84 { 85 #define SKIP_CHAR(c) \ 86 if (debug) \ 87 qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \ 88 if (i >= n || src[i] != c) { \ 89 if (debug) \ 90 qDebug() << " char '" << c << "' not found"; \ 91 return false; \ 92 } \ 93 ++i; 94 95 96 #define SKIP_SPACE \ 97 while (i < n && src[i] == ' ') \ 98 ++i; 99 100 int i = *pos; 101 int j = i; 102 103 // assume "<@" has been parsed outside 104 //SKIP_CHAR('<'); 105 //SKIP_CHAR('@'); 106 107 if (tag != QStringRef(&src, i, tag.length())) { 108 if (0 && debug) 109 qDebug() << "tag " << tag << " not found at " << i; 110 return false; 111 } 112 113 if (debug) 114 qDebug() << "haystack:" << src << "needle:" << tag << "i:" <<i; 115 116 // skip tag 117 i += tag.length(); 118 119 // parse stuff like: linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); 120 if (par1) { 121 SKIP_SPACE; 122 // read parameter name 123 j = i; 124 while (i < n && src[i].isLetter()) 125 ++i; 126 if (src[i] == '=') { 127 if (debug) 128 qDebug() << "read parameter" << QString(src.data() + j, i - j); 129 SKIP_CHAR('='); 130 SKIP_CHAR('"'); 131 // skip parameter name 132 j = i; 133 while (i < n && src[i] != '"') 134 ++i; 135 *par1 = QStringRef(&src, j, i - j); 136 SKIP_CHAR('"'); 137 SKIP_SPACE; 138 } else { 139 if (debug) 140 qDebug() << "no optional parameter found"; 141 } 142 } 143 SKIP_SPACE; 144 SKIP_CHAR('>'); 145 146 // find contents up to closing "</@tag> 147 j = i; 148 for (; true; ++i) { 149 if (i + 4 + tag.length() > n) 150 return false; 151 if (src[i] != '<') 152 continue; 153 if (src[i + 1] != '/') 154 continue; 155 if (src[i + 2] != '@') 156 continue; 157 if (tag != QStringRef(&src, i + 3, tag.length())) 158 continue; 159 if (src[i + 3 + tag.length()] != '>') 160 continue; 161 break; 162 } 163 164 *contents = QStringRef(&src, j, i - j); 165 166 i += tag.length() + 4; 167 168 *pos = i; 169 if (debug) 170 qDebug() << " tag " << tag << " found: pos now: " << i; 171 return true; 172 #undef SKIP_CHAR 173 } 174 72 175 /*! 73 176 This function is recursive. … … 78 181 } 79 182 80 QString PageGenerator::fileBase(const Node *node) 183 QString PageGenerator::fileBase(const Node *node) const 81 184 { 82 185 if (node->relates()) … … 105 208 files. 106 209 */ 107 if (p->subType() == Node::QmlClass) { 108 base.prepend("qml-"); 210 if ((p->subType() == Node::QmlClass) || 211 (p->subType() == Node::QmlBasicType)) { 212 if (!base.startsWith(QLatin1String("QML:"))) 213 base.prepend("qml-"); 109 214 } 110 215 #endif … … 153 258 } 154 259 155 QString PageGenerator::fileName(const Node *node) 260 QString PageGenerator::fileName(const Node *node) const 156 261 { 157 262 if (!node->url().isEmpty()) … … 177 282 .arg(outFile->fileName())); 178 283 QTextStream *out = new QTextStream(outFile); 179 out->setCodec( "ISO-8859-1");284 out->setCodec(outputCodec); 180 285 outStreamStack.push(out); 181 286 } … … 196 301 Recursive writing of html files from the root \a node. 197 302 */ 198 void PageGenerator::generateInnerNode(const InnerNode *node,199 CodeMarker *marker)303 void 304 PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) 200 305 { 201 306 if (!node->url().isNull()) … … 206 311 if (fakeNode->subType() == Node::ExternalPage) 207 312 return; 208 #ifdef QDOC_QML 313 if (fakeNode->subType() == Node::Image) 314 return; 209 315 if (fakeNode->subType() == Node::QmlPropertyGroup) 210 316 return; 211 #endif 317 if (fakeNode->subType() == Node::Page) { 318 if (node->count() > 0) 319 qDebug("PAGE %s HAS CHILDREN", qPrintable(fakeNode->title())); 320 } 212 321 } 213 322
Note:
See TracChangeset
for help on using the changeset viewer.