summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/codemarker.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
commit2366667fc97eb6a56203b2dd7dac776ff4164abd (patch)
treeb2acb6cc6bfe475d7e619e4788973b61fff775e0 /tools/qdoc3/codemarker.cpp
parent2c762f3b8b284a7c6dc0c499b7052013bad5b707 (diff)
downloadQt-2366667fc97eb6a56203b2dd7dac776ff4164abd.zip
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.gz
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.bz2
Initial import of kinetic-dui branch from the old kinetic
Diffstat (limited to 'tools/qdoc3/codemarker.cpp')
-rw-r--r--tools/qdoc3/codemarker.cpp109
1 files changed, 85 insertions, 24 deletions
diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp
index a803281..1b4b642 100644
--- a/tools/qdoc3/codemarker.cpp
+++ b/tools/qdoc3/codemarker.cpp
@@ -168,7 +168,8 @@ const Node *CodeMarker::nodeForString(const QString& string)
{
if (sizeof(const Node *) == sizeof(uint)) {
return reinterpret_cast<const Node *>(string.toUInt());
- } else {
+ }
+ else {
return reinterpret_cast<const Node *>(string.toULongLong());
}
}
@@ -177,7 +178,8 @@ QString CodeMarker::stringForNode(const Node *node)
{
if (sizeof(const Node *) == sizeof(ulong)) {
return QString::number(reinterpret_cast<ulong>(node));
- } else {
+ }
+ else {
return QString::number(reinterpret_cast<qulonglong>(node));
}
}
@@ -220,7 +222,8 @@ QString CodeMarker::typified(const QString &string)
|| ch.digitValue() >= 0 || ch == QLatin1Char('_')
|| ch == QLatin1Char(':')) {
pendingWord += ch;
- } else {
+ }
+ else {
if (!pendingWord.isEmpty()) {
bool isProbablyType = (pendingWord != QLatin1String("const"));
if (isProbablyType)
@@ -251,7 +254,7 @@ QString CodeMarker::typified(const QString &string)
return result;
}
-QString CodeMarker::taggedNode(const Node *node)
+QString CodeMarker::taggedNode(const Node* node)
{
QString tag;
@@ -276,11 +279,35 @@ QString CodeMarker::taggedNode(const Node *node)
break;
default:
tag = QLatin1String("@unknown");
+ break;
}
return QLatin1Char('<') + tag + QLatin1Char('>') + protect(node->name())
+ QLatin1String("</") + tag + QLatin1Char('>');
}
+#ifdef QDOC_QML
+QString CodeMarker::taggedQmlNode(const Node* node)
+{
+ QString tag;
+ switch (node->type()) {
+ case Node::QmlProperty:
+ tag = QLatin1String("@property");
+ break;
+ case Node::QmlSignal:
+ tag = QLatin1String("@signal");
+ break;
+ case Node::QmlMethod:
+ tag = QLatin1String("@method");
+ break;
+ default:
+ tag = QLatin1String("@unknown");
+ break;
+ }
+ return QLatin1Char('<') + tag + QLatin1Char('>') + protect(node->name())
+ + QLatin1String("</") + tag + QLatin1Char('>');
+}
+#endif
+
QString CodeMarker::linkTag(const Node *node, const QString& body)
{
return QLatin1String("<@link node=\"") + stringForNode(node)
@@ -308,9 +335,11 @@ QString CodeMarker::sortName(const Node *node)
QString sortNo;
if (func->metaness() == FunctionNode::Ctor) {
sortNo = QLatin1String("C");
- } else if (func->metaness() == FunctionNode::Dtor) {
+ }
+ else if (func->metaness() == FunctionNode::Dtor) {
sortNo = QLatin1String("D");
- } else {
+ }
+ else {
if (nodeName.startsWith(QLatin1String("operator"))
&& nodeName.length() > 8
&& !nodeName[8].isLetterOrNumber())
@@ -331,21 +360,32 @@ QString CodeMarker::sortName(const Node *node)
return QLatin1Char('B') + nodeName;
}
-void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle style, Status status)
+void CodeMarker::insert(FastSection &fastSection,
+ Node *node,
+ SynopsisStyle style,
+ Status status)
{
- bool inheritedMember = (!node->relates() &&
- (node->parent() != (const InnerNode *)fastSection.innerNode));
bool irrelevant = false;
+ bool inheritedMember = false;
+ if (!node->relates()) {
+ if (node->parent() != (const InnerNode*)fastSection.innerNode) {
+ if (node->type() != Node::QmlProperty)
+ inheritedMember = true;
+ }
+ }
if (node->access() == Node::Private) {
irrelevant = true;
- } else if (node->type() == Node::Function) {
+ }
+ else if (node->type() == Node::Function) {
FunctionNode *func = (FunctionNode *) node;
irrelevant = (inheritedMember
&& (func->metaness() == FunctionNode::Ctor ||
func->metaness() == FunctionNode::Dtor));
- } else if (node->type() == Node::Class || node->type() == Node::Enum
- || node->type() == Node::Typedef) {
+ }
+ else if ((node->type() == Node::Class) ||
+ (node->type() == Node::Enum) ||
+ (node->type() == Node::Typedef)) {
irrelevant = (inheritedMember && style != SeparateList);
if (!irrelevant && style == Detailed && node->type() == Node::Typedef) {
const TypedefNode* typedeffe = static_cast<const TypedefNode*>(node);
@@ -357,9 +397,11 @@ void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle styl
if (!irrelevant) {
if (status == Compat) {
irrelevant = (node->status() != Node::Compat);
- } else if (status == Obsolete) {
+ }
+ else if (status == Obsolete) {
irrelevant = (node->status() != Node::Obsolete);
- } else {
+ }
+ else {
irrelevant = (node->status() == Node::Compat ||
node->status() == Node::Obsolete);
}
@@ -368,9 +410,11 @@ void CodeMarker::insert(FastSection &fastSection, Node *node, SynopsisStyle styl
if (!irrelevant) {
if (!inheritedMember || style == SeparateList) {
QString key = sortName(node);
- if (!fastSection.memberMap.contains(key))
- fastSection.memberMap.insert(key, node);
- } else {
+ if (!fastSection.memberMap.contains(key)) {
+ fastSection.memberMap.insert(key,node);
+ }
+ }
+ else {
if (node->parent()->type() == Node::Class) {
if (fastSection.inherited.isEmpty()
|| fastSection.inherited.last().first != node->parent()) {
@@ -428,7 +472,8 @@ QStringList CodeMarker::macRefsForNode(const Node *node)
#if 0
if (!classe->templateStuff().isEmpty()) {
result += QLatin1String("tmplt/");
- } else
+ }
+ else
#endif
{
result += QLatin1String("cl/");
@@ -465,14 +510,18 @@ QStringList CodeMarker::macRefsForNode(const Node *node)
result += QLatin1String("macro/");
isMacro = true;
#if 0
- } else if (!func->templateStuff().isEmpty()) {
+ }
+ else if (!func->templateStuff().isEmpty()) {
result += QLatin1String("ftmplt/");
#endif
- } else if (func->isStatic()) {
+ }
+ else if (func->isStatic()) {
result += QLatin1String("clm/");
- } else if (!func->parent()->name().isEmpty()) {
+ }
+ else if (!func->parent()->name().isEmpty()) {
result += QLatin1String("instm/");
- } else {
+ }
+ else {
result += QLatin1String("func/");
}
@@ -486,7 +535,8 @@ QStringList CodeMarker::macRefsForNode(const Node *node)
result += "/" + 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();
+ QString type = params.at(i).leftType() +
+ params.at(i).rightType();
type = QLatin1String(QMetaObject::normalizedSignature(type.toLatin1().constData()));
if (i != 0)
result += ",";
@@ -529,10 +579,21 @@ QString CodeMarker::macName(const Node *node, const QString &name)
if (node->name().isEmpty()) {
return QLatin1Char('/') + myName;
- } else {
+ }
+ else {
return plainFullName(node) + QLatin1Char('/') + myName;
}
}
+#ifdef QDOC_QML
+/*!
+ Get the list of documentation sections for the children of
+ the specified QmlClassNode.
+ */
+QList<Section> CodeMarker::qmlSections(const QmlClassNode* , SynopsisStyle )
+{
+ return QList<Section>();
+}
+#endif
QT_END_NAMESPACE