summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-10 02:47:19 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-10 02:47:19 (GMT)
commit5173a42be2d0121c0f33217cc4d8399070a8aa3b (patch)
tree0f8b6cde906ae1d014e730506c2a58fbe2b6079c /tools/qdoc3
parent883da42f7c75775502c818aa456c8576d8457ff8 (diff)
parent0d156972b868c951fa33f21735040ab1e7a76f21 (diff)
downloadQt-5173a42be2d0121c0f33217cc4d8399070a8aa3b.zip
Qt-5173a42be2d0121c0f33217cc4d8399070a8aa3b.tar.gz
Qt-5173a42be2d0121c0f33217cc4d8399070a8aa3b.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts: configure.exe src/corelib/kernel/qmetaobject.cpp tools/qdoc3/generator.cpp tools/qdoc3/test/qt-cpp-ignore.qdocconf tools/qdoc3/test/qt-inc.qdocconf
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/doc.cpp3
-rw-r--r--tools/qdoc3/generator.cpp167
-rw-r--r--tools/qdoc3/generator.h4
-rw-r--r--tools/qdoc3/main.cpp2
-rw-r--r--tools/qdoc3/separator.cpp36
-rw-r--r--tools/qdoc3/separator.h1
-rw-r--r--tools/qdoc3/test/qt-cpp-ignore.qdocconf3
-rw-r--r--tools/qdoc3/test/qt-inc.qdocconf3
8 files changed, 155 insertions, 64 deletions
diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp
index 222b9a1..d5aca0e 100644
--- a/tools/qdoc3/doc.cpp
+++ b/tools/qdoc3/doc.cpp
@@ -1677,10 +1677,13 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd)
leavePara();
if (currentSectioningUnit == Doc::Book) {
+#if 0
+ // mws didn't think this was necessary.
if (unit > Doc::Section1)
location().warning(tr("Unexpected '\\%1' without '\\%2'")
.arg(cmdName(cmd))
.arg(cmdName(CMD_SECTION1)));
+#endif
currentSectioningUnit = (Doc::SectioningUnit) (unit - 1);
priv->constructExtra();
priv->extra->sectioningUnit = currentSectioningUnit;
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index b59c06d..e92f53b 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -68,12 +68,12 @@ QStringList Generator::imageDirs;
QString Generator::outDir;
QString Generator::project;
-static Text stockLink(const QString &target)
+static void singularPlural(Text& text, const NodeList& nodes)
{
- return Text() << Atom(Atom::Link, target)
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << target
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ if (nodes.count() == 1)
+ text << " is";
+ else
+ text << " are";
}
Generator::Generator()
@@ -825,79 +825,138 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
{
Text text;
Text theStockLink;
- Node::ThreadSafeness parent = node->parent()->inheritedThreadSafeness();
+ Node::ThreadSafeness threadSafeness = node->threadSafeness();
+
+ Text rlink;
+ rlink << Atom(Atom::Link,"reentrant")
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << "reentrant"
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
- switch (node->threadSafeness()) {
+ Text tlink;
+ tlink << Atom(Atom::Link,"thread-safe")
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << "thread-safe"
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+
+ switch (threadSafeness) {
case Node::UnspecifiedSafeness:
break;
case Node::NonReentrant:
text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
+ << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
<< "Warning:"
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD)
+ << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD)
<< " This "
<< typeString(node)
<< " is not "
- << stockLink("reentrant")
+ << rlink
<< "."
<< Atom::ParaRight;
break;
case Node::Reentrant:
case Node::ThreadSafe:
text << Atom::ParaLeft
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD);
- if (parent == Node::ThreadSafe) {
- text << "Warning:";
- }
- else {
- text << "Note:";
- }
- text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " ";
-
- if (node->threadSafeness() == Node::ThreadSafe)
- theStockLink = stockLink("thread-safe");
- else
- theStockLink = stockLink("reentrant");
+ << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
+ << "Note:"
+ << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD)
+ << " ";
if (node->isInnerNode()) {
- const InnerNode *innerNode = static_cast<const InnerNode *>(node);
- text << "All the functions in this "
+ const InnerNode* innerNode = static_cast<const InnerNode*>(node);
+ text << "All functions in this "
<< typeString(node)
- << " are "
- << theStockLink;
-
- NodeList except;
+ << " are ";
+ if (threadSafeness == Node::ThreadSafe)
+ text << tlink;
+ else
+ text << rlink;
+
+ bool exceptions = false;
+ NodeList reentrant;
+ NodeList threadsafe;
+ NodeList nonreentrant;
NodeList::ConstIterator c = innerNode->childNodes().begin();
while (c != innerNode->childNodes().end()) {
- if ((*c)->threadSafeness() != Node::UnspecifiedSafeness)
- except.append(*c);
+ switch ((*c)->threadSafeness()) {
+ case Node::Reentrant:
+ reentrant.append(*c);
+ if (threadSafeness == Node::ThreadSafe)
+ exceptions = true;
+ break;
+ case Node::ThreadSafe:
+ threadsafe.append(*c);
+ if (threadSafeness == Node::Reentrant)
+ exceptions = true;
+ break;
+ case Node::NonReentrant:
+ nonreentrant.append(*c);
+ exceptions = true;
+ break;
+ default:
+ break;
+ }
++c;
}
- if (except.isEmpty()) {
+ if (!exceptions)
text << ".";
+ else if (threadSafeness == Node::Reentrant) {
+ if (nonreentrant.isEmpty()) {
+ if (!threadsafe.isEmpty()) {
+ text << ", but ";
+ appendFullNames(text,threadsafe,innerNode,marker);
+ singularPlural(text,threadsafe);
+ text << " also " << tlink << ".";
+ }
+ else
+ text << ".";
+ }
+ else {
+ text << ", except for ";
+ appendFullNames(text,nonreentrant,innerNode,marker);
+ text << ", which";
+ singularPlural(text,nonreentrant);
+ text << " nonreentrant.";
+ if (!threadsafe.isEmpty()) {
+ text << " ";
+ appendFullNames(text,threadsafe,innerNode,marker);
+ singularPlural(text,threadsafe);
+ text << " " << tlink << ".";
+ }
+ }
}
- else {
- text << ", except ";
-
- NodeList::ConstIterator e = except.begin();
- int index = 0;
- while (e != except.end()) {
- appendFullName(text, *e, innerNode, marker);
- text << separator(index++, except.count());
- ++e;
+ else { // thread-safe
+ if (!nonreentrant.isEmpty() || !reentrant.isEmpty()) {
+ text << ", except for ";
+ if (!reentrant.isEmpty()) {
+ appendFullNames(text,reentrant,innerNode,marker);
+ text << ", which";
+ singularPlural(text,reentrant);
+ text << " only " << rlink;
+ if (!nonreentrant.isEmpty())
+ text << ", and ";
+ }
+ if (!nonreentrant.isEmpty()) {
+ appendFullNames(text,nonreentrant,innerNode,marker);
+ text << ", which";
+ singularPlural(text,nonreentrant);
+ text << " nonreentrant.";
+ }
+ text << ".";
}
}
}
else {
- text << "This "
- << typeString(node)
- << " is "
- << theStockLink
- << ".";
+ text << "This " << typeString(node) << " is ";
+ if (threadSafeness == Node::ThreadSafe)
+ text << tlink;
+ else
+ text << rlink;
+ text << ".";
}
text << Atom::ParaRight;
}
- generateText(text, node, marker);
+ generateText(text,node,marker);
}
void Generator::generateSince(const Node *node, CodeMarker *marker)
@@ -1035,6 +1094,20 @@ void Generator::appendFullName(Text& text,
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
+void Generator::appendFullNames(Text& text,
+ const NodeList& nodes,
+ const Node* relative,
+ CodeMarker* marker)
+{
+ NodeList::ConstIterator n = nodes.begin();
+ int index = 0;
+ while (n != nodes.end()) {
+ appendFullName(text,*n,relative,marker);
+ text << comma(index++,nodes.count());
+ ++n;
+ }
+}
+
void Generator::appendSortedNames(Text& text,
const ClassNode *classe,
const QList<RelatedClass> &classes,
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 6d42b2e..8e3c57e 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -157,6 +157,10 @@ class Generator
const Node *apparentNode,
const QString& fullName,
const Node *actualNode);
+ void appendFullNames(Text& text,
+ const NodeList& nodes,
+ const Node* relative,
+ CodeMarker* marker);
void appendSortedNames(Text& text,
const ClassNode *classe,
const QList<RelatedClass> &classes,
diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp
index 5a98275..6425765 100644
--- a/tools/qdoc3/main.cpp
+++ b/tools/qdoc3/main.cpp
@@ -128,7 +128,7 @@ static void printHelp()
" -D<name> "
"Define <name> as a macro while parsing sources\n"
" -slow "
- "Turn on features that slow down qdoc"
+ "Turn on features that slow down qdoc\n"
" -showinternal "
"Include stuff marked internal") );
}
diff --git a/tools/qdoc3/separator.cpp b/tools/qdoc3/separator.cpp
index 8f27f90..60674be 100644
--- a/tools/qdoc3/separator.cpp
+++ b/tools/qdoc3/separator.cpp
@@ -48,22 +48,30 @@
QT_BEGIN_NAMESPACE
-QString separator( int index, int count )
+QString separator(int index, int count)
{
- if ( index == count - 1 )
- return tr( ".", "terminator" );
+ if (index == count - 1)
+ return tr(".", "terminator");
+ if (count == 2)
+ return tr(" and ", "separator when N = 2");
+ if (index == 0)
+ return tr(", ", "first separator when N > 2");
+ if (index < count - 2)
+ return tr(", ", "general separator when N > 2");
+ return tr(", and ", "last separator when N > 2");
+}
- if ( count == 2 ) {
- return tr( " and ", "separator when N = 2" );
- } else {
- if ( index == 0 ) {
- return tr( ", ", "first separator when N > 2" );
- } else if ( index < count - 2 ) {
- return tr( ", ", "general separator when N > 2" );
- } else {
- return tr( ", and ", "last separator when N > 2" );
- }
- }
+QString comma(int index, int count)
+{
+ if (index == count - 1)
+ return QString("");
+ if (count == 2)
+ return tr(" and ", "separator when N = 2");
+ if (index == 0)
+ return tr(", ", "first separator when N > 2");
+ if (index < count - 2)
+ return tr(", ", "general separator when N > 2");
+ return tr(", and ", "last separator when N > 2");
}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/separator.h b/tools/qdoc3/separator.h
index 70ba624..2336d94 100644
--- a/tools/qdoc3/separator.h
+++ b/tools/qdoc3/separator.h
@@ -51,6 +51,7 @@
QT_BEGIN_NAMESPACE
QString separator( int index, int count );
+QString comma( int index, int count );
QT_END_NAMESPACE
diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf
index c0f8677..5be9fa5 100644
--- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf
+++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf
@@ -69,7 +69,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
QT_END_INCLUDE_NAMESPACE \
PHONON_EXPORT \
Q_DECLARATIVE_EXPORT \
- Q_GADGET
+ Q_GADGET \
+ QWEBKIT_EXPORT
Cpp.ignoredirectives = Q_DECLARE_HANDLE \
Q_DECLARE_INTERFACE \
Q_DECLARE_METATYPE \
diff --git a/tools/qdoc3/test/qt-inc.qdocconf b/tools/qdoc3/test/qt-inc.qdocconf
index 88d4fcf..bba8e39 100644
--- a/tools/qdoc3/test/qt-inc.qdocconf
+++ b/tools/qdoc3/test/qt-inc.qdocconf
@@ -101,7 +101,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \
Q_XML_EXPORT \
QDBUS_EXPORT \
Q_DECLARATIVE_EXPORT \
- Q_GADGET
+ Q_GADGET \
+ QWEBKIT_EXPORT
Cpp.ignoredirectives = Q_DECLARE_HANDLE \
Q_DECLARE_INTERFACE \
Q_DECLARE_METATYPE \