summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/htmlgenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/qdoc/htmlgenerator.cpp')
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp128
1 files changed, 77 insertions, 51 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 10b7242c18..3dbb5a589f 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -474,14 +474,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
static bool in_para = false;
switch (atom->type()) {
- case Atom::AbstractLeft:
- if (relative)
- relative->doc().location().warning(tr("\abstract is not implemented."));
- else
- Location::information(tr("\abstract is not implemented."));
- break;
- case Atom::AbstractRight:
- break;
case Atom::AutoLink:
case Atom::NavAutoLink:
if (!inLink_ && !inContents_ && !inSectionHeading_) {
@@ -1336,7 +1328,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
/*!
Generate a reference page for a C++ class or a C++ namespace.
*/
-void HtmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
+void HtmlGenerator::generateClassLikeNode(Aggregate* inner, CodeMarker* marker)
{
QList<Section> sections;
QList<Section>::ConstIterator s;
@@ -1485,7 +1477,7 @@ void HtmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
const FunctionNode *func = reinterpret_cast<const FunctionNode *>(*m);
if (func->metaness() == FunctionNode::Ctor ||
func->metaness() == FunctionNode::Dtor ||
- func->overloadNumber() != 1)
+ func->overloadNumber() != 0)
names.clear();
}
else if ((*m)->type() == Node::Property) {
@@ -1644,7 +1636,7 @@ void HtmlGenerator::generateDocumentNode(DocumentNode* dn, CodeMarker* marker)
is DITA map page, write the node's contents as a dita
map and return without doing anything else.
*/
- if (dn->subType() == Node::Page && dn->pageType() == Node::DitaMapPage) {
+ if (dn->docSubtype() == Node::Page && dn->pageType() == Node::DitaMapPage) {
const DitaMapNode* dmn = static_cast<const DitaMapNode*>(dn);
writeDitaMap(dmn);
return;
@@ -1670,7 +1662,7 @@ void HtmlGenerator::generateDocumentNode(DocumentNode* dn, CodeMarker* marker)
dn,
marker);
- if (dn->subType() == Node::HeaderFile) {
+ if (dn->docSubtype() == Node::HeaderFile) {
// Generate brief text and status for modules.
generateBrief(dn, marker);
generateStatus(dn, marker);
@@ -2087,7 +2079,7 @@ void HtmlGenerator::generateFooter(const Node *node)
Lists the required imports and includes in a table.
The number of rows is known, so this path is simpler than the generateSection() path.
*/
-void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
+void HtmlGenerator::generateRequisites(Aggregate *inner, CodeMarker *marker)
{
QMap<QString, Text> requisites;
Text text;
@@ -2359,7 +2351,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker,
}
}
-void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker)
+void HtmlGenerator::generateIncludes(const Aggregate *inner, CodeMarker *marker)
{
if (!inner->includes().isEmpty()) {
out() << "<pre class=\"cpp\">"
@@ -2518,7 +2510,7 @@ void HtmlGenerator::generateSidebar() {
out() << "</div>\n";
}
-QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner,
+QString HtmlGenerator::generateListOfAllMemberFile(const Aggregate *inner,
CodeMarker *marker)
{
QList<Section> sections;
@@ -2613,7 +2605,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(QmlTypeNode* qml_cn, CodeMarker
return fileName;
}
-QString HtmlGenerator::generateLowStatusMemberFile(InnerNode *inner,
+QString HtmlGenerator::generateLowStatusMemberFile(Aggregate *inner,
CodeMarker *marker,
CodeMarker::Status status)
{
@@ -3345,7 +3337,7 @@ void HtmlGenerator::generateSectionList(const Section& section,
void HtmlGenerator::generateSectionInheritedList(const Section& section, const Node *relative)
{
- QList<QPair<InnerNode *, int> >::ConstIterator p = section.inherited.constBegin();
+ QList<QPair<Aggregate *, int> >::ConstIterator p = section.inherited.constBegin();
while (p != section.inherited.constEnd()) {
out() << "<li class=\"fn\">";
out() << (*p).second << ' ';
@@ -3560,7 +3552,8 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
bool handled = false;
for (int k = 0; k != 18; ++k) {
const QString & tag = spanTags[2 * k];
- if (tag == QStringRef(&src, i, tag.length())) {
+ if (i + tag.length() <= src.length() &&
+ tag == QStringRef(&src, i, tag.length())) {
html += spanTags[2 * k + 1];
i += tag.length();
handled = true;
@@ -3686,7 +3679,7 @@ QString HtmlGenerator::fileBase(const Node *node) const
result = Generator::fileBase(node);
- if (!node->isInnerNode()) {
+ if (!node->isAggregate()) {
switch (node->status()) {
case Node::Compat:
result += "-compat";
@@ -3704,9 +3697,9 @@ QString HtmlGenerator::fileBase(const Node *node) const
QString HtmlGenerator::fileName(const Node *node)
{
if (node->type() == Node::Document) {
- if (static_cast<const DocumentNode *>(node)->subType() == Node::ExternalPage)
+ if (static_cast<const DocumentNode *>(node)->docSubtype() == Node::ExternalPage)
return node->name();
- if (static_cast<const DocumentNode *>(node)->subType() == Node::Image)
+ if (static_cast<const DocumentNode *>(node)->docSubtype() == Node::Image)
return node->name();
}
return Generator::fileName(node);
@@ -3737,12 +3730,12 @@ QString HtmlGenerator::refForNode(const Node *node)
break;
case Node::Function:
func = static_cast<const FunctionNode *>(node);
- if (func->associatedProperty()) {
- return refForNode(func->associatedProperty());
+ if (func->hasOneAssociatedProperty() && func->doc().isEmpty()) {
+ return refForNode(func->firstAssociatedProperty());
}
else {
ref = func->name();
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
ref += QLatin1Char('-') + QString::number(func->overloadNumber());
}
break;
@@ -3767,7 +3760,7 @@ QString HtmlGenerator::refForNode(const Node *node)
case Node::QmlMethod:
func = static_cast<const FunctionNode *>(node);
ref = func->name() + "-method";
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
ref += QLatin1Char('-') + QString::number(func->overloadNumber());
break;
case Node::Variable:
@@ -3831,7 +3824,7 @@ QString HtmlGenerator::getAutoLink(const Atom *atom, const Node *relative, const
QString link = (*node)->url();
if (link.isEmpty()) {
link = linkForNode(*node, relative);
- if ((*node)->subType() == Node::Image)
+ if ((*node)->docSubtype() == Node::Image)
link = "images/used-in-examples/" + link;
if (!ref.isEmpty())
link += QLatin1Char('#') + ref;
@@ -3872,7 +3865,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
}
QString link = fn;
- if (!node->isInnerNode() || node->isQmlPropertyGroup() || node->isJsPropertyGroup()) {
+ if (!node->isAggregate() || node->isQmlPropertyGroup() || node->isJsPropertyGroup()) {
QString ref = refForNode(node);
if (relative && fn == fileName(relative) && ref == refForNode(relative))
return QString();
@@ -3923,27 +3916,25 @@ void HtmlGenerator::generateFullName(const Node *apparentNode, const Node *relat
}
void HtmlGenerator::generateDetailedMember(const Node *node,
- const InnerNode *relative,
+ const Aggregate *relative,
CodeMarker *marker)
{
- const EnumNode *enume;
-
+ const EnumNode *etn;
#ifdef GENERATE_MAC_REFS
generateMacRef(node, marker);
#endif
generateExtractionMark(node, MemberMark);
generateKeywordAnchors(node);
QString nodeRef = refForNode(node);
- if (node->type() == Node::Enum
- && (enume = static_cast<const EnumNode *>(node))->flagsType()) {
+ if (node->isEnumType() && (etn = static_cast<const EnumNode *>(node))->flagsType()) {
#ifdef GENERATE_MAC_REFS
- generateMacRef(enume->flagsType(), marker);
+ generateMacRef(etn->flagsType(), marker);
#endif
out() << "<h3 class=\"flags\" id=\"" << nodeRef << "\">";
out() << "<a name=\"" + nodeRef + "\"></a>";
- generateSynopsis(enume, relative, marker, CodeMarker::Detailed);
+ generateSynopsis(etn, relative, marker, CodeMarker::Detailed);
out() << "<br/>";
- generateSynopsis(enume->flagsType(),
+ generateSynopsis(etn->flagsType(),
relative,
marker,
CodeMarker::Detailed);
@@ -3958,10 +3949,11 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
generateStatus(node, marker);
generateBody(node, marker);
+ generateOverloadedSignal(node, marker);
generateThreadSafeness(node, marker);
generateSince(node, marker);
- if (node->type() == Node::Property) {
+ if (node->isProperty()) {
const PropertyNode *property = static_cast<const PropertyNode *>(node);
Section section;
@@ -3987,16 +3979,17 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
const FunctionNode* fn = static_cast<const FunctionNode*>(node);
if (fn->isPrivateSignal())
generatePrivateSignalNote(node, marker);
+ generateAssociatedPropertyNotes(fn);
}
- else if (node->type() == Node::Enum) {
- const EnumNode *enume = static_cast<const EnumNode *>(node);
- if (enume->flagsType()) {
- out() << "<p>The " << protectEnc(enume->flagsType()->name())
+ else if (node->isEnumType()) {
+ const EnumNode *etn = static_cast<const EnumNode *>(node);
+ if (etn->flagsType()) {
+ out() << "<p>The " << protectEnc(etn->flagsType()->name())
<< " type is a typedef for "
<< "<a href=\"" << qflagsHref_ << "\">QFlags</a>&lt;"
- << protectEnc(enume->name())
+ << protectEnc(etn->name())
<< "&gt;. It stores an OR combination of "
- << protectEnc(enume->name())
+ << protectEnc(etn->name())
<< " values.</p>\n";
}
}
@@ -4053,7 +4046,7 @@ void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker)
switch (node->status()) {
case Node::Obsolete:
- if (node->isInnerNode())
+ if (node->isAggregate())
Generator::generateStatus(node, marker);
break;
case Node::Compat:
@@ -4166,7 +4159,7 @@ void HtmlGenerator::generateQmlSummary(const Section& section,
on a QML element reference page.
*/
void HtmlGenerator::generateDetailedQmlMember(Node *node,
- const InnerNode *relative,
+ const Aggregate *relative,
CodeMarker *marker)
{
QmlPropertyNode* qpn = 0;
@@ -4371,8 +4364,8 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType
if (markType == MemberMark) {
if (node->type() == Node::Function) {
const FunctionNode *func = static_cast<const FunctionNode *>(node);
- if (!func->associatedProperty()) {
- if (func->overloadNumber() == 1)
+ if (!func->hasAssociatedProperties()) {
+ if (func->overloadNumber() == 0)
out() << "[overload1]";
out() << "$$$" + func->name() + func->rawParameters().remove(' ');
}
@@ -4481,7 +4474,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
writer.writeAttribute("docUrl", docUrl);
QStringList proFiles;
foreach (const Node* child, en->childNodes()) {
- if (child->subType() == Node::File) {
+ if (child->docSubtype() == Node::File) {
QString file = child->name();
if (file.endsWith(".pro") || file.endsWith(".qmlproject")) {
proFiles << file;
@@ -4608,7 +4601,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QString ename = en->name().mid(en->name().lastIndexOf('/')+1);
QMap<int, const Node*> filesToOpen;
foreach (const Node* child, en->childNodes()) {
- if (child->subType() == Node::File) {
+ if (child->docSubtype() == Node::File) {
QFileInfo fileInfo(child->name());
QString fileName = fileInfo.fileName().toLower();
// open .qml, .cpp and .h files with a
@@ -4693,7 +4686,7 @@ void HtmlGenerator::readManifestMetaContent(const Config &config)
subtype: QML class
subtype: QML module
*/
-void HtmlGenerator::reportOrphans(const InnerNode* parent)
+void HtmlGenerator::reportOrphans(const Aggregate* parent)
{
const NodeList& children = parent->childNodes();
if (children.size() == 0)
@@ -4729,7 +4722,7 @@ void HtmlGenerator::reportOrphans(const InnerNode* parent)
case Node::QmlModule:
break;
case Node::Document:
- switch (child->subType()) {
+ switch (child->docSubtype()) {
case Node::Example:
break;
case Node::HeaderFile:
@@ -4819,7 +4812,7 @@ QXmlStreamWriter& HtmlGenerator::xmlWriter()
It also ensures that a GUID map is created for the output file.
*/
-void HtmlGenerator::beginDitamapPage(const InnerNode* node, const QString& fileName)
+void HtmlGenerator::beginDitamapPage(const Aggregate* node, const QString& fileName)
{
Generator::beginSubPage(node,fileName);
QXmlStreamWriter* writer = new QXmlStreamWriter(out().device());
@@ -4891,4 +4884,37 @@ void HtmlGenerator::writeDitaRefs(const DitaRefList& ditarefs)
}
}
+/*!
+ Generates bold Note lines that explain how function \a fn
+ is associated with each of its associated properties.
+ */
+void HtmlGenerator::generateAssociatedPropertyNotes(const FunctionNode* fn)
+{
+ if (fn->hasAssociatedProperties()) {
+ out() << "<p><b>Note:</b> ";
+ foreach (const PropertyNode* pn, fn->associatedProperties()) {
+ QString msg;
+ switch (pn->role(fn)) {
+ case PropertyNode::Getter:
+ msg = QStringLiteral("Getter function ");
+ break;
+ case PropertyNode::Setter:
+ msg = QStringLiteral("Setter function ");
+ break;
+ case PropertyNode::Resetter:
+ msg = QStringLiteral("Resetter function ");
+ break;
+ case PropertyNode::Notifier:
+ msg = QStringLiteral("Notifier signal ");
+ break;
+ default:
+ break;
+ }
+ QString link = linkForNode(pn, 0);
+ out() << msg << "for property <a href=\"" << link << "\">" << pn->name() << "</a>. ";
+ }
+ out() << "</p>";
+ }
+}
+
QT_END_NAMESPACE