diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/generator.cpp | 10 | ||||
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 2 | ||||
-rw-r--r-- | src/tools/qdoc/cppcodemarker.cpp | 14 | ||||
-rw-r--r-- | src/tools/qdoc/cppcodeparser.cpp | 24 | ||||
-rw-r--r-- | src/tools/qdoc/ditaxmlgenerator.cpp | 364 | ||||
-rw-r--r-- | src/tools/qdoc/ditaxmlgenerator.h | 1 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-manual.qdoc | 7 | ||||
-rw-r--r-- | src/tools/qdoc/generator.cpp | 2 | ||||
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 38 | ||||
-rw-r--r-- | src/tools/qdoc/main.cpp | 4 | ||||
-rw-r--r-- | src/tools/qdoc/node.cpp | 154 | ||||
-rw-r--r-- | src/tools/qdoc/node.h | 80 |
12 files changed, 360 insertions, 340 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index cc66ca9963..74cdc5874c 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -1213,8 +1213,14 @@ void Generator::generateSignal(FunctionDef *def,int index) fprintf(out, "%s _t%d%s", a.type.name.constData(), offset++, a.rightType.constData()); } fprintf(out, ")%s\n{\n", constQualifier); - if (def->type.name.size() && def->normalizedType != "void") - fprintf(out, " %s _t0 = %s();\n", noRef(def->normalizedType).constData(), noRef(def->normalizedType).constData()); + if (def->type.name.size() && def->normalizedType != "void") { + QByteArray returnType = noRef(def->normalizedType); + if (returnType.endsWith('*')) { + fprintf(out, " %s _t0 = 0;\n", returnType.constData()); + } else { + fprintf(out, " %s _t0 = %s();\n", returnType.constData(), returnType.constData()); + } + } fprintf(out, " void *_a[] = { "); if (def->normalizedType == "void") { diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 696b32c728..d88c9f2950 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -915,6 +915,8 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed) case PP_ENDIF: until(PP_NEWLINE); continue; + case PP_NEWLINE: + continue; case SIGNALS: case SLOTS: { Symbol sym = symbol(); diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index aea8ed2119..165a235a86 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -1258,8 +1258,20 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, NodeList::ConstIterator c = qcn->childNodes().begin(); while (c != qcn->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { + bool attached = false; const QmlPropGroupNode* pgn = static_cast<const QmlPropGroupNode*>(*c); - if (pgn->isAttached()) + NodeList::ConstIterator C = pgn->childNodes().begin(); + while (C != pgn->childNodes().end()) { + if ((*C)->type() == Node::QmlProperty) { + const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(*C); + if (pn->isAttached()) { + attached = true; + break; + } + } + ++C; + } + if (attached) insert(qmlattachedproperties,*c,style,Okay); else insert(qmlproperties,*c,style,Okay); diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index b08c6f901c..d8367b3e09 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -689,9 +689,11 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, return node; } else if (command == COMMAND_EXAMPLE) { - ExampleNode* en = new ExampleNode(tree_->root(), arg); - createExampleFileNodes(en); - return en; + if (Config::generateExamples) { + ExampleNode* en = new ExampleNode(tree_->root(), arg); + createExampleFileNodes(en); + return en; + } } else if (command == COMMAND_EXTERNALPAGE) { return new FakeNode(tree_->root(), arg, Node::ExternalPage, Node::ArticlePage); @@ -937,7 +939,7 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, if (splitQmlPropertyArg(doc,(*arg),type,module,element,property)) { QmlClassNode* qmlClass = tree_->findQmlClassNode(module,element); if (qmlClass) { - qmlPropGroup = new QmlPropGroupNode(qmlClass,property,attached); + qmlPropGroup = new QmlPropGroupNode(qmlClass,property); //,attached); } } if (qmlPropGroup) { @@ -950,7 +952,7 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, } if (correspondingProperty) { bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); - qmlPropNode->setWritable(writableList || correspondingProperty->isWritable()); + qmlPropNode->setReadOnly(!(writableList || correspondingProperty->isWritable())); } ++arg; while (arg != args.end()) { @@ -961,7 +963,7 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, attached); if (correspondingProperty) { bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); - qmlPropNode->setWritable(writableList || correspondingProperty->isWritable()); + qmlPropNode->setReadOnly(!(writableList || correspondingProperty->isWritable())); } } ++arg; @@ -1117,7 +1119,14 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, } else if (node->type() == Node::Fake && node->subType() == Node::QmlPropertyGroup) { QmlPropGroupNode* qpgn = static_cast<QmlPropGroupNode*>(node); - qpgn->setDefault(); + NodeList::ConstIterator p = qpgn->childNodes().begin(); + while (p != qpgn->childNodes().end()) { + if ((*p)->type() == Node::QmlProperty) { + QmlPropertyNode* qpn = static_cast<QmlPropertyNode*>(*p); + qpn->setDefault(); + } + ++p; + } } } else if (command == COMMAND_QMLREADONLY) { @@ -1127,7 +1136,6 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, } else if (node->type() == Node::Fake && node->subType() == Node::QmlPropertyGroup) { QmlPropGroupNode* qpgn = static_cast<QmlPropGroupNode*>(node); - qpgn->setReadOnly(1); NodeList::ConstIterator p = qpgn->childNodes().begin(); while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 3f1e8c02e9..1f986e35ff 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -249,6 +249,14 @@ QString DitaXmlGenerator::ditaTags[] = "" }; +void DitaXmlGenerator::debugPara(const QString& t) +{ + writeStartTag(DT_p); + xmlWriter().writeAttribute("outputclass",t); + xmlWriter().writeCharacters(t); + writeEndTag(); // </p> +} + static bool showBrokenLinks = false; /*! @@ -693,6 +701,13 @@ 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; @@ -721,6 +736,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, { Node::Type t = relative->type(); if (inSection()) { + in_para = true; writeStartTag(DT_p); xmlWriter().writeAttribute("outputclass","brief"); } @@ -756,6 +772,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::BriefRight: // if (relative->type() != Node::Fake) writeEndTag(); // </shortdesc> or </p> + if (in_para) + in_para = false; noLinks = false; break; case Atom::C: @@ -769,13 +787,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writeEndTag(); // see writeStartElement() above break; case Atom::Code: - { - writeStartTag(DT_codeblock); - xmlWriter().writeAttribute("outputclass","cpp"); - QString chars = trimmedTrailing(atom->string()); - writeText(chars, marker, relative); - writeEndTag(); // </codeblock> - } + { + writeStartTag(DT_codeblock); + xmlWriter().writeAttribute("outputclass","cpp"); + QString chars = trimmedTrailing(atom->string()); + writeText(chars, marker, relative); + writeEndTag(); // </codeblock> + } break; case Atom::Qml: writeStartTag(DT_codeblock); @@ -866,71 +884,71 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::FormatIf: break; case Atom::FormattingLeft: - { - DitaTag t = DT_LAST; - if (atom->string() == ATOM_FORMATTING_BOLD) - t = DT_b; - else if (atom->string() == ATOM_FORMATTING_PARAMETER) - t = DT_i; - else if (atom->string() == ATOM_FORMATTING_ITALIC) - t = DT_i; - else if (atom->string() == ATOM_FORMATTING_TELETYPE) - t = DT_tt; - else if (atom->string().startsWith("span ")) { - t = DT_keyword; - } - else if (atom->string() == ATOM_FORMATTING_UICONTROL) - t = DT_uicontrol; - else if (atom->string() == ATOM_FORMATTING_UNDERLINE) - t = DT_u; - else if (atom->string() == ATOM_FORMATTING_INDEX) - t = DT_comment; - else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) - t = DT_sub; - else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) - t = DT_sup; - else - qDebug() << "DT_LAST"; - writeStartTag(t); - if (atom->string() == ATOM_FORMATTING_PARAMETER) { - if (atom->next() != 0 && atom->next()->type() == Atom::String) { - QRegExp subscriptRegExp("([a-z]+)_([0-9n])"); - if (subscriptRegExp.exactMatch(atom->next()->string())) { - xmlWriter().writeCharacters(subscriptRegExp.cap(1)); - writeStartTag(DT_sub); - xmlWriter().writeCharacters(subscriptRegExp.cap(2)); - writeEndTag(); // </sub> - skipAhead = 1; + { + DitaTag t = DT_LAST; + if (atom->string() == ATOM_FORMATTING_BOLD) + t = DT_b; + else if (atom->string() == ATOM_FORMATTING_PARAMETER) + t = DT_i; + else if (atom->string() == ATOM_FORMATTING_ITALIC) + t = DT_i; + else if (atom->string() == ATOM_FORMATTING_TELETYPE) + t = DT_tt; + else if (atom->string().startsWith("span ")) { + t = DT_keyword; + } + else if (atom->string() == ATOM_FORMATTING_UICONTROL) + t = DT_uicontrol; + else if (atom->string() == ATOM_FORMATTING_UNDERLINE) + t = DT_u; + else if (atom->string() == ATOM_FORMATTING_INDEX) + t = DT_comment; + else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) + t = DT_sub; + else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) + t = DT_sup; + else + qDebug() << "DT_LAST"; + writeStartTag(t); + if (atom->string() == ATOM_FORMATTING_PARAMETER) { + if (atom->next() != 0 && atom->next()->type() == Atom::String) { + QRegExp subscriptRegExp("([a-z]+)_([0-9n])"); + if (subscriptRegExp.exactMatch(atom->next()->string())) { + xmlWriter().writeCharacters(subscriptRegExp.cap(1)); + writeStartTag(DT_sub); + xmlWriter().writeCharacters(subscriptRegExp.cap(2)); + writeEndTag(); // </sub> + skipAhead = 1; + } } } - } - else if (t == DT_keyword) { - QString attr = atom->string().mid(5); - if (!attr.isEmpty()) { - if (attr.contains('=')) { - int index = 0; - int from = 0; - QString values; - while (index >= 0) { - index = attr.indexOf('"',from); - if (index >= 0) { - ++index; - from = index; + else if (t == DT_keyword) { + QString attr = atom->string().mid(5); + if (!attr.isEmpty()) { + if (attr.contains('=')) { + int index = 0; + int from = 0; + QString values; + while (index >= 0) { index = attr.indexOf('"',from); - if (index > from) { - if (!values.isEmpty()) - values.append(' '); - values += attr.mid(from,index-from); - from = index+1; + if (index >= 0) { + ++index; + from = index; + index = attr.indexOf('"',from); + if (index > from) { + if (!values.isEmpty()) + values.append(' '); + values += attr.mid(from,index-from); + from = index+1; + } } } + attr = values; } - attr = values; } + xmlWriter().writeAttribute("outputclass", attr); } - xmlWriter().writeAttribute("outputclass", attr); } - } break; case Atom::FormattingRight: if (atom->string() == ATOM_FORMATTING_LINK) { @@ -941,17 +959,17 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::AnnotatedList: - { - QList<Node*> values = tree_->groups().values(atom->string()); - NodeMap nodeMap; - for (int i = 0; i < values.size(); ++i) { - const Node* n = values.at(i); - if ((n->status() != Node::Internal) && (n->access() != Node::Private)) { - nodeMap.insert(n->nameForLists(),n); + { + QList<Node*> values = tree_->groups().values(atom->string()); + NodeMap nodeMap; + for (int i = 0; i < values.size(); ++i) { + const Node* n = values.at(i); + if ((n->status() != Node::Internal) && (n->access() != Node::Private)) { + nodeMap.insert(n->nameForLists(),n); + } } + generateAnnotatedList(relative, marker, nodeMap); } - generateAnnotatedList(relative, marker, nodeMap); - } break; case Atom::GeneratedList: if (atom->string() == "annotatedclasses") { @@ -1206,6 +1224,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (fileName.isEmpty()) { + relative->location().warning(tr("Missing image: %1").arg(protectEnc(atom->string()))); QString images = "images"; if (!baseDir().isEmpty()) images.prepend("../"); @@ -1269,34 +1288,34 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, //xmlWriter().writeEmptyElement("br"); break; case Atom::Link: - { - const Node *node = 0; - QString myLink = getLink(atom, relative, marker, &node); - if (myLink.isEmpty()) { - myLink = getCollisionLink(atom); - } - if (myLink.isEmpty()) { - relative->doc().location().warning(tr("Can't link to '%1'") - .arg(atom->string())); - } - else if (!inSectionHeading) { - beginLink(myLink); + { + const Node *node = 0; + QString myLink = getLink(atom, relative, marker, &node); + if (myLink.isEmpty()) { + myLink = getCollisionLink(atom); + } + if (myLink.isEmpty()) { + relative->doc().location().warning(tr("Can't link to '%1'") + .arg(atom->string())); + } + else if (!inSectionHeading) { + beginLink(myLink); + } + skipAhead = 1; } - skipAhead = 1; - } break; case Atom::GuidLink: - { - beginLink(atom->string()); - skipAhead = 1; - } + { + beginLink(atom->string()); + skipAhead = 1; + } break; case Atom::LinkNode: - { - const Node* node = CodeMarker::nodeForString(atom->string()); - beginLink(linkForNode(node, relative)); - skipAhead = 1; - } + { + const Node* node = CodeMarker::nodeForString(atom->string()); + beginLink(linkForNode(node, relative)); + skipAhead = 1; + } break; case Atom::ListLeft: if (in_para) { @@ -1352,8 +1371,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, else // (atom->string() == ATOM_LIST_NUMERIC) xmlWriter().writeAttribute("outputclass","numeric"); if (atom->next() != 0 && atom->next()->string().toInt() != 1) { - // I don't think this attribute is supported. - xmlWriter().writeAttribute("start",atom->next()->string()); + /* + This attribute is not supported in DITA, and at the + moment, including it is causing a validation error + wherever it is used. I think it is onlym used in the + qdoc manual. + */ + //xmlWriter().writeAttribute("start",atom->next()->string()); } } break; @@ -1628,47 +1652,48 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writeEndTag(); // </row> break; case Atom::TableItemLeft: - { - QString values; - writeStartTag(DT_entry); - for (int i=0; i<atom->count(); ++i) { - attr = atom->string(i); - if (attr.contains('=')) { - int index = 0; - int from = 0; - while (index >= 0) { - index = attr.indexOf('"',from); - if (index >= 0) { - ++index; - from = index; + { + QString values; + writeStartTag(DT_entry); + for (int i=0; i<atom->count(); ++i) { + attr = atom->string(i); + if (attr.contains('=')) { + int index = 0; + int from = 0; + while (index >= 0) { index = attr.indexOf('"',from); - if (index > from) { - if (!values.isEmpty()) - values.append(' '); - values += attr.mid(from,index-from); - from = index+1; + if (index >= 0) { + ++index; + from = index; + index = attr.indexOf('"',from); + if (index > from) { + if (!values.isEmpty()) + values.append(' '); + values += attr.mid(from,index-from); + from = index+1; + } } } } - } - else { - QStringList spans = attr.split(QLatin1Char(',')); - if (spans.size() == 2) { - if ((spans[0].toInt()>1) || (spans[1].toInt()>1)) { - values += "span(" + spans[0] + QLatin1Char(',') + spans[1] + QLatin1Char(')'); + else { + QStringList spans = attr.split(QLatin1Char(',')); + if (spans.size() == 2) { + if ((spans[0].toInt()>1) || (spans[1].toInt()>1)) { + values += "span(" + spans[0] + QLatin1Char(',') + spans[1] + QLatin1Char(')'); + } } } } + if (!values.isEmpty()) + xmlWriter().writeAttribute("outputclass",values); + if (matchAhead(atom, Atom::ParaLeft)) + skipAhead = 1; } - if (!values.isEmpty()) - xmlWriter().writeAttribute("outputclass",values); - if (matchAhead(atom, Atom::ParaLeft)) - skipAhead = 1; - } break; case Atom::TableItemRight: - if (inTableHeader) + if (inTableHeader) { writeEndTag(); // </entry> + } else { writeEndTag(); // </entry> } @@ -1676,33 +1701,33 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = 1; break; case Atom::TableOfContents: - { - int numColumns = 1; - const Node* node = relative; + { + int numColumns = 1; + const Node* node = relative; - Doc::Sections sectionUnit = Doc::Section4; - QStringList params = atom->string().split(QLatin1Char(',')); - QString columnText = params.at(0); - QStringList pieces = columnText.split(QLatin1Char(' '), QString::SkipEmptyParts); - if (pieces.size() >= 2) { - columnText = pieces.at(0); - pieces.pop_front(); - QString path = pieces.join(" ").trimmed(); - node = findNodeForTarget(path, relative, marker, atom); - } + Doc::Sections sectionUnit = Doc::Section4; + QStringList params = atom->string().split(QLatin1Char(',')); + QString columnText = params.at(0); + QStringList pieces = columnText.split(QLatin1Char(' '), QString::SkipEmptyParts); + if (pieces.size() >= 2) { + columnText = pieces.at(0); + pieces.pop_front(); + QString path = pieces.join(" ").trimmed(); + node = findNodeForTarget(path, relative, marker, atom); + } - if (params.size() == 2) { - numColumns = qMax(columnText.toInt(), numColumns); - sectionUnit = (Doc::Sections)params.at(1).toInt(); - } + if (params.size() == 2) { + numColumns = qMax(columnText.toInt(), numColumns); + sectionUnit = (Doc::Sections)params.at(1).toInt(); + } - if (node) - generateTableOfContents(node, - marker, - sectionUnit, - numColumns, - relative); - } + if (node) + generateTableOfContents(node, + marker, + sectionUnit, + numColumns, + relative); + } break; case Atom::Target: if (in_para) { @@ -2277,7 +2302,7 @@ void DitaXmlGenerator::generateFakeNode(FakeNode* fake, CodeMarker* marker) writeProlog(fake); writeStartTag(DT_body); - enterSection(QString(),QString()); + enterSection("",""); if (fake->subType() == Node::Module) { generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { @@ -4420,14 +4445,11 @@ void DitaXmlGenerator::generateDetailedQmlMember(Node* node, writeStartTag(DT_li); writeGuidAttribute((Node*)qpn); QString attr; - int ro = qpn->getReadOnly(); - if (ro < 0) { - if (!qpn->isWritable(tree_)) - attr = "read-only"; - } - else if (ro > 0) + if (!qpn->isReadOnlySet()) + qpn->setReadOnly(!qpn->isWritable(tree_)); + if (qpn->isReadOnly()) attr = "read-only"; - if (qpgn->isDefault()) { + if (qpn->isDefault()) { if (!attr.isEmpty()) attr += QLatin1Char(' '); attr += "default"; @@ -4462,13 +4484,11 @@ void DitaXmlGenerator::generateDetailedQmlMember(Node* node, writeStartTag(DT_li); writeGuidAttribute((Node*)qpn); QString attr; - int ro = qpn->getReadOnly(); - if (ro < 0) { - const ClassNode* cn = qpn->declarativeCppNode(); - if (cn && !qpn->isWritable(tree_)) - attr = "read-only"; + if (!qpn->isReadOnlySet()) { + if (qpn->declarativeCppNode()) + qpn->setReadOnly(!qpn->isWritable(tree_)); } - else if (ro > 0) + if (qpn->isReadOnly()) attr = "read-only"; if (qpn->isDefault()) { if (!attr.isEmpty()) @@ -4495,12 +4515,9 @@ void DitaXmlGenerator::generateDetailedQmlMember(Node* node, writeStartTag(DT_li); writeGuidAttribute((Node*)q); QString attr; - int ro = qpn->getReadOnly(); - if (ro < 0) { - if (!qpn->isWritable(tree_)) - attr = "read-only"; - } - else if (ro > 0) + if (!qpn->isReadOnlySet()) + qpn->setReadOnly(!qpn->isWritable(tree_)); + if (qpn->isReadOnly()) attr = "read-only"; if (qpn->isDefault()) { if (!attr.isEmpty()) @@ -6000,9 +6017,10 @@ void DitaXmlGenerator::writeTopicrefs(NodeMultiMap* nmm, const QString& navtitle for (int count = 0; count < dmNode->map().count(); count++) { if (dmNode->map().at(count)->navtitle() == i.key()) { foundInDitaMap = true; + break; } - ++mapIterator; } + ++mapIterator; } if (!foundInDitaMap) { writeStartTag(DT_topicref); @@ -6418,7 +6436,7 @@ void DitaXmlGenerator::generateCollisionPages() generateHeader(ncn, ditaTitle); writeProlog(ncn); writeStartTag(DT_body); - enterSection(QString(),QString()); + enterSection("",""); NodeMap nm; for (int i=0; i<collisions.size(); ++i) { diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h index 6eea6dc063..6ce42fc0b1 100644 --- a/src/tools/qdoc/ditaxmlgenerator.h +++ b/src/tools/qdoc/ditaxmlgenerator.h @@ -457,6 +457,7 @@ private: void writeDitaRefs(const DitaRefList& ditarefs); void writeTopicrefs(NodeMultiMap* nmm, const QString& navtitle); bool isDuplicate(NodeMultiMap* nmm, const QString& key, Node* node); + void debugPara(const QString& t); private: /* diff --git a/src/tools/qdoc/doc/qdoc-manual.qdoc b/src/tools/qdoc/doc/qdoc-manual.qdoc index 29147494fa..fa3301e072 100644 --- a/src/tools/qdoc/doc/qdoc-manual.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual.qdoc @@ -2973,6 +2973,13 @@ * / \endcode + \note This doesn't work in DITA XML, so don't use it because it + produces a DITA XML file that doesn't validate. There probably is + a way to do this in DITA, so if we figure it out, we will put it + in. But this capability is not used anywhere other than right + here, so it probably isn't important. For now, if you use this + option, qdoc will ignore it and produce a list without it. + QDoc renders this as: \list G diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 8cda8b7667..4258bc69d0 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -611,6 +611,8 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) node->doc().location().warning( tr("No such enum item '%1' in %2").arg(*a).arg(marker->plainFullName(node)), details); + if (*a == "Void") + qDebug() << "VOID:" << node->name() << definedItems; } else if (!documentedItems.contains(*a)) { node->doc().location().warning( diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 9434ced42f..24dd31e0b5 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -775,6 +775,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (atom->type() == Atom::Image) out() << "<p class=\"centerAlign\">"; if (fileName.isEmpty()) { + relative->location().warning(tr("Missing image: %1").arg(protectEnc(atom->string()))); out() << "<font color=\"red\">[Missing image " << protectEnc(atom->string()) << "]</font>"; } @@ -4072,16 +4073,11 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, out() << "<td class=\"tblQmlPropNode\"><p>"; out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; - int ro = qpn->getReadOnly(); - if (ro < 0) { - if (!qpn->isWritable(tree_)) { - out() << "<span class=\"qmlreadonly\">read-only</span>"; - } - } - else if (ro > 0) { + if (!qpn->isReadOnlySet()) + qpn->setReadOnly(!qpn->isWritable(tree_)); + if (qpn->isReadOnly()) out() << "<span class=\"qmlreadonly\">read-only</span>"; - } - if (qpgn->isDefault()) + if (qpn->isDefault()) out() << "<span class=\"qmldefault\">default</span>"; generateQmlItem(qpn, relative, marker, false); out() << "</p></td></tr>"; @@ -4113,16 +4109,12 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, out() << "<tr valign=\"top\" class=\"odd\">"; out() << "<td class=\"tblQmlPropNode\"><p>"; out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; - int ro = qpn->getReadOnly(); - if (ro < 0) { - const ClassNode* cn = qpn->declarativeCppNode(); - if (cn && !qpn->isWritable(tree_)) { - out() << "<span class=\"qmlreadonly\">read-only</span>"; - } + if (!qpn->isReadOnlySet()) { + if (qpn->declarativeCppNode()) + qpn->setReadOnly(!qpn->isWritable(tree_)); } - else if (ro > 0) { + if (qpn->isReadOnly()) out() << "<span class=\"qmlreadonly\">read-only</span>"; - } if (qpn->isDefault()) out() << "<span class=\"qmldefault\">default</span>"; generateQmlItem(qpn, relative, marker, false); @@ -4145,16 +4137,10 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, out() << "<tr valign=\"top\" class=\"odd\">"; out() << "<td class=\"tblQmlPropNode\"><p>"; out() << "<a name=\"" + refForNode(q) + "\"></a>"; - - int ro = qpn->getReadOnly(); - if (ro < 0) { - if (!qpn->isWritable(tree_)) { - out() << "<span class=\"qmlreadonly\">read-only</span>"; - } - } - else if (ro > 0) { + if (!qpn->isReadOnlySet()) + qpn->setReadOnly(!qpn->isWritable(tree_)); + if (qpn->isReadOnly()) out() << "<span class=\"qmlreadonly\">read-only</span>"; - } if (qpn->isDefault()) out() << "<span class=\"qmldefault\">default</span>"; generateQmlItem(q, relative, marker, false); diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index de268e1177..f7985bd389 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -115,13 +115,13 @@ static void printHelp() " -highlighting " "Turn on syntax highlighting (makes qdoc run slower)\n" " -no-examples " - "Do not generate documentation for examples" + "Do not generate documentation for examples\n" " -obsoletelinks " "Report links from obsolete items to non-obsolete items\n" " -outputdir " "Specify output directory, overrides setting in qdocconf file\n" " -outputformat " - "Specify output format, overrides setting in qdocconf file" + "Specify output format, overrides setting in qdocconf file\n" " -showinternal " "Include content marked internal\n" " -version " diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index 703c073554..24c0006dae 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -327,6 +327,38 @@ void Node::setPageType(const QString& t) pageType_ = DitaMapPage; } +/*! Converts the boolean value \a b to an enum representation + of the boolean type, which includes an enum value for the + \e {default value} of the item, i.e. true, false, or default. + */ +Node::FlagValue Node::toFlagValue(bool b) +{ + return b ? FlagValueTrue : FlagValueFalse; +} + +/*! + Converts the enum \a fv back to a boolean value. + If \a fv is neither the true enum value nor the + false enum value, the boolean value returned is + \a defaultValue. + + Note that runtimeDesignabilityFunction() should be called + first. If that function returns the name of a function, it + means the function must be called at runtime to determine + whether the property is Designable. + */ +bool Node::fromFlagValue(FlagValue fv, bool defaultValue) +{ + switch (fv) { + case FlagValueTrue: + return true; + case FlagValueFalse: + return false; + default: + return defaultValue; + } +} + /*! Sets the pointer to the node that this node relates to. */ @@ -1876,11 +1908,11 @@ void FunctionNode::debug() const */ PropertyNode::PropertyNode(InnerNode *parent, const QString& name) : LeafNode(Property, parent, name), - sto(Trool_Default), - des(Trool_Default), - scr(Trool_Default), - wri(Trool_Default), - usr(Trool_Default), + stored_(FlagValueDefault), + designable_(FlagValueDefault), + scriptable_(FlagValueDefault), + writable_(FlagValueDefault), + user_(FlagValueDefault), cst(false), fnl(false), rev(-1), @@ -1905,16 +1937,16 @@ void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty) if (funcs[i].isEmpty()) funcs[i] = baseProperty->funcs[i]; } - if (sto == Trool_Default) - sto = baseProperty->sto; - if (des == Trool_Default) - des = baseProperty->des; - if (scr == Trool_Default) - scr = baseProperty->scr; - if (wri == Trool_Default) - wri = baseProperty->wri; - if (usr == Trool_Default) - usr = baseProperty->usr; + if (stored_ == FlagValueDefault) + stored_ = baseProperty->stored_; + if (designable_ == FlagValueDefault) + designable_ = baseProperty->designable_; + if (scriptable_ == FlagValueDefault) + scriptable_ = baseProperty->scriptable_; + if (writable_ == FlagValueDefault) + writable_ = baseProperty->writable_; + if (user_ == FlagValueDefault) + user_ = baseProperty->user_; overrides = baseProperty; } @@ -1940,38 +1972,6 @@ QString PropertyNode::qualifiedDataType() const } } -/*! Converts the \a boolean value to an enum representation - of the boolean type, which includes an enum value for the - \e {default value} of the item, i.e. true, false, or default. - */ -PropertyNode::Trool PropertyNode::toTrool(bool boolean) -{ - return boolean ? Trool_True : Trool_False; -} - -/*! - Converts the enum \a troolean back to a boolean value. - If \a troolean is neither the true enum value nor the - false enum value, the boolean value returned is - \a defaultValue. - - Note that runtimeDesignabilityFunction() should be called - first. If that function returns the name of a function, it - means the function must be called at runtime to determine - whether the property is Designable. - */ -bool PropertyNode::fromTrool(Trool troolean, bool defaultValue) -{ - switch (troolean) { - case Trool_True: - return true; - case Trool_False: - return false; - default: - return defaultValue; - } -} - bool QmlClassNode::qmlOnly = false; QMultiMap<QString,Node*> QmlClassNode::inheritedBy; QMap<QString, QmlClassNode*> QmlClassNode::moduleMap; @@ -2181,13 +2181,14 @@ QmlBasicTypeNode::QmlBasicTypeNode(InnerNode *parent, Constructor for the Qml property group node. \a parent is always a QmlClassNode. */ -QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent, - const QString& name, - bool attached) - : FakeNode(parent, name, QmlPropertyGroup, Node::ApiPage), +QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent, const QString& name) + //bool attached) + : FakeNode(parent, name, QmlPropertyGroup, Node::ApiPage) +#if 0 isdefault_(false), attached_(attached), readOnly_(-1) +#endif { // nothing. } @@ -2207,11 +2208,11 @@ QmlPropertyNode::QmlPropertyNode(QmlPropGroupNode *parent, bool attached) : LeafNode(QmlProperty, parent, name), type_(type), - sto(Trool_Default), - des(Trool_Default), + stored_(FlagValueDefault), + designable_(FlagValueDefault), isdefault_(false), attached_(attached), - readOnly_(-1) + readOnly_(FlagValueDefault) { setPageType(ApiPage); } @@ -2226,11 +2227,11 @@ QmlPropertyNode::QmlPropertyNode(QmlClassNode *parent, bool attached) : LeafNode(QmlProperty, parent, name), type_(type), - sto(Trool_Default), - des(Trool_Default), + stored_(FlagValueDefault), + designable_(FlagValueDefault), isdefault_(false), attached_(attached), - readOnly_(-1) + readOnly_(FlagValueDefault) { setPageType(ApiPage); } @@ -2252,39 +2253,16 @@ QmlPropertyNode::QmlPropertyNode(QmlPropertyNode* parent, bool attached) : LeafNode(parent->parent(), QmlProperty, name), type_(type), - sto(Trool_Default), - des(Trool_Default), + stored_(FlagValueDefault), + designable_(FlagValueDefault), isdefault_(false), attached_(attached), - readOnly_(-1) + readOnly_(FlagValueDefault) { setPageType(ApiPage); } /*! - I don't know what this is. - */ -QmlPropertyNode::Trool QmlPropertyNode::toTrool(bool boolean) -{ - return boolean ? Trool_True : Trool_False; -} - -/*! - I don't know what this is either. - */ -bool QmlPropertyNode::fromTrool(Trool troolean, bool defaultValue) -{ - switch (troolean) { - case Trool_True: - return true; - case Trool_False: - return false; - default: - return defaultValue; - } -} - -/*! Returns true if a QML property or attached property is read-only. The algorithm for figuring this out is long amd tedious and almost certainly will break. It currently @@ -2293,14 +2271,16 @@ bool QmlPropertyNode::fromTrool(Trool troolean, bool defaultValue) */ bool QmlPropertyNode::isWritable(Tree* tree) { - if (wri != Trool_Default) - return fromTrool(wri, false); + if (readOnly_ != FlagValueDefault) { + return !fromFlagValue(readOnly_, false); + } PropertyNode* pn = correspondingProperty(tree); - if (pn) + if (pn) { return pn->isWritable(); + } else { - location().warning(tr("Can't determine read-only status of QML property %1; writable assumed.").arg(name())); + location().warning(tr("Can't detect if QML property %1 is read-only; writable assumed.").arg(name())); return true; } } diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index cfd446dd89..45b5ded640 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -156,6 +156,12 @@ public: OnBeyondZebra }; + enum FlagValue { + FlagValueDefault = -1, + FlagValueFalse = 0, + FlagValueTrue = 1 + }; + virtual ~Node(); void setAccess(Access access) { access_ = access; } @@ -239,6 +245,9 @@ public: static QString cleanId(QString str); QString idForNode() const; + static FlagValue toFlagValue(bool b); + static bool fromFlagValue(FlagValue fv, bool defaultValue); + static QString pageTypeString(unsigned t); static QString nodeTypeString(unsigned t); static QString nodeSubtypeString(unsigned t); @@ -553,9 +562,8 @@ public: class QmlPropGroupNode : public FakeNode { public: - QmlPropGroupNode(QmlClassNode* parent, - const QString& name, - bool attached); + QmlPropGroupNode(QmlClassNode* parent, const QString& name); + //bool attached); virtual ~QmlPropGroupNode() { } virtual bool isQmlNode() const { return true; } virtual bool isQtQuickNode() const { return parent()->isQtQuickNode(); } @@ -564,6 +572,7 @@ public: virtual QString qmlModuleIdentifier() const { return parent()->qmlModuleIdentifier(); } const QString& element() const { return parent()->name(); } +#if 0 void setDefault() { isdefault_ = true; } void setReadOnly(int ro) { readOnly_ = ro; } int getReadOnly() const { return readOnly_; } @@ -575,6 +584,7 @@ private: bool isdefault_; bool attached_; int readOnly_; +#endif }; class QmlPropertyNode; @@ -597,21 +607,20 @@ public: virtual ~QmlPropertyNode() { } void setDataType(const QString& dataType) { type_ = dataType; } - void setStored(bool stored) { sto = toTrool(stored); } - void setDesignable(bool designable) { des = toTrool(designable); } - void setWritable(bool writable) { wri = toTrool(writable); } + void setStored(bool stored) { stored_ = toFlagValue(stored); } + void setDesignable(bool designable) { designable_ = toFlagValue(designable); } + void setReadOnly(bool ro) { readOnly_ = toFlagValue(ro); } + void setDefault() { isdefault_ = true; } const QString &dataType() const { return type_; } QString qualifiedDataType() const { return type_; } - void setDefault() { isdefault_ = true; } - void setReadOnly(int ro) { readOnly_ = ro; } - int getReadOnly() const { return readOnly_; } + bool isReadOnlySet() const { return (readOnly_ != FlagValueDefault); } bool isDefault() const { return isdefault_; } - bool isStored() const { return fromTrool(sto,true); } - bool isDesignable() const { return fromTrool(des,false); } + bool isStored() const { return fromFlagValue(stored_,true); } + bool isDesignable() const { return fromFlagValue(designable_,false); } bool isWritable(Tree* tree); bool isAttached() const { return attached_; } - bool isReadOnly() const { return (readOnly_ > 0); } + bool isReadOnly() const { return fromFlagValue(readOnly_,false); } virtual bool isQmlNode() const { return true; } virtual bool isQtQuickNode() const { return parent()->isQtQuickNode(); } virtual QString qmlModuleName() const { return parent()->qmlModuleName(); } @@ -625,18 +634,12 @@ public: const NodeList& qmlPropNodes() const { return qmlPropNodes_; } private: - enum Trool { Trool_True, Trool_False, Trool_Default }; - - static Trool toTrool(bool boolean); - static bool fromTrool(Trool troolean, bool defaultValue); - QString type_; - Trool sto; - Trool des; - Trool wri; + FlagValue stored_; + FlagValue designable_; bool isdefault_; bool attached_; - int readOnly_; + FlagValue readOnly_; NodeList qmlPropNodes_; }; @@ -842,11 +845,11 @@ public: void setDataType(const QString& dataType) { type_ = dataType; } void addFunction(FunctionNode* function, FunctionRole role); void addSignal(FunctionNode* function, FunctionRole role); - void setStored(bool stored) { sto = toTrool(stored); } - void setDesignable(bool designable) { des = toTrool(designable); } - void setScriptable(bool scriptable) { scr = toTrool(scriptable); } - void setWritable(bool writable) { wri = toTrool(writable); } - void setUser(bool user) { usr = toTrool(user); } + void setStored(bool stored) { stored_ = toFlagValue(stored); } + void setDesignable(bool designable) { designable_ = toFlagValue(designable); } + void setScriptable(bool scriptable) { scriptable_ = toFlagValue(scriptable); } + void setWritable(bool writable) { writable_ = toFlagValue(writable); } + void setUser(bool user) { user_ = toFlagValue(user); } void setOverriddenFrom(const PropertyNode* baseProperty); void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc = rdf; } void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc = scrf; } @@ -862,13 +865,13 @@ public: NodeList setters() const { return functions(Setter); } NodeList resetters() const { return functions(Resetter); } NodeList notifiers() const { return functions(Notifier); } - bool isStored() const { return fromTrool(sto, storedDefault()); } - bool isDesignable() const { return fromTrool(des, designableDefault()); } - bool isScriptable() const { return fromTrool(scr, scriptableDefault()); } + bool isStored() const { return fromFlagValue(stored_, storedDefault()); } + bool isDesignable() const { return fromFlagValue(designable_, designableDefault()); } + bool isScriptable() const { return fromFlagValue(scriptable_, scriptableDefault()); } const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc; } const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc; } - bool isWritable() const { return fromTrool(wri, writableDefault()); } - bool isUser() const { return fromTrool(usr, userDefault()); } + bool isWritable() const { return fromFlagValue(writable_, writableDefault()); } + bool isUser() const { return fromFlagValue(user_, userDefault()); } bool isConstant() const { return cst; } bool isFinal() const { return fnl; } const PropertyNode* overriddenFrom() const { return overrides; } @@ -880,20 +883,15 @@ public: bool writableDefault() const { return !setters().isEmpty(); } private: - enum Trool { Trool_True, Trool_False, Trool_Default }; - - static Trool toTrool(bool boolean); - static bool fromTrool(Trool troolean, bool defaultValue); - QString type_; QString runtimeDesFunc; QString runtimeScrFunc; NodeList funcs[NumFunctionRoles]; - Trool sto; - Trool des; - Trool scr; - Trool wri; - Trool usr; + FlagValue stored_; + FlagValue designable_; + FlagValue scriptable_; + FlagValue writable_; + FlagValue user_; bool cst; bool fnl; int rev; |