diff --git a/src/src.pro b/src/src.pro
index 07ace99144..a970391382 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -28,12 +28,6 @@ src_tools_uic.CONFIG = host_build
force_bootstrap: src_tools_uic.depends = src_tools_bootstrap
else: src_tools_uic.depends = src_corelib
-src_tools_qdoc.subdir = tools/qdoc
-src_tools_qdoc.target = sub-qdoc
-src_tools_qdoc.CONFIG = host_build
-force_bootstrap: src_tools_qdoc.depends = src_tools_bootstrap
-else: src_tools_qdoc.depends = src_corelib src_xml
-
src_tools_bootstrap_dbus.subdir = tools/bootstrap-dbus
src_tools_bootstrap_dbus.target = sub-bootstrap_dbus
src_tools_bootstrap_dbus.depends = src_tools_bootstrap
@@ -182,7 +176,7 @@ contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent
}
}
}
-SUBDIRS += src_plugins src_tools_qdoc
+SUBDIRS += src_plugins
nacl: SUBDIRS -= src_network src_testlib
diff --git a/src/tools/qdoc/TODO.txt b/src/tools/qdoc/TODO.txt
deleted file mode 100644
index 9bf4a2864f..0000000000
--- a/src/tools/qdoc/TODO.txt
+++ /dev/null
@@ -1,87 +0,0 @@
- * fix QWSPointerCalibrationData::devPoints and qwsServer
- * Fix QMenu::addAction(QAction *) overload, "using" etc.
- * fix space between two tables using
- * qpixmap-qt3.html; remove 8 public functions inherited from QPaintDevice
- * \variable array
- * Added support for parameterless macros (e.g. \macro Q_OBJECT).
- * Made qdoc stricter regarding the data types (e.g. can't use \enum to document a typedef).
- * Parse QT_MODULE() macro and generate proper warnings for the various editions.
- * Fix parsing of \image following \value (e.g. qt.html).
- * Don't turn X11 and similar names into links.
- * Added automatic links from getters to setters and vice versa.
- * Support \module and show which module each class is from.
- * Fix occasional crash caused by misuse of const_cast().
- * Provide clearer error messages when resolves fail.
-
-
-
-
-CHECK:
-
- * Identify editions
- * Automatic \sa getter setter
- * \macro Q_OBJECT
-
-MUST HAVES:
-
- * resolve [gs]etters for \sa using base class
-
- * fix \overload when one is a signal and the other a normal function
- * use "project" for .dcf files
- * functions.html: include the types from QtGlobal as well as the functions (whatever that means)
-
- * nice template function/class syntax
- * spellchecker: built-in vs. builtin
-
- * verbose mode for functions that don't exist
- * No links to Porting Guide sections (e.g. QStringList)
- * link toggled(bool)
- * autolink foo(1)
- * handle using correctly
- * QObject "reentrant" list: duplicates
- * operator<< \overload
- * \compat \overload
- * qWarning() link
- * operator<<() autolink
-
- * get rid of spurious 'global' functions
- * Make automatic links in code work
-
- * Fix encoding bug (see Important email from Simon Hausmann)
- * Make links to QFoo::bar().baz() work
- * Fix automatic links in \sectionX (e.g. qt4-getting-started.html)
- * Provide a "List of all properties" page.
-
- * expand QObjectList -> QList
- * warning for unnamed parameters in property access functions
- * \center...\endcenter
-
-LINKS:
-
- * explanation following nonstandard wording warning
-
- * omit \overload in operator<< and operator>>
- * make operator-() unary and binary independent functions (no \overload)
- * fix \overload
- * fix \legalese
- * remove warning for undocumented enum item like QLocale::LastLanguage
- * improve the \a warnings for overloads; if one overload documents a para, fine
-
- * implement \sidebar
-
- * implement \legalesefile
-
- * show in which module each class is
- * list namespaces, list header files
-
-
-NICE FEATURES:
- * implement inheritance tree for each class (as a PNG)
- * avoid ...
in table/item cells without relying on horrible kludge
- * prevent macros from having same name as commands
- * be smart about enum types Foo::Bar vs. Bar when comparing functions
- * be smart about const & non-const when comparing functions
-
-OTHER:
- * make qdoc run faster
- * make sure \headerfile works even if specified after \relates
diff --git a/src/tools/qdoc/atom.cpp b/src/tools/qdoc/atom.cpp
deleted file mode 100644
index f50f401c5b..0000000000
--- a/src/tools/qdoc/atom.cpp
+++ /dev/null
@@ -1,460 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include
-#include "atom.h"
-#include "location.h"
-#include "qdocdatabase.h"
-#include
-#include
-
-QT_BEGIN_NAMESPACE
-
-/*! \class Atom
- \brief The Atom class is the fundamental unit for representing
- documents internally.
-
- Atoms have a \i type and are completed by a \i string whose
- meaning depends on the \i type. For example, the string
- \quotation
- \i italic text looks nicer than \bold bold text
- \endquotation
- is represented by the following atoms:
- \quotation
- (FormattingLeft, ATOM_FORMATTING_ITALIC)
- (String, "italic")
- (FormattingRight, ATOM_FORMATTING_ITALIC)
- (String, " text is more attractive than ")
- (FormattingLeft, ATOM_FORMATTING_BOLD)
- (String, "bold")
- (FormattingRight, ATOM_FORMATTING_BOLD)
- (String, " text")
- \endquotation
-
- \also Text
-*/
-
-/*! \enum Atom::AtomType
-
- \value AnnotatedList
- \value AutoLink
- \value BaseName
- \value BriefLeft
- \value BriefRight
- \value C
- \value CaptionLeft
- \value CaptionRight
- \value Code
- \value CodeBad
- \value CodeNew
- \value CodeOld
- \value CodeQuoteArgument
- \value CodeQuoteCommand
- \value DivLeft
- \value DivRight
- \value EndQmlText
- \value FormatElse
- \value FormatEndif
- \value FormatIf
- \value FootnoteLeft
- \value FootnoteRight
- \value FormattingLeft
- \value FormattingRight
- \value GeneratedList
- \value Image
- \value ImageText
- \value ImportantNote
- \value InlineImage
- \value JavaScript
- \value EndJavaScript
- \value Keyword
- \value LineBreak
- \value Link
- \value LinkNode
- \value ListLeft
- \value ListItemNumber
- \value ListTagLeft
- \value ListTagRight
- \value ListItemLeft
- \value ListItemRight
- \value ListRight
- \value NavAutoLink
- \value NavLink
- \value Nop
- \value Note
- \value ParaLeft
- \value ParaRight
- \value Qml
- \value QmlText
- \value QuotationLeft
- \value QuotationRight
- \value RawString
- \value SectionLeft
- \value SectionRight
- \value SectionHeadingLeft
- \value SectionHeadingRight
- \value SidebarLeft
- \value SidebarRight
- \value SinceList
- \value String
- \value TableLeft
- \value TableRight
- \value TableHeaderLeft
- \value TableHeaderRight
- \value TableRowLeft
- \value TableRowRight
- \value TableItemLeft
- \value TableItemRight
- \value TableOfContents
- \value Target
- \value UnhandledFormat
- \value UnknownCommand
-*/
-
-QString Atom::noError_ = QString();
-
-static const struct {
- const char *english;
- int no;
-} atms[] = {
- { "AnnotatedList", Atom::AnnotatedList },
- { "AutoLink", Atom::AutoLink },
- { "BaseName", Atom::BaseName },
- { "br", Atom::BR},
- { "BriefLeft", Atom::BriefLeft },
- { "BriefRight", Atom::BriefRight },
- { "C", Atom::C },
- { "CaptionLeft", Atom::CaptionLeft },
- { "CaptionRight", Atom::CaptionRight },
- { "Code", Atom::Code },
- { "CodeBad", Atom::CodeBad },
- { "CodeNew", Atom::CodeNew },
- { "CodeOld", Atom::CodeOld },
- { "CodeQuoteArgument", Atom::CodeQuoteArgument },
- { "CodeQuoteCommand", Atom::CodeQuoteCommand },
- { "DivLeft", Atom::DivLeft },
- { "DivRight", Atom::DivRight },
- { "EndQmlText", Atom::EndQmlText },
- { "FootnoteLeft", Atom::FootnoteLeft },
- { "FootnoteRight", Atom::FootnoteRight },
- { "FormatElse", Atom::FormatElse },
- { "FormatEndif", Atom::FormatEndif },
- { "FormatIf", Atom::FormatIf },
- { "FormattingLeft", Atom::FormattingLeft },
- { "FormattingRight", Atom::FormattingRight },
- { "GeneratedList", Atom::GeneratedList },
- { "GuidLink", Atom::GuidLink},
- { "hr", Atom::HR},
- { "Image", Atom::Image },
- { "ImageText", Atom::ImageText },
- { "ImportantLeft", Atom::ImportantLeft },
- { "ImportantRight", Atom::ImportantRight },
- { "InlineImage", Atom::InlineImage },
- { "JavaScript", Atom::JavaScript },
- { "EndJavaScript", Atom::EndJavaScript },
- { "Keyword", Atom::Keyword },
- { "LegaleseLeft", Atom::LegaleseLeft },
- { "LegaleseRight", Atom::LegaleseRight },
- { "LineBreak", Atom::LineBreak },
- { "Link", Atom::Link },
- { "LinkNode", Atom::LinkNode },
- { "ListLeft", Atom::ListLeft },
- { "ListItemNumber", Atom::ListItemNumber },
- { "ListTagLeft", Atom::ListTagLeft },
- { "ListTagRight", Atom::ListTagRight },
- { "ListItemLeft", Atom::ListItemLeft },
- { "ListItemRight", Atom::ListItemRight },
- { "ListRight", Atom::ListRight },
- { "NavAutoLink", Atom::NavAutoLink },
- { "NavLink", Atom::NavLink },
- { "Nop", Atom::Nop },
- { "NoteLeft", Atom::NoteLeft },
- { "NoteRight", Atom::NoteRight },
- { "ParaLeft", Atom::ParaLeft },
- { "ParaRight", Atom::ParaRight },
- { "Qml", Atom::Qml},
- { "QmlText", Atom::QmlText },
- { "QuotationLeft", Atom::QuotationLeft },
- { "QuotationRight", Atom::QuotationRight },
- { "RawString", Atom::RawString },
- { "SectionLeft", Atom::SectionLeft },
- { "SectionRight", Atom::SectionRight },
- { "SectionHeadingLeft", Atom::SectionHeadingLeft },
- { "SectionHeadingRight", Atom::SectionHeadingRight },
- { "SidebarLeft", Atom::SidebarLeft },
- { "SidebarRight", Atom::SidebarRight },
- { "SinceList", Atom::SinceList },
- { "SnippetCommand", Atom::SnippetCommand },
- { "SnippetIdentifier", Atom::SnippetIdentifier },
- { "SnippetLocation", Atom::SnippetLocation },
- { "String", Atom::String },
- { "TableLeft", Atom::TableLeft },
- { "TableRight", Atom::TableRight },
- { "TableHeaderLeft", Atom::TableHeaderLeft },
- { "TableHeaderRight", Atom::TableHeaderRight },
- { "TableRowLeft", Atom::TableRowLeft },
- { "TableRowRight", Atom::TableRowRight },
- { "TableItemLeft", Atom::TableItemLeft },
- { "TableItemRight", Atom::TableItemRight },
- { "TableOfContents", Atom::TableOfContents },
- { "Target", Atom::Target },
- { "UnhandledFormat", Atom::UnhandledFormat },
- { "UnknownCommand", Atom::UnknownCommand },
- { 0, 0 }
-};
-
-/*! \fn Atom::Atom(AtomType type, const QString& string)
-
- Constructs an atom of the specified \a type with the single
- parameter \a string and does not put the new atom in a list.
-*/
-
-/*! \fn Atom::Atom(AtomType type, const QString& p1, const QString& p2)
-
- Constructs an atom of the specified \a type with the two
- parameters \a p1 and \a p2 and does not put the new atom
- in a list.
-*/
-
-/*! \fn Atom(Atom *previous, AtomType type, const QString& string)
-
- Constructs an atom of the specified \a type with the single
- parameter \a string and inserts the new atom into the list
- after the \a previous atom.
-*/
-
-/*! \fn Atom::Atom(Atom* previous, AtomType type, const QString& p1, const QString& p2)
-
- Constructs an atom of the specified \a type with the two
- parameters \a p1 and \a p2 and inserts the new atom into
- the list after the \a previous atom.
-*/
-
-/*! \fn void Atom::appendChar(QChar ch)
-
- Appends \a ch to the string parameter of this atom.
-
- \also string()
-*/
-
-/*! \fn void Atom::appendString(const QString& string)
-
- Appends \a string to the string parameter of this atom.
-
- \also string()
-*/
-
-/*! \fn void Atom::chopString()
-
- \also string()
-*/
-
-/*! \fn Atom *Atom::next()
- Return the next atom in the atom list.
- \also type(), string()
-*/
-
-/*!
- Return the next Atom in the list if it is of AtomType \a t.
- Otherwise return 0.
- */
-const Atom* Atom::next(AtomType t) const
-{
- return (next_ && (next_->type() == t)) ? next_ : 0;
-}
-
-/*!
- Return the next Atom in the list if it is of AtomType \a t
- and its string part is \a s. Otherwise return 0.
- */
-const Atom* Atom::next(AtomType t, const QString& s) const
-{
- return (next_ && (next_->type() == t) && (next_->string() == s)) ? next_ : 0;
-}
-
-/*! \fn const Atom *Atom::next() const
- Return the next atom in the atom list.
- \also type(), string()
-*/
-
-/*! \fn AtomType Atom::type() const
- Return the type of this atom.
- \also string(), next()
-*/
-
-/*!
- Return the type of this atom as a string. Return "Invalid" if
- type() returns an impossible value.
-
- This is only useful for debugging.
-
- \also type()
-*/
-QString Atom::typeString() const
-{
- static bool deja = false;
-
- if (!deja) {
- int i = 0;
- while (atms[i].english != 0) {
- if (atms[i].no != i)
- Location::internalError(QCoreApplication::translate("QDoc::Atom", "atom %1 missing").arg(i));
- i++;
- }
- deja = true;
- }
-
- int i = (int) type();
- if (i < 0 || i > (int) Last)
- return QLatin1String("Invalid");
- return QLatin1String(atms[i].english);
-}
-
-/*! \fn const QString& Atom::string() const
-
- Returns the string parameter that together with the type
- characterizes this atom.
-
- \also type(), next()
-*/
-
-/*!
- Dumps this Atom to stderr in printer friendly form.
- */
-void Atom::dump() const
-{
- QString str = string();
- str.replace(QLatin1String("\\"), QLatin1String("\\\\"));
- str.replace(QLatin1String("\""), QLatin1String("\\\""));
- str.replace(QLatin1String("\n"), QLatin1String("\\n"));
- str.replace(QRegExp(QLatin1String("[^\x20-\x7e]")), QLatin1String("?"));
- if (!str.isEmpty())
- str = QLatin1String(" \"") + str + QLatin1Char('"');
- fprintf(stderr,
- " %-15s%s\n",
- typeString().toLatin1().data(),
- str.toLatin1().data());
-}
-
-/*!
- The only constructor for LinkAtom. It creates an Atom of
- type Atom::Link. \a p1 being the link target. \a p2 is the
- parameters in square brackets. Normally there is just one
- word in the square brackets, but there can be up to three
- words separated by spaces. The constructor splits \a p2 on
- the space character.
- */
-LinkAtom::LinkAtom(const QString& p1, const QString& p2)
- : Atom(p1),
- resolved_(false),
- genus_(Node::DontCare),
- goal_(Node::NoType),
- domain_(0),
- squareBracketParams_(p2)
-{
- // nada.
-}
-
-/*!
- This function resolves the parameters that were enclosed in
- square brackets. If the parameters have already been resolved,
- it does nothing and returns immediately.
- */
-void LinkAtom::resolveSquareBracketParams()
-{
- if (resolved_)
- return;
- QStringList params = squareBracketParams_.toLower().split(QLatin1Char(' '));
- foreach (const QString& p, params) {
- if (!domain_) {
- domain_ = QDocDatabase::qdocDB()->findTree(p);
- if (domain_) {
- continue;
- }
- }
- if (goal_ == Node::NoType) {
- goal_ = Node::goal(p);
- if (goal_ != Node::NoType)
- continue;
- }
- if (p == "qml") {
- genus_ = Node::QML;
- continue;
- }
- if (p == "cpp") {
- genus_ = Node::CPP;
- continue;
- }
- if (p == "doc") {
- genus_ = Node::DOC;
- continue;
- }
- error_ = squareBracketParams_;
- break;
- }
- resolved_ = true;
-}
-
-/*!
- Standard copy constructor of LinkAtom \a t.
- */
-LinkAtom::LinkAtom(const LinkAtom& t)
- : Atom(Link, t.string()),
- resolved_(t.resolved_),
- genus_(t.genus_),
- goal_(t.goal_),
- domain_(t.domain_),
- error_(t.error_),
- squareBracketParams_(t.squareBracketParams_)
-{
- // nothing
-}
-
-/*!
- Special copy constructor of LinkAtom \a t, where
- where the new LinkAtom will not be the first one
- in the list.
- */
-LinkAtom::LinkAtom(Atom* previous, const LinkAtom& t)
- : Atom(previous, Link, t.string()),
- resolved_(t.resolved_),
- genus_(t.genus_),
- goal_(t.goal_),
- domain_(t.domain_),
- error_(t.error_),
- squareBracketParams_(t.squareBracketParams_)
-{
- previous->next_ = this;
-}
-
-QT_END_NAMESPACE
diff --git a/src/tools/qdoc/atom.h b/src/tools/qdoc/atom.h
deleted file mode 100644
index 86b8ba7b3c..0000000000
--- a/src/tools/qdoc/atom.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ATOM_H
-#define ATOM_H
-
-#include
-#include "node.h"
-#include
-
-QT_BEGIN_NAMESPACE
-
-class Tree;
-class LinkAtom;
-
-class Atom
-{
-public:
- enum AtomType {
- AnnotatedList,
- AutoLink,
- BaseName,
- BR,
- BriefLeft,
- BriefRight,
- C,
- CaptionLeft,
- CaptionRight,
- Code,
- CodeBad,
- CodeNew,
- CodeOld,
- CodeQuoteArgument,
- CodeQuoteCommand,
- DivLeft,
- DivRight,
- EndQmlText,
- FootnoteLeft,
- FootnoteRight,
- FormatElse,
- FormatEndif,
- FormatIf,
- FormattingLeft,
- FormattingRight,
- GeneratedList,
- GuidLink,
- HR,
- Image,
- ImageText,
- ImportantLeft,
- ImportantRight,
- InlineImage,
- JavaScript,
- EndJavaScript,
- Keyword,
- LegaleseLeft,
- LegaleseRight,
- LineBreak,
- Link,
- LinkNode,
- ListLeft,
- ListItemNumber,
- ListTagLeft,
- ListTagRight,
- ListItemLeft,
- ListItemRight,
- ListRight,
- NavAutoLink,
- NavLink,
- Nop,
- NoteLeft,
- NoteRight,
- ParaLeft,
- ParaRight,
- Qml,
- QmlText,
- QuotationLeft,
- QuotationRight,
- RawString,
- SectionLeft,
- SectionRight,
- SectionHeadingLeft,
- SectionHeadingRight,
- SidebarLeft,
- SidebarRight,
- SinceList,
- SnippetCommand,
- SnippetIdentifier,
- SnippetLocation,
- String,
- TableLeft,
- TableRight,
- TableHeaderLeft,
- TableHeaderRight,
- TableRowLeft,
- TableRowRight,
- TableItemLeft,
- TableItemRight,
- TableOfContents,
- Target,
- UnhandledFormat,
- UnknownCommand,
- Last = UnknownCommand
- };
-
- friend class LinkAtom;
-
- Atom(const QString& string)
- : next_(0), type_(Link)
- {
- strs << string;
- }
-
- Atom(AtomType type, const QString& string = "")
- : next_(0), type_(type)
- {
- strs << string;
- }
-
- Atom(AtomType type, const QString& p1, const QString& p2)
- : next_(0), type_(type)
- {
- strs << p1;
- if (!p2.isEmpty())
- strs << p2;
- }
-
- Atom(Atom* previous, AtomType type, const QString& string = "")
- : next_(previous->next_), type_(type)
- {
- strs << string;
- previous->next_ = this;
- }
-
- Atom(Atom* previous, AtomType type, const QString& p1, const QString& p2)
- : next_(previous->next_), type_(type)
- {
- strs << p1;
- if (!p2.isEmpty())
- strs << p2;
- previous->next_ = this;
- }
-
- virtual ~Atom() { }
-
- void appendChar(QChar ch) { strs[0] += ch; }
- void appendString(const QString& string) { strs[0] += string; }
- void chopString() { strs[0].chop(1); }
- void setString(const QString& string) { strs[0] = string; }
- Atom* next() { return next_; }
- void setNext(Atom* newNext) { next_ = newNext; }
-
- const Atom* next() const { return next_; }
- const Atom* next(AtomType t) const;
- const Atom* next(AtomType t, const QString& s) const;
- AtomType type() const { return type_; }
- QString typeString() const;
- const QString& string() const { return strs[0]; }
- const QString& string(int i) const { return strs[i]; }
- int count() const { return strs.size(); }
- void dump() const;
- const QStringList& strings() const { return strs; }
-
- virtual bool isLinkAtom() const { return false; }
- virtual Node::Genus genus() { return Node::DontCare; }
- virtual bool specifiesDomain() { return false; }
- virtual Tree* domain() { return 0; }
- virtual Node::NodeType goal() { return Node::NoType; }
- virtual const QString& error() { return noError_; }
- virtual void resolveSquareBracketParams() { }
-
- protected:
- static QString noError_;
- Atom* next_;
- AtomType type_;
- QStringList strs;
-};
-
-class LinkAtom : public Atom
-{
- public:
- LinkAtom(const QString& p1, const QString& p2);
- LinkAtom(const LinkAtom& t);
- LinkAtom(Atom* previous, const LinkAtom& t);
- virtual ~LinkAtom() { }
-
- virtual bool isLinkAtom() const Q_DECL_OVERRIDE { return true; }
- virtual Node::Genus genus() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return genus_; }
- virtual bool specifiesDomain() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return (domain_ != 0); }
- virtual Tree* domain() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return domain_; }
- virtual Node::NodeType goal() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return goal_; }
- virtual const QString& error() Q_DECL_OVERRIDE { return error_; }
- virtual void resolveSquareBracketParams() Q_DECL_OVERRIDE;
-
- protected:
- bool resolved_;
- Node::Genus genus_;
- Node::NodeType goal_;
- Tree* domain_;
- QString error_;
- QString squareBracketParams_;
-};
-
-#define ATOM_FORMATTING_BOLD "bold"
-#define ATOM_FORMATTING_INDEX "index"
-#define ATOM_FORMATTING_ITALIC "italic"
-#define ATOM_FORMATTING_LINK "link"
-#define ATOM_FORMATTING_PARAMETER "parameter"
-#define ATOM_FORMATTING_SPAN "span "
-#define ATOM_FORMATTING_SUBSCRIPT "subscript"
-#define ATOM_FORMATTING_SUPERSCRIPT "superscript"
-#define ATOM_FORMATTING_TELETYPE "teletype"
-#define ATOM_FORMATTING_UICONTROL "uicontrol"
-#define ATOM_FORMATTING_UNDERLINE "underline"
-
-#define ATOM_LIST_BULLET "bullet"
-#define ATOM_LIST_TAG "tag"
-#define ATOM_LIST_VALUE "value"
-#define ATOM_LIST_LOWERALPHA "loweralpha"
-#define ATOM_LIST_LOWERROMAN "lowerroman"
-#define ATOM_LIST_NUMERIC "numeric"
-#define ATOM_LIST_UPPERALPHA "upperalpha"
-#define ATOM_LIST_UPPERROMAN "upperroman"
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/tools/qdoc/codechunk.cpp b/src/tools/qdoc/codechunk.cpp
deleted file mode 100644
index 5799e0bac0..0000000000
--- a/src/tools/qdoc/codechunk.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- codechunk.cpp
-*/
-
-#include
-#include
-
-#include "codechunk.h"
-
-QT_BEGIN_NAMESPACE
-
-enum { Other, Alnum, Gizmo, Comma, LParen, RParen, RAngle, Colon };
-
-// entries 128 and above are Other
-static const int charCategory[256] = {
- Other, Other, Other, Other, Other, Other, Other, Other,
- Other, Other, Other, Other, Other, Other, Other, Other,
- Other, Other, Other, Other, Other, Other, Other, Other,
- Other, Other, Other, Other, Other, Other, Other, Other,
- // ! " # $ % & '
- Other, Other, Other, Other, Other, Gizmo, Gizmo, Other,
- // ( ) * + , - . /
- LParen, RParen, Gizmo, Gizmo, Comma, Other, Other, Gizmo,
- // 0 1 2 3 4 5 6 7
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // 8 9 : ; < = > ?
- Alnum, Alnum, Colon, Other, Other, Gizmo, RAngle, Gizmo,
- // @ A B C D E F G
- Other, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // H I J K L M N O
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // P Q R S T U V W
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // X Y Z [ \ ] ^ _
- Alnum, Alnum, Alnum, Other, Other, Other, Gizmo, Alnum,
- // ` a b c d e f g
- Other, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // h i j k l m n o
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // p q r s t u v w
- Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum, Alnum,
- // x y z { | } ~
- Alnum, Alnum, Alnum, LParen, Gizmo, RParen, Other, Other
-};
-
-static const bool needSpace[8][8] = {
- /* [ a + , ( ) > : */
- /* [ */ { false, false, false, false, false, true, false, false },
- /* a */ { false, true, true, false, false, true, false, false },
- /* + */ { false, true, false, false, false, true, false, true },
- /* , */ { true, true, true, true, true, true, true, true },
- /* ( */ { true, true, true, false, true, false, true, true },
- /* ) */ { true, true, true, false, true, true, true, true },
- /* > */ { true, true, true, false, true, true, true, false },
- /* : */ { false, false, true, true, true, true, true, false }
-};
-
-static int category( QChar ch )
-{
- return charCategory[(int)ch.toLatin1()];
-}
-
-CodeChunk::CodeChunk()
- : hotspot( -1 )
-{
-}
-
-CodeChunk::CodeChunk( const QString& str )
- : s( str ), hotspot( -1 )
-{
-}
-
-void CodeChunk::append( const QString& lexeme )
-{
- if ( !s.isEmpty() && !lexeme.isEmpty() ) {
- /*
- Should there be a space or not between the code chunk so far and the
- new lexeme?
- */
- int cat1 = category(s.at(s.size() - 1));
- int cat2 = category(lexeme[0]);
- if ( needSpace[cat1][cat2] )
- s += QLatin1Char( ' ' );
- }
- s += lexeme;
-}
-
-void CodeChunk::appendHotspot()
-{
- /*
- The first hotspot is the right one.
- */
- if ( hotspot == -1 )
- hotspot = s.length();
-}
-
-QString CodeChunk::toString() const
-{
- return s;
-}
-
-QStringList CodeChunk::toPath() const
-{
- QString t = s;
- t.remove(QRegExp(QLatin1String("<([^<>]|<([^<>]|<[^<>]*>)*>)*>")));
- return t.split(QLatin1String("::"));
-}
-
-QT_END_NAMESPACE
diff --git a/src/tools/qdoc/codechunk.h b/src/tools/qdoc/codechunk.h
deleted file mode 100644
index 259012df90..0000000000
--- a/src/tools/qdoc/codechunk.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- codechunk.h
-*/
-
-#ifndef CODECHUNK_H
-#define CODECHUNK_H
-
-#include
-
-QT_BEGIN_NAMESPACE
-
-// ### get rid of that class
-
-/*
- The CodeChunk class represents a tiny piece of C++ code.
-
- The class provides conversion between a list of lexemes and a string. It adds
- spaces at the right place for consistent style. The tiny pieces of code it
- represents are data types, enum values, and default parameter values.
-
- Apart from the piece of code itself, there are two bits of metainformation
- stored in CodeChunk: the base and the hotspot. The base is the part of the
- piece that may be a hypertext link. The base of
-
- QMap
-
- is QMap.
-
- The hotspot is the place the variable name should be inserted in the case of a
- variable (or parameter) declaration. The base of
-
- char * []
-
- is between '*' and '[]'.
-*/
-class CodeChunk
-{
-public:
- CodeChunk();
- CodeChunk( const QString& str );
-
- void append( const QString& lexeme );
- void appendHotspot();
-
- bool isEmpty() const { return s.isEmpty(); }
- void clear() { s.clear(); }
- QString toString() const;
- QStringList toPath() const;
- QString left() const { return s.left(hotspot == -1 ? s.length() : hotspot); }
- QString right() const { return s.mid(hotspot == -1 ? s.length() : hotspot); }
-
-private:
- QString s;
- int hotspot;
-};
-
-inline bool operator==( const CodeChunk& c, const CodeChunk& d ) {
- return c.toString() == d.toString();
-}
-
-inline bool operator!=( const CodeChunk& c, const CodeChunk& d ) {
- return !( c == d );
-}
-
-inline bool operator<( const CodeChunk& c, const CodeChunk& d ) {
- return c.toString() < d.toString();
-}
-
-inline bool operator>( const CodeChunk& c, const CodeChunk& d ) {
- return d < c;
-}
-
-inline bool operator<=( const CodeChunk& c, const CodeChunk& d ) {
- return !( c > d );
-}
-
-inline bool operator>=( const CodeChunk& c, const CodeChunk& d ) {
- return !( c < d );
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp
deleted file mode 100644
index a668205a66..0000000000
--- a/src/tools/qdoc/codemarker.cpp
+++ /dev/null
@@ -1,668 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include
-#include "codemarker.h"
-#include "config.h"
-#include "node.h"
-#include
-#include
-
-QT_BEGIN_NAMESPACE
-
-QString CodeMarker::defaultLang;
-QList CodeMarker::markers;
-
-/*!
- When a code marker constructs itself, it puts itself into
- the static list of code markers. All the code markers in
- the static list get initialized in initialize(), which is
- not called until after the qdoc configuration file has
- been read.
- */
-CodeMarker::CodeMarker()
-{
- markers.prepend(this);
-}
-
-/*!
- When a code marker destroys itself, it removes itself from
- the static list of code markers.
- */
-CodeMarker::~CodeMarker()
-{
- markers.removeAll(this);
-}
-
-/*!
- A code market performs no initialization by default. Marker-specific
- initialization is performed in subclasses.
- */
-void CodeMarker::initializeMarker(const Config& ) // config
-{
-}
-
-/*!
- Terminating a code marker is trivial.
- */
-void CodeMarker::terminateMarker()
-{
- // nothing.
-}
-
-/*!
- All the code markers in the static list are initialized
- here, after the qdoc configuration file has been loaded.
- */
-void CodeMarker::initialize(const Config& config)
-{
- defaultLang = config.getString(CONFIG_LANGUAGE);
- QList::ConstIterator m = markers.constBegin();
- while (m != markers.constEnd()) {
- (*m)->initializeMarker(config);
- ++m;
- }
-}
-
-/*!
- All the code markers in the static list are terminated here.
- */
-void CodeMarker::terminate()
-{
- QList::ConstIterator m = markers.constBegin();
- while (m != markers.constEnd()) {
- (*m)->terminateMarker();
- ++m;
- }
-}
-
-CodeMarker *CodeMarker::markerForCode(const QString& code)
-{
- CodeMarker *defaultMarker = markerForLanguage(defaultLang);
- if (defaultMarker != 0 && defaultMarker->recognizeCode(code))
- return defaultMarker;
-
- QList::ConstIterator m = markers.constBegin();
- while (m != markers.constEnd()) {
- if ((*m)->recognizeCode(code))
- return *m;
- ++m;
- }
- return defaultMarker;
-}
-
-CodeMarker *CodeMarker::markerForFileName(const QString& fileName)
-{
- CodeMarker *defaultMarker = markerForLanguage(defaultLang);
- int dot = -1;
- while ((dot = fileName.lastIndexOf(QLatin1Char('.'), dot)) != -1) {
- QString ext = fileName.mid(dot + 1);
- if (defaultMarker != 0 && defaultMarker->recognizeExtension(ext))
- return defaultMarker;
- QList::ConstIterator m = markers.constBegin();
- while (m != markers.constEnd()) {
- if ((*m)->recognizeExtension(ext))
- return *m;
- ++m;
- }
- --dot;
- }
- return defaultMarker;
-}
-
-CodeMarker *CodeMarker::markerForLanguage(const QString& lang)
-{
- QList::ConstIterator m = markers.constBegin();
- while (m != markers.constEnd()) {
- if ((*m)->recognizeLanguage(lang))
- return *m;
- ++m;
- }
- return 0;
-}
-
-const Node *CodeMarker::nodeForString(const QString& string)
-{
- if (sizeof(const Node *) == sizeof(uint)) {
- return reinterpret_cast(string.toUInt());
- }
- else {
- return reinterpret_cast(string.toULongLong());
- }
-}
-
-QString CodeMarker::stringForNode(const Node *node)
-{
- if (sizeof(const Node *) == sizeof(ulong)) {
- return QString::number(reinterpret_cast(node));
- }
- else {
- return QString::number(reinterpret_cast(node));
- }
-}
-
-static const QString samp = QLatin1String("&");
-static const QString slt = QLatin1String("<");
-static const QString sgt = QLatin1String(">");
-static const QString squot = QLatin1String(""");
-
-QString CodeMarker::protect(const QString& str)
-{
- int n = str.length();
- QString marked;
- marked.reserve(n * 2 + 30);
- const QChar *data = str.constData();
- for (int i = 0; i != n; ++i) {
- switch (data[i].unicode()) {
- case '&': marked += samp; break;
- case '<': marked += slt; break;
- case '>': marked += sgt; break;
- case '"': marked += squot; break;
- default : marked += data[i];
- }
- }
- return marked;
-}
-
-void CodeMarker::appendProtectedString(QString *output, const QStringRef &str)
-{
- int n = str.length();
- output->reserve(output->size() + n * 2 + 30);
- const QChar *data = str.constData();
- for (int i = 0; i != n; ++i) {
- switch (data[i].unicode()) {
- case '&': *output += samp; break;
- case '<': *output += slt; break;
- case '>': *output += sgt; break;
- case '"': *output += squot; break;
- default : *output += data[i];
- }
- }
-}
-
-QString CodeMarker::typified(const QString &string, bool trailingSpace)
-{
- QString result;
- QString pendingWord;
-
- for (int i = 0; i <= string.size(); ++i) {
- QChar ch;
- if (i != string.size())
- ch = string.at(i);
-
- QChar lower = ch.toLower();
- if ((lower >= QLatin1Char('a') && lower <= QLatin1Char('z'))
- || ch.digitValue() >= 0 || ch == QLatin1Char('_')
- || ch == QLatin1Char(':')) {
- pendingWord += ch;
- }
- else {
- if (!pendingWord.isEmpty()) {
- bool isProbablyType = (pendingWord != QLatin1String("const"));
- if (isProbablyType)
- result += QLatin1String("<@type>");
- result += pendingWord;
- if (isProbablyType)
- result += QLatin1String("@type>");
- }
- pendingWord.clear();
-
- switch (ch.unicode()) {
- case '\0':
- break;
- case '&':
- result += QLatin1String("&");
- break;
- case '<':
- result += QLatin1String("<");
- break;
- case '>':
- result += QLatin1String(">");
- break;
- default:
- result += ch;
- }
- }
- }
- if (trailingSpace && string.size()) {
- if (!string.endsWith(QLatin1Char('*'))
- && !string.endsWith(QLatin1Char('&')))
- result += QLatin1Char(' ');
- }
- return result;
-}
-
-QString CodeMarker::taggedNode(const Node* node)
-{
- QString tag;
- QString name = node->name();
-
- switch (node->type()) {
- case Node::Namespace:
- tag = QLatin1String("@namespace");
- break;
- case Node::Class:
- tag = QLatin1String("@class");
- break;
- case Node::Enum:
- tag = QLatin1String("@enum");
- break;
- case Node::Typedef:
- tag = QLatin1String("@typedef");
- break;
- case Node::Function:
- tag = QLatin1String("@function");
- break;
- case Node::Property:
- tag = QLatin1String("@property");
- break;
- case Node::QmlType:
- /*
- Remove the "QML:" prefix, if present.
- There shouldn't be any of these "QML:"
- prefixes in the documentation sources
- after the switch to using QML module
- qualifiers, but this code is kept to
- be backward compatible.
- */
- if (node->name().startsWith(QLatin1String("QML:")))
- name = name.mid(4);
- tag = QLatin1String("@property");
- break;
- case Node::Document:
- tag = QLatin1String("@property");
- break;
- case Node::QmlMethod:
- case Node::QmlSignal:
- case Node::QmlSignalHandler:
- tag = QLatin1String("@function");
- break;
- default:
- tag = QLatin1String("@unknown");
- break;
- }
- return (QLatin1Char('<') + tag + QLatin1Char('>') + protect(name)
- + QLatin1String("") + tag + QLatin1Char('>'));
-}
-
-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::QmlSignalHandler:
- tag = QLatin1String("@signalhandler");
- break;
- case Node::QmlMethod:
- tag = QLatin1String("@method");
- break;
- default:
- tag = QLatin1String("@unknown");
- break;
- }
- return QLatin1Char('<') + tag + QLatin1Char('>') + protect(node->name())
- + QLatin1String("") + tag + QLatin1Char('>');
-}
-
-QString CodeMarker::linkTag(const Node *node, const QString& body)
-{
- return QLatin1String("<@link node=\"") + stringForNode(node)
- + QLatin1String("\">") + body + QLatin1String("@link>");
-}
-
-QString CodeMarker::sortName(const Node *node, const QString* name)
-{
- QString nodeName;
- if (name != 0)
- nodeName = *name;
- else
- nodeName = node->name();
- int numDigits = 0;
- for (int i = nodeName.size() - 1; i > 0; --i) {
- if (nodeName.at(i).digitValue() == -1)
- break;
- ++numDigits;
- }
-
- // we want 'qint8' to appear before 'qint16'
- if (numDigits > 0) {
- for (int i = 0; i < 4 - numDigits; ++i)
- nodeName.insert(nodeName.size()-numDigits-1, QLatin1Char('0'));
- }
-
- if (node->type() == Node::Function) {
- const FunctionNode *func = static_cast(node);
- QString sortNo;
- if (func->metaness() == FunctionNode::Ctor) {
- sortNo = QLatin1String("C");
- }
- else if (func->metaness() == FunctionNode::Dtor) {
- sortNo = QLatin1String("D");
- }
- else {
- if (nodeName.startsWith(QLatin1String("operator"))
- && nodeName.length() > 8
- && !nodeName[8].isLetterOrNumber())
- sortNo = QLatin1String("F");
- else
- sortNo = QLatin1String("E");
- }
- return sortNo + nodeName + QLatin1Char(' ') + QString::number(func->overloadNumber(), 36);
- }
-
- if (node->type() == Node::Class)
- return QLatin1Char('A') + nodeName;
-
- if (node->type() == Node::Property || node->type() == Node::Variable)
- return QLatin1Char('E') + nodeName;
-
- if ((node->type() == Node::QmlMethod) ||
- (node->type() == Node::QmlSignal) ||
- (node->type() == Node::QmlSignalHandler)) {
- //const FunctionNode* func = static_cast(node);
- //return QLatin1Char('E') + func->name();
- return QLatin1Char('E') + nodeName;
- }
-
- return QLatin1Char('B') + nodeName;
-}
-
-void CodeMarker::insert(FastSection &fastSection,
- Node *node,
- SynopsisStyle style,
- Status status)
-{
- bool irrelevant = false;
- bool inheritedMember = false;
- if (!node->relates()) {
- Aggregate* p = node->parent();
- if (p->isQmlPropertyGroup())
- p = p->parent();
- if (p != fastSection.parent_) {
- if ((!p->isQmlType() && !p->isJsType()) || !p->isAbstract())
- inheritedMember = true;
- }
- }
-
- if (node->access() == Node::Private) {
- irrelevant = true;
- }
- 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) {
- irrelevant = (inheritedMember && style != Subpage);
- if (!irrelevant && style == Detailed && node->type() == Node::Typedef) {
- const TypedefNode* typedeffe = static_cast(node);
- if (typedeffe->associatedEnum())
- irrelevant = true;
- }
- }
-
- if (!irrelevant) {
- if (status == Compat) {
- irrelevant = (node->status() != Node::Compat);
- }
- else if (status == Obsolete) {
- irrelevant = (node->status() != Node::Obsolete);
- }
- else {
- irrelevant = (node->status() == Node::Compat ||
- node->status() == Node::Obsolete);
- }
- }
-
- if (!irrelevant) {
- if (!inheritedMember || style == Subpage) {
- QString key = sortName(node);
- fastSection.memberMap.insertMulti(key, node);
- }
- else {
- if (node->parent()->isClass() || node->parent()->isNamespace()) {
- if (fastSection.inherited.isEmpty()
- || fastSection.inherited.last().first != node->parent()) {
- QPair p(node->parent(), 0);
- fastSection.inherited.append(p);
- }
- fastSection.inherited.last().second++;
- }
- }
- }
-}
-
-/*!
- Returns \c true if \a node represents a reimplemented member
- function in the class of the FastSection \a fs. If it is
- a reimplemented function, then it is inserted into the
- reimplemented member map in \a fs. The test is performed
- only if \a status is \e OK. True is returned if \a node
- is inserted into the map. Otherwise, false is returned.
- */
-bool CodeMarker::insertReimpFunc(FastSection& fs, Node* node, Status status)
-{
- if ((node->access() != Node::Private) && (node->relates() == 0)) {
- const FunctionNode* fn = static_cast(node);
- if ((fn->reimplementedFrom() != 0) && (status == Okay)) {
- if (fn->parent() == fs.parent_) {
- QString key = sortName(fn);
- if (!fs.reimpMemberMap.contains(key)) {
- fs.reimpMemberMap.insert(key,node);
- return true;
- }
- }
- }
- }
- return false;
-}
-
-/*!
- If \a fs is not empty, convert it to a Section and append
- the new Section to \a sectionList.
- */
-void CodeMarker::append(QList& sectionList, const FastSection& fs, bool includeKeys)
-{
- if (!fs.isEmpty()) {
- if (fs.classMapList_.isEmpty()) {
- Section section(fs.name,fs.divClass,fs.singularMember,fs.pluralMember);
- if (includeKeys) {
- section.keys = fs.memberMap.keys();
- }
- section.members = fs.memberMap.values();
- section.reimpMembers = fs.reimpMemberMap.values();
- section.inherited = fs.inherited;
- sectionList.append(section);
- }
- else {
- Section section(fs.name,fs.divClass,fs.singularMember,fs.pluralMember);
- sectionList.append(section);
- Section* s = §ionList[sectionList.size()-1];
- for (int i=0; ifirst = classMap->first;
- ckn->second.second = classMap->second.values();
- ckn->second.first = classMap->second.keys();
- s->classKeysNodesList_.append(ckn);
- }
- }
- }
-}
-
-/*!
- The destructor must delete each member of the
- list of QML class lists, if it is not empty;
- */
-Section::~Section()
-{
- if (!classKeysNodesList_.isEmpty()) {
- for (int i=0; itype()) {
- case Node::Class:
- {
- const ClassNode *classe = static_cast(node);
- {
- result += QLatin1String("cl/");
- }
- result += macName(classe); // ### Maybe plainName?
- }
- break;
- case Node::Enum:
- {
- QStringList stringList;
- stringList << encode(result + QLatin1String("tag/") +
- macName(node));
- foreach (const QString &enumName, node->doc().enumItemNames()) {
- // ### Write a plainEnumValue() and use it here
- stringList << encode(result + QLatin1String("econst/") +
- macName(node->parent(), enumName));
- }
- return stringList;
- }
- case Node::Typedef:
- result += QLatin1String("tdef/") + macName(node);
- break;
- case Node::Function:
- {
- bool isMacro = false;
- Q_UNUSED(isMacro)
- const FunctionNode *func = static_cast(node);
-
- // overloads are too clever for the Xcode documentation browser
- if (func->isOverload())
- return QStringList();
-
- if (func->metaness() == FunctionNode::MacroWithParams
- || func->metaness() == FunctionNode::MacroWithoutParams) {
- result += QLatin1String("macro/");
- }
- else if (func->isStatic()) {
- result += QLatin1String("clm/");
- }
- else if (!func->parent()->name().isEmpty()) {
- result += QLatin1String("instm/");
- }
- else {
- result += QLatin1String("func/");
- }
-
- result += macName(func);
- if (result.endsWith(QLatin1String("()")))
- result.chop(2);
- }
- break;
- case Node::Variable:
- result += QLatin1String("data/") + macName(node);
- break;
- case Node::Property:
- {
- NodeList list = static_cast(node)->functions();
- QStringList stringList;
- foreach (Node* node, list) {
- stringList += macRefsForNode(node);
- }
- return stringList;
- }
- case Node::Namespace:
- case Node::Document:
- case Node::QmlType:
- default:
- return QStringList();
- }
-
- return QStringList(encode(result));
-}
-
-QString CodeMarker::macName(const Node *node, const QString &name)
-{
- QString myName = name;
- if (myName.isEmpty()) {
- myName = node->name();
- node = node->parent();
- }
-
- if (node->name().isEmpty()) {
- return QLatin1Char('/') + protect(myName);
- }
- else {
- return node->plainFullName() + QLatin1Char('/') + protect(myName);
- }
-}
-
-/*!
- Returns an empty list of documentation sections.
- */
-QList CodeMarker::qmlSections(QmlTypeNode* , SynopsisStyle , Status )
-{
- return QList();
-}
-
-QT_END_NAMESPACE
diff --git a/src/tools/qdoc/codemarker.h b/src/tools/qdoc/codemarker.h
deleted file mode 100644
index 011c8623dd..0000000000
--- a/src/tools/qdoc/codemarker.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- codemarker.h
-*/
-
-#ifndef CODEMARKER_H
-#define CODEMARKER_H
-
-#include
-
-#include "atom.h"
-#include "node.h"
-
-QT_BEGIN_NAMESPACE
-
-class Config;
-
-typedef QMultiMap MemberMap; // the string is the member signature
-typedef QPair ClassMap; // the node is the QML type
-typedef QList ClassMapList;
-
-typedef QPair KeysAndNodes;
-typedef QPair ClassKeysNodes;
-typedef QList ClassKeysNodesList;
-
-struct Section
-{
- QString name;
- QString divClass;
- QString singularMember;
- QString pluralMember;
- QStringList keys;
- NodeList members;
- NodeList reimpMembers;
- QList > inherited;
- ClassKeysNodesList classKeysNodesList_;
-
- Section() { }
- Section(const QString& name0,
- const QString& divClass0,
- const QString& singularMember0,
- const QString& pluralMember0)
- : name(name0),
- divClass(divClass0),
- singularMember(singularMember0),
- pluralMember(pluralMember0) { }
- ~Section();
- void appendMember(Node* node) { members.append(node); }
- void appendReimpMember(Node* node) { reimpMembers.append(node); }
-};
-
-struct FastSection
-{
- const Aggregate *parent_;
- QString name;
- QString divClass;
- QString singularMember;
- QString pluralMember;
- QMultiMap memberMap;
- QMultiMap reimpMemberMap;
- ClassMapList classMapList_;
- QList > inherited;
-
- FastSection(const Aggregate *parent,
- const QString& name0,
- const QString& divClass0,
- const QString& singularMember0,
- const QString& pluralMember0)
- : parent_(parent),
- name(name0),
- divClass(divClass0),
- singularMember(singularMember0),
- pluralMember(pluralMember0) { }
- ~FastSection();
- bool isEmpty() const {
- return (memberMap.isEmpty() &&
- inherited.isEmpty() &&
- reimpMemberMap.isEmpty() &&
- classMapList_.isEmpty());
- }
-
-};
-
-class CodeMarker
-{
-public:
- enum SynopsisStyle { Summary, Detailed, Subpage, Accessors };
- enum Status { Compat, Obsolete, Okay };
-
- CodeMarker();
- virtual ~CodeMarker();
-
- virtual void initializeMarker(const Config& config);
- virtual void terminateMarker();
- virtual bool recognizeCode(const QString& code) = 0;
- virtual bool recognizeExtension(const QString& ext) = 0;
- virtual bool recognizeLanguage(const QString& lang) = 0;
- virtual Atom::AtomType atomType() const = 0;
- virtual QString markedUpCode(const QString& code,
- const Node *relative,
- const Location &location) = 0;
- virtual QString markedUpSynopsis(const Node *node,
- const Node *relative,
- SynopsisStyle style) = 0;
- virtual QString markedUpQmlItem(const Node* , bool) { return QString(); }
- virtual QString markedUpName(const Node *node) = 0;
- virtual QString markedUpFullName(const Node *node,
- const Node *relative = 0) = 0;
- virtual QString markedUpEnumValue(const QString &enumValue,
- const Node *relative) = 0;
- virtual QString markedUpIncludes(const QStringList& includes) = 0;
- virtual QString functionBeginRegExp(const QString& funcName) = 0;
- virtual QString functionEndRegExp(const QString& funcName) = 0;
- virtual QList sections(const Aggregate *inner,
- SynopsisStyle style,
- Status status) = 0;
- virtual QList qmlSections(QmlTypeNode* qmlTypeNode,
- SynopsisStyle style,
- Status status = Okay);
- virtual QStringList macRefsForNode(Node* node);
-
- static void initialize(const Config& config);
- static void terminate();
- static CodeMarker *markerForCode(const QString& code);
- static CodeMarker *markerForFileName(const QString& fileName);
- static CodeMarker *markerForLanguage(const QString& lang);
- static const Node *nodeForString(const QString& string);
- static QString stringForNode(const Node *node);
-
- QString typified(const QString &string, bool trailingSpace = false);
-
-protected:
- virtual QString sortName(const Node *node, const QString* name = 0);
- static QString protect(const QString &string);
- static void appendProtectedString(QString *output, const QStringRef &str);
- QString taggedNode(const Node* node);
- QString taggedQmlNode(const Node* node);
- QString linkTag(const Node *node, const QString& body);
- void insert(FastSection &fastSection,
- Node *node,
- SynopsisStyle style,
- Status status);
- bool insertReimpFunc(FastSection& fs, Node* node, Status status);
- void append(QList& sectionList, const FastSection& fastSection, bool includeKeys = false);
-
-private:
- QString macName(const Node *parent, const QString &name = QString());
-
- static QString defaultLang;
- static QList markers;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp
deleted file mode 100644
index 92a0d52129..0000000000
--- a/src/tools/qdoc/codeparser.cpp
+++ /dev/null
@@ -1,437 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- codeparser.cpp
-*/
-
-#include "codeparser.h"
-#include "node.h"
-#include "tree.h"
-#include "config.h"
-#include "generator.h"
-#include "qdocdatabase.h"
-#include
-
-QT_BEGIN_NAMESPACE
-
-#define COMMAND_COMPAT Doc::alias(QLatin1String("compat"))
-#define COMMAND_DEPRECATED Doc::alias(QLatin1String("deprecated")) // ### don't document
-#define COMMAND_INGROUP Doc::alias(QLatin1String("ingroup"))
-#define COMMAND_INMODULE Doc::alias(QLatin1String("inmodule")) // ### don't document
-#define COMMAND_INQMLMODULE Doc::alias(QLatin1String("inqmlmodule"))
-#define COMMAND_INJSMODULE Doc::alias(QLatin1String("injsmodule"))
-#define COMMAND_INTERNAL Doc::alias(QLatin1String("internal"))
-#define COMMAND_MAINCLASS Doc::alias(QLatin1String("mainclass"))
-#define COMMAND_NONREENTRANT Doc::alias(QLatin1String("nonreentrant"))
-#define COMMAND_OBSOLETE Doc::alias(QLatin1String("obsolete"))
-#define COMMAND_PAGEKEYWORDS Doc::alias(QLatin1String("pagekeywords"))
-#define COMMAND_PRELIMINARY Doc::alias(QLatin1String("preliminary"))
-#define COMMAND_INPUBLICGROUP Doc::alias(QLatin1String("inpublicgroup"))
-#define COMMAND_QTVARIABLE Doc::alias(QLatin1String("qtvariable"))
-#define COMMAND_REENTRANT Doc::alias(QLatin1String("reentrant"))
-#define COMMAND_SINCE Doc::alias(QLatin1String("since"))
-#define COMMAND_SUBTITLE Doc::alias(QLatin1String("subtitle"))
-#define COMMAND_THREADSAFE Doc::alias(QLatin1String("threadsafe"))
-#define COMMAND_TITLE Doc::alias(QLatin1String("title"))
-#define COMMAND_WRAPPER Doc::alias(QLatin1String("wrapper"))
-#define COMMAND_NOAUTOLIST Doc::alias(QLatin1String("noautolist"))
-
-QList CodeParser::parsers;
-bool CodeParser::showInternal_ = false;
-bool CodeParser::singleExec_ = false;
-
-/*!
- The constructor adds this code parser to the static
- list of code parsers.
- */
-CodeParser::CodeParser()
-{
- qdb_ = QDocDatabase::qdocDB();
- parsers.prepend(this);
-}
-
-/*!
- The destructor removes this code parser from the static
- list of code parsers.
- */
-CodeParser::~CodeParser()
-{
- parsers.removeAll(this);
-}
-
-/*!
- Initialize the code parser base class.
- */
-void CodeParser::initializeParser(const Config& config)
-{
- showInternal_ = config.getBool(CONFIG_SHOWINTERNAL);
- singleExec_ = config.getBool(CONFIG_SINGLEEXEC);
-}
-
-/*!
- Terminating a code parser is trivial.
- */
-void CodeParser::terminateParser()
-{
- // nothing.
-}
-
-QStringList CodeParser::headerFileNameFilter()
-{
- return sourceFileNameFilter();
-}
-
-void CodeParser::parseHeaderFile(const Location& location, const QString& filePath)
-{
- parseSourceFile(location, filePath);
-}
-
-void CodeParser::doneParsingHeaderFiles()
-{
- doneParsingSourceFiles();
-}
-
-/*!
- All the code parsers in the static list are initialized here,
- after the qdoc configuration variables have been set.
- */
-void CodeParser::initialize(const Config& config)
-{
- QList::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
- (*p)->initializeParser(config);
- ++p;
- }
-}
-
-/*!
- All the code parsers in the static list are terminated here.
- */
-void CodeParser::terminate()
-{
- QList::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
- (*p)->terminateParser();
- ++p;
- }
-}
-
-CodeParser *CodeParser::parserForLanguage(const QString& language)
-{
- QList::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
- if ((*p)->language() == language)
- return *p;
- ++p;
- }
- return 0;
-}
-
-CodeParser *CodeParser::parserForHeaderFile(const QString &filePath)
-{
- QString fileName = QFileInfo(filePath).fileName();
-
- QList::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
-
- QStringList headerPatterns = (*p)->headerFileNameFilter();
- foreach (const QString &pattern, headerPatterns) {
- QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard);
- if (re.exactMatch(fileName))
- return *p;
- }
- ++p;
- }
- return 0;
-}
-
-CodeParser *CodeParser::parserForSourceFile(const QString &filePath)
-{
- QString fileName = QFileInfo(filePath).fileName();
-
- QList::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
-
- QStringList sourcePatterns = (*p)->sourceFileNameFilter();
- foreach (const QString &pattern, sourcePatterns) {
- QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard);
- if (re.exactMatch(fileName))
- return *p;
- }
- ++p;
- }
- return 0;
-}
-
-static QSet commonMetaCommands_;
-/*!
- Returns the set of strings representing the common metacommands.
- */
-const QSet& CodeParser::commonMetaCommands()
-{
- if (commonMetaCommands_.isEmpty()) {
- commonMetaCommands_ << COMMAND_COMPAT
- << COMMAND_DEPRECATED
- << COMMAND_INGROUP
- << COMMAND_INMODULE
- << COMMAND_INQMLMODULE
- << COMMAND_INTERNAL
- << COMMAND_MAINCLASS
- << COMMAND_NONREENTRANT
- << COMMAND_OBSOLETE
- << COMMAND_PAGEKEYWORDS
- << COMMAND_PRELIMINARY
- << COMMAND_INPUBLICGROUP
- << COMMAND_QTVARIABLE
- << COMMAND_REENTRANT
- << COMMAND_SINCE
- << COMMAND_SUBTITLE
- << COMMAND_THREADSAFE
- << COMMAND_TITLE
- << COMMAND_WRAPPER
- << COMMAND_INJSMODULE
- << COMMAND_NOAUTOLIST;
- }
- return commonMetaCommands_;
-}
-
-/*!
- The topic command has been processed. Now process the other
- metacommands that were found. These are not the text markup
- commands.
- */
-void CodeParser::processCommonMetaCommand(const Location& location,
- const QString& command,
- const ArgLocPair& arg,
- Node* node)
-{
- if (command == COMMAND_COMPAT) {
- location.warning(tr("\\compat command used, but Qt3 compatibility is no longer supported"));
- node->setStatus(Node::Compat);
- }
- else if (command == COMMAND_DEPRECATED) {
- node->setStatus(Node::Obsolete);
- }
- else if ((command == COMMAND_INGROUP) || (command == COMMAND_INPUBLICGROUP)) {
- // Note: \ingroup and \inpublicgroup are now the same.
- // Not that they were ever different.
- qdb_->addToGroup(arg.first, node);
- }
- else if (command == COMMAND_INMODULE) {
- qdb_->addToModule(arg.first,node);
- }
- else if (command == COMMAND_INQMLMODULE) {
- qdb_->addToQmlModule(arg.first,node);
- }
- else if (command == COMMAND_INJSMODULE) {
- qdb_->addToJsModule(arg.first, node);
- }
- else if (command == COMMAND_MAINCLASS) {
- node->doc().location().warning(tr("'\\mainclass' is deprecated. Consider '\\ingroup mainclasses'"));
- }
- else if (command == COMMAND_OBSOLETE) {
- node->setStatus(Node::Obsolete);
- }
- else if (command == COMMAND_NONREENTRANT) {
- node->setThreadSafeness(Node::NonReentrant);
- }
- else if (command == COMMAND_PRELIMINARY) {
- node->setStatus(Node::Preliminary);
- }
- else if (command == COMMAND_INTERNAL) {
- if (!showInternal_) {
- node->setAccess(Node::Private);
- node->setStatus(Node::Internal);
- if (node->type() == Node::QmlPropertyGroup) {
- const QmlPropertyGroupNode* qpgn = static_cast(node);
- NodeList::ConstIterator p = qpgn->childNodes().constBegin();
- while (p != qpgn->childNodes().constEnd()) {
- if ((*p)->type() == Node::QmlProperty) {
- (*p)->setAccess(Node::Private);
- (*p)->setStatus(Node::Internal);
- }
- ++p;
- }
- }
- }
- }
- else if (command == COMMAND_REENTRANT) {
- node->setThreadSafeness(Node::Reentrant);
- }
- else if (command == COMMAND_SINCE) {
- node->setSince(arg.first);
- }
- else if (command == COMMAND_WRAPPER) {
- node->setWrapper();
- }
- else if (command == COMMAND_PAGEKEYWORDS) {
- node->addPageKeywords(arg.first);
- }
- else if (command == COMMAND_THREADSAFE) {
- node->setThreadSafeness(Node::ThreadSafe);
- }
- else if (command == COMMAND_TITLE) {
- node->setTitle(arg.first);
- if (!node->isDocumentNode() && !node->isCollectionNode())
- location.warning(tr("Ignored '\\%1'").arg(COMMAND_SUBTITLE));
- else if (node->isExample())
- qdb_->addExampleNode(static_cast(node));
- }
- else if (command == COMMAND_SUBTITLE) {
- node->setSubTitle(arg.first);
- if (!node->isDocumentNode() && !node->isCollectionNode())
- location.warning(tr("Ignored '\\%1'").arg(COMMAND_SUBTITLE));
- }
- else if (command == COMMAND_QTVARIABLE) {
- node->setQtVariable(arg.first);
- if (!node->isModule() && !node->isQmlModule())
- location.warning(tr("Command '\\%1' is only meanigfule in '\\module' and '\\qmlmodule'.")
- .arg(COMMAND_QTVARIABLE));
- }
- else if (command == COMMAND_NOAUTOLIST) {
- node->setNoAutoList(true);
- }
-}
-
-/*!
- \internal
- */
-void CodeParser::extractPageLinkAndDesc(const QString& arg,
- QString* link,
- QString* desc)
-{
- QRegExp bracedRegExp(QLatin1String("\\{([^{}]*)\\}(?:\\{([^{}]*)\\})?"));
-
- if (bracedRegExp.exactMatch(arg)) {
- *link = bracedRegExp.cap(1);
- *desc = bracedRegExp.cap(2);
- if (desc->isEmpty())
- *desc = *link;
- }
- else {
- int spaceAt = arg.indexOf(QLatin1Char(' '));
- if (arg.contains(QLatin1String(".html")) && spaceAt != -1) {
- *link = arg.leftRef(spaceAt).trimmed().toString();
- *desc = arg.midRef(spaceAt).trimmed().toString();
- }
- else {
- *link = arg;
- *desc = arg;
- }
- }
-}
-
-/*!
- \internal
- */
-void CodeParser::setLink(Node* node, Node::LinkType linkType, const QString& arg)
-{
- QString link;
- QString desc;
- extractPageLinkAndDesc(arg, &link, &desc);
- node->setLink(linkType, link, desc);
-}
-
-/*!
- Returns \c true if the file being parsed is a .h file.
- */
-bool CodeParser::isParsingH() const
-{
- return currentFile_.endsWith(".h");
-}
-
-/*!
- Returns \c true if the file being parsed is a .cpp file.
- */
-bool CodeParser::isParsingCpp() const
-{
- return currentFile_.endsWith(".cpp");
-}
-
-/*!
- Returns \c true if the file being parsed is a .qdoc file.
- */
-bool CodeParser::isParsingQdoc() const
-{
- return currentFile_.endsWith(".qdoc");
-}
-
-/*!
- For each node that will produce a documentation page, this function
- ensures that the node belongs to a module. Normally, the qdoc comment
- for an entity that will produce a documentation page will contain an
- \inmodule command to tell qdoc which module the entity belongs to.
-
- But now we normally run qdoc on each module in two passes. The first
- produces an index file; the second pass generates the docs after
- reading all the index files it needs.
-
- This means that all the pages generated during each pass 2 run of
- qdoc almost certainly belong to a single module, and the name of
- that module is, as a rule, used as the project name in the qdocconf
- file used when running qdoc on the module.
-
- So this function first asks if the node \a n has a non-empty module
- name. If it it does not have a non-empty module name, it sets the
- module name to be the project name.
-
- In some cases it prints a qdoc warning that it has done this. Namely,
- for C++ classes and namespaces.
- */
-void CodeParser::checkModuleInclusion(Node* n)
-{
- if (n->physicalModuleName().isEmpty()) {
- n->setPhysicalModuleName(Generator::defaultModuleName());
- switch (n->type()) {
- case Node::Class:
- if (n->access() != Node::Private && !n->doc().isEmpty()) {
- n->doc().location().warning(tr("Class %1 has no \\inmodule command; "
- "using project name by default: %2")
- .arg(n->name()).arg(Generator::defaultModuleName()));
- }
- break;
- case Node::Namespace:
- if (n->access() != Node::Private && !n->name().isEmpty() && !n->doc().isEmpty()) {
- n->doc().location().warning(tr("Namespace %1 has no \\inmodule command; "
- "using project name by default: %2")
- .arg(n->name()).arg(Generator::defaultModuleName()));
- }
- break;
- default:
- break;
- }
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/tools/qdoc/codeparser.h b/src/tools/qdoc/codeparser.h
deleted file mode 100644
index 9d9e9286ec..0000000000
--- a/src/tools/qdoc/codeparser.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CODEPARSER_H
-#define CODEPARSER_H
-
-#include
-#include "node.h"
-
-QT_BEGIN_NAMESPACE
-
-class Config;
-class QString;
-class QDocDatabase;
-
-class CodeParser
-{
- Q_DECLARE_TR_FUNCTIONS(QDoc::CodeParser)
-
-public:
- CodeParser();
- virtual ~CodeParser();
-
- virtual void initializeParser(const Config& config);
- virtual void terminateParser();
- virtual QString language() = 0;
- virtual QStringList headerFileNameFilter();
- virtual QStringList sourceFileNameFilter() = 0;
- virtual void parseHeaderFile(const Location& location, const QString& filePath);
- virtual void parseSourceFile(const Location& location, const QString& filePath) = 0;
- virtual void doneParsingHeaderFiles();
- virtual void doneParsingSourceFiles() = 0;
-
- bool isParsingH() const;
- bool isParsingCpp() const;
- bool isParsingQdoc() const;
- const QString& currentFile() const { return currentFile_; }
- void checkModuleInclusion(Node* n);
-
- static void initialize(const Config& config);
- static void terminate();
- static CodeParser *parserForLanguage(const QString& language);
- static CodeParser *parserForHeaderFile(const QString &filePath);
- static CodeParser *parserForSourceFile(const QString &filePath);
- static void setLink(Node* node, Node::LinkType linkType, const QString& arg);
-
-protected:
- const QSet& commonMetaCommands();
- void processCommonMetaCommand(const Location& location,
- const QString& command,
- const ArgLocPair& arg,
- Node *node);
- static void extractPageLinkAndDesc(const QString& arg,
- QString* link,
- QString* desc);
- QString currentFile_;
- QDocDatabase* qdb_;
-
-private:
- static QList parsers;
- static bool showInternal_;
- static bool singleExec_;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
deleted file mode 100644
index 6c47b86d22..0000000000
--- a/src/tools/qdoc/config.cpp
+++ /dev/null
@@ -1,1221 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- config.cpp
-*/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include "config.h"
-#include "generator.h"
-#include
-
-QT_BEGIN_NAMESPACE
-
-QString ConfigStrings::ALIAS = QStringLiteral("alias");
-QString ConfigStrings::AUTOLINKERRORS = QStringLiteral("autolinkerrors");
-QString ConfigStrings::BASE = QStringLiteral("base");
-QString ConfigStrings::BASEDIR = QStringLiteral("basedir");
-QString ConfigStrings::BUILDVERSION = QStringLiteral("buildversion");
-QString ConfigStrings::CODEINDENT = QStringLiteral("codeindent");
-QString ConfigStrings::CODEPREFIX = QStringLiteral("codeprefix");
-QString ConfigStrings::CODESUFFIX = QStringLiteral("codesuffix");
-QString ConfigStrings::CPPCLASSESPAGE = QStringLiteral("cppclassespage");
-QString ConfigStrings::DEFINES = QStringLiteral("defines");
-QString ConfigStrings::DEPENDS = QStringLiteral("depends");
-QString ConfigStrings::DESCRIPTION = QStringLiteral("description");
-QString ConfigStrings::EDITION = QStringLiteral("edition");
-QString ConfigStrings::ENDHEADER = QStringLiteral("endheader");
-QString ConfigStrings::EXAMPLEDIRS = QStringLiteral("exampledirs");
-QString ConfigStrings::EXAMPLES = QStringLiteral("examples");
-QString ConfigStrings::EXAMPLESINSTALLPATH = QStringLiteral("examplesinstallpath");
-QString ConfigStrings::EXCLUDEDIRS = QStringLiteral("excludedirs");
-QString ConfigStrings::EXCLUDEFILES = QStringLiteral("excludefiles");
-QString ConfigStrings::EXTRAIMAGES = QStringLiteral("extraimages");
-QString ConfigStrings::FALSEHOODS = QStringLiteral("falsehoods");
-QString ConfigStrings::FORMATTING = QStringLiteral("formatting");
-QString ConfigStrings::GENERATEINDEX = QStringLiteral("generateindex");
-QString ConfigStrings::HEADERDIRS = QStringLiteral("headerdirs");
-QString ConfigStrings::HEADERS = QStringLiteral("headers");
-QString ConfigStrings::HEADERSCRIPTS = QStringLiteral("headerscripts");
-QString ConfigStrings::HEADERSTYLES = QStringLiteral("headerstyles");
-QString ConfigStrings::HOMEPAGE = QStringLiteral("homepage");
-QString ConfigStrings::IGNOREDIRECTIVES = QStringLiteral("ignoredirectives");
-QString ConfigStrings::IGNORETOKENS = QStringLiteral("ignoretokens");
-QString ConfigStrings::IMAGEDIRS = QStringLiteral("imagedirs");
-QString ConfigStrings::IMAGES = QStringLiteral("images");
-QString ConfigStrings::INDEXES = QStringLiteral("indexes");
-QString ConfigStrings::LANDINGPAGE = QStringLiteral("landingpage");
-QString ConfigStrings::LANGUAGE = QStringLiteral("language");
-QString ConfigStrings::MACRO = QStringLiteral("macro");
-QString ConfigStrings::MANIFESTMETA = QStringLiteral("manifestmeta");
-QString ConfigStrings::NATURALLANGUAGE = QStringLiteral("naturallanguage");
-QString ConfigStrings::NAVIGATION = QStringLiteral("navigation");
-QString ConfigStrings::NOLINKERRORS = QStringLiteral("nolinkerrors");
-QString ConfigStrings::OBSOLETELINKS = QStringLiteral("obsoletelinks");
-QString ConfigStrings::OUTPUTDIR = QStringLiteral("outputdir");
-QString ConfigStrings::OUTPUTENCODING = QStringLiteral("outputencoding");
-QString ConfigStrings::OUTPUTLANGUAGE = QStringLiteral("outputlanguage");
-QString ConfigStrings::OUTPUTFORMATS = QStringLiteral("outputformats");
-QString ConfigStrings::OUTPUTPREFIXES = QStringLiteral("outputprefixes");
-QString ConfigStrings::OUTPUTSUFFIXES = QStringLiteral("outputsuffixes");
-QString ConfigStrings::PROJECT = QStringLiteral("project");
-QString ConfigStrings::REDIRECTDOCUMENTATIONTODEVNULL = QStringLiteral("redirectdocumentationtodevnull");
-QString ConfigStrings::QHP = QStringLiteral("qhp");
-QString ConfigStrings::QUOTINGINFORMATION = QStringLiteral("quotinginformation");
-QString ConfigStrings::SCRIPTDIRS = QStringLiteral("scriptdirs");
-QString ConfigStrings::SCRIPTS = QStringLiteral("scripts");
-QString ConfigStrings::SHOWINTERNAL = QStringLiteral("showinternal");
-QString ConfigStrings::SINGLEEXEC = QStringLiteral("singleexec");
-QString ConfigStrings::SOURCEDIRS = QStringLiteral("sourcedirs");
-QString ConfigStrings::SOURCEENCODING = QStringLiteral("sourceencoding");
-QString ConfigStrings::SOURCES = QStringLiteral("sources");
-QString ConfigStrings::SPURIOUS = QStringLiteral("spurious");
-QString ConfigStrings::STYLEDIRS = QStringLiteral("styledirs");
-QString ConfigStrings::STYLE = QStringLiteral("style");
-QString ConfigStrings::STYLES = QStringLiteral("styles");
-QString ConfigStrings::STYLESHEETS = QStringLiteral("stylesheets");
-QString ConfigStrings::SYNTAXHIGHLIGHTING = QStringLiteral("syntaxhighlighting");
-QString ConfigStrings::TEMPLATEDIR = QStringLiteral("templatedir");
-QString ConfigStrings::TABSIZE = QStringLiteral("tabsize");
-QString ConfigStrings::TAGFILE = QStringLiteral("tagfile");
-QString ConfigStrings::TRANSLATORS = QStringLiteral("translators");
-QString ConfigStrings::URL = QStringLiteral("url");
-QString ConfigStrings::VERSION = QStringLiteral("version");
-QString ConfigStrings::VERSIONSYM = QStringLiteral("versionsym");
-QString ConfigStrings::FILEEXTENSIONS = QStringLiteral("fileextensions");
-QString ConfigStrings::IMAGEEXTENSIONS = QStringLiteral("imageextensions");
-QString ConfigStrings::QMLONLY = QStringLiteral("qmlonly");
-QString ConfigStrings::QMLTYPESPAGE = QStringLiteral("qmltypespage");
-QString ConfigStrings::WRITEQAPAGES = QStringLiteral("writeqapages");
-
-/*!
- An entry in a stack, where each entry is a list
- of string values.
- */
-class MetaStackEntry
-{
-public:
- void open();
- void close();
-
- QStringList accum;
- QStringList next;
-};
-Q_DECLARE_TYPEINFO(MetaStackEntry, Q_MOVABLE_TYPE);
-
-/*!
- Start accumulating values in a list by appending an empty
- string to the list.
- */
-void MetaStackEntry::open()
-{
- next.append(QString());
-}
-
-/*!
- Stop accumulating values and append the list of accumulated
- values to the complete list of accumulated values.
-
- */
-void MetaStackEntry::close()
-{
- accum += next;
- next.clear();
-}
-
-/*!
- \class MetaStack
-
- This class maintains a stack of values of config file variables.
-*/
-class MetaStack : private QStack
-{
- Q_DECLARE_TR_FUNCTIONS(QDoc::MetaStack)
-
-public:
- MetaStack();
-
- void process(QChar ch, const Location& location);
- QStringList getExpanded(const Location& location);
-};
-
-/*!
- The default constructor pushes a new stack entry and
- opens it.
- */
-MetaStack::MetaStack()
-{
- push(MetaStackEntry());
- top().open();
-}
-
-/*!
- Processes the character \a ch using the \a location.
- It really just builds up a name by appending \a ch to
- it.
- */
-void MetaStack::process(QChar ch, const Location& location)
-{
- if (ch == QLatin1Char('{')) {
- push(MetaStackEntry());
- top().open();
- } else if (ch == QLatin1Char('}')) {
- if (count() == 1)
- location.fatal(tr("Unexpected '}'"));
-
- top().close();
- QStringList suffixes = pop().accum;
- QStringList prefixes = top().next;
-
- top().next.clear();
- QStringList::ConstIterator pre = prefixes.constBegin();
- while (pre != prefixes.constEnd()) {
- QStringList::ConstIterator suf = suffixes.constBegin();
- while (suf != suffixes.constEnd()) {
- top().next << (*pre + *suf);
- ++suf;
- }
- ++pre;
- }
- } else if (ch == QLatin1Char(',') && count() > 1) {
- top().close();
- top().open();
- } else {
- /*
- This is where all the processing is done.
- */
- QStringList::Iterator pre = top().next.begin();
- while (pre != top().next.end()) {
- *pre += ch;
- ++pre;
- }
- }
-}
-
-/*!
- Returns the accumulated string values.
- */
-QStringList MetaStack::getExpanded(const Location& location)
-{
- if (count() > 1)
- location.fatal(tr("Missing '}'"));
-
- top().close();
- return top().accum;
-}
-
-const QString Config::dot = QLatin1String(".");
-bool Config::debug_ = false;
-bool Config::generateExamples = true;
-QString Config::overrideOutputDir;
-QString Config::installDir;
-QSet Config::overrideOutputFormats;
-QMap Config::extractedDirs;
-int Config::numInstances;
-QStack Config::workingDirs_;
-QMap Config::includeFilesMap_;
-
-/*!
- \class Config
- \brief The Config class contains the configuration variables
- for controlling how qdoc produces documentation.
-
- Its load() function, reads, parses, and processes a qdocconf file.
- */
-
-/*!
- The constructor sets the \a programName and initializes all
- internal state variables to empty values.
- */
-Config::Config(const QString& programName)
- : prog(programName)
-{
- loc = Location::null;
- lastLocation_ = Location::null;
- configVars_.clear();
- numInstances++;
- includeFilesMap_.clear();
-}
-
-/*!
- The destructor has nothing special to do.
- */
-Config::~Config()
-{
- includeFilesMap_.clear();
-}
-
-/*!
- Loads and parses the qdoc configuration file \a fileName.
- This function calls the other load() function, which does
- the loading, parsing, and processing of the configuration
- file.
-
- Intializes the location variables returned by location()
- and lastLocation().
- */
-void Config::load(const QString& fileName)
-{
- load(Location::null, fileName);
- if (loc.isEmpty())
- loc = Location(fileName);
- else
- loc.setEtc(true);
- lastLocation_ = Location::null;
-}
-
-/*!
- Joins all the strings in \a values into a single string with the
- individual \a values separated by ' '. Then it inserts the result
- into the string list map with \a var as the key.
-
- It also inserts the \a values string list into a separate map,
- also with \a var as the key.
- */
-void Config::setStringList(const QString& var, const QStringList& values)
-{
- configVars_.insert(var,ConfigVar(var, values, QDir::currentPath()));
-}
-
-/*!
- Looks up the configuarion variable \a var in the string
- map and returns the boolean value.
- */
-bool Config::getBool(const QString& var) const
-{
- return QVariant(getString(var)).toBool();
-}
-
-/*!
- Looks up the configuration variable \a var in the string list
- map. Iterates through the string list found, interpreting each
- string in the list as an integer and adding it to a total sum.
- Returns the sum or \c -1 if \a var is not set.
- */
-int Config::getInt(const QString& var) const
-{
- QStringList strs = getStringList(var);
- if (strs.isEmpty())
- return -1;
-
- QStringList::ConstIterator s = strs.constBegin();
- int sum = 0;
-
- while (s != strs.constEnd()) {
- sum += (*s).toInt();
- ++s;
- }
- return sum;
-}
-
-/*!
- Function to return the correct outputdir.
- outputdir can be set using the qdocconf or the command-line
- variable -outputdir.
- */
-QString Config::getOutputDir() const
-{
- QString t;
- if (overrideOutputDir.isNull())
- t = getString(CONFIG_OUTPUTDIR);
- else
- t = overrideOutputDir;
- if (Generator::singleExec()) {
- QString project = getString(CONFIG_PROJECT);
- t += QLatin1Char('/') + project.toLower();
- }
- if (!Generator::useOutputSubdirs()) {
- t = t.left(t.lastIndexOf('/'));
- QString singleOutputSubdir = getString("HTML.outputsubdir");
- if (singleOutputSubdir.isEmpty())
- singleOutputSubdir = "html";
- t += QLatin1Char('/') + singleOutputSubdir;
- }
- return t;
-}
-
-/*!
- Function to return the correct outputformats.
- outputformats can be set using the qdocconf or the command-line
- variable -outputformat.
- */
-QSet Config::getOutputFormats() const
-{
- if (overrideOutputFormats.isEmpty())
- return getStringSet(CONFIG_OUTPUTFORMATS);
- else
- return overrideOutputFormats;
-}
-
-/*!
- First, this function looks up the configuration variable \a var
- in the location map and, if found, sets the internal variable
- \c{lastLocation_} to the Location that \a var maps to.
-
- Then it looks up the configuration variable \a var in the string
- map and returns the string that \a var maps to.
- */
-QString Config::getString(const QString& var) const
-{
- QList configVars = configVars_.values(var);
- QString value;
- if (!configVars.empty()) {
- int i = configVars.size() - 1;
- while (i >= 0) {
- const ConfigVar& cv = configVars[i];
- if (!cv.location_.isEmpty())
- const_cast(this)->lastLocation_ = cv.location_;
- if (!cv.values_.isEmpty()) {
- if (!cv.plus_)
- value.clear();
- for (int j=0; j Config::getStringSet(const QString& var) const
-{
- return QSet::fromList(getStringList(var));
-}
-
-/*!
- First, this function looks up the configuration variable \a var
- in the location map. If found, it sets the internal variable
- \c{lastLocation_} to the Location that \a var maps to.
-
- Then it looks up the configuration variable \a var in the map of
- configuration variable records. If found, it gets a list of all
- the records for \a var. Then it appends all the values for \a var
- to a list and returns the list. As it appends the values from each
- record, if the \a var used '=' instead of '+=' the list is cleared
- before the values are appended. \note '+=' should always be used.
- The final list is returned.
- */
-QStringList Config::getStringList(const QString& var) const
-{
- QList configVars = configVars_.values(var);
- QStringList values;
- if (!configVars.empty()) {
- int i = configVars.size() - 1;
- while (i >= 0) {
- if (!configVars[i].location_.isEmpty())
- const_cast(this)->lastLocation_ = configVars[i].location_;
- if (configVars[i].plus_)
- values.append(configVars[i].values_);
- else
- values = configVars[i].values_;
- --i;
- }
- }
- return values;
-}
-
-/*!
- Returns the a path list where all paths from the config variable \a var
- are canonicalized. If \a validate is true, a warning for invalid paths is
- generated.
-
- First, this function looks up the configuration variable \a var
- in the location map and, if found, sets the internal variable
- \c{lastLocation_} the Location that \a var maps to.
-
- Then it looks up the configuration variable \a var in the string
- list map, which maps to one or more records that each contains a
- list of file paths.
-
- \sa Location::canonicalRelativePath()
- */
-QStringList Config::getCanonicalPathList(const QString& var, bool validate) const
-{
- QStringList t;
- QList configVars = configVars_.values(var);
- if (!configVars.empty()) {
- int i = configVars.size() - 1;
- while (i >= 0) {
- const ConfigVar& cv = configVars[i];
- if (!cv.location_.isEmpty())
- const_cast(this)->lastLocation_ = cv.location_;
- if (!cv.plus_)
- t.clear();
- const QString d = cv.currentPath_;
- const QStringList& sl = cv.values_;
- if (!sl.isEmpty()) {
- t.reserve(t.size() + sl.size());
- for (int i=0; i subRegExps = getRegExpList(var);
- QList::ConstIterator s = subRegExps.constBegin();
-
- while (s != subRegExps.constEnd()) {
- if (!(*s).isValid())
- return *s;
- if (!pattern.isEmpty())
- pattern += QLatin1Char('|');
- pattern += QLatin1String("(?:") + (*s).pattern() + QLatin1Char(')');
- ++s;
- }
- if (pattern.isEmpty())
- pattern = QLatin1String("$x"); // cannot match
- return QRegExp(pattern);
-}
-
-/*!
- Looks up the configuration variable \a var in the string list
- map, converts the string list to a list of regular expressions,
- and returns it.
- */
-QList Config::getRegExpList(const QString& var) const
-{
- QStringList strs = getStringList(var);
- QStringList::ConstIterator s = strs.constBegin();
- QList regExps;
-
- while (s != strs.constEnd()) {
- regExps += QRegExp(*s);
- ++s;
- }
- return regExps;
-}
-
-/*!
- This function is slower than it could be. What it does is
- find all the keys that begin with \a var + dot and return
- the matching keys in a set, stripped of the matching prefix
- and dot.
- */
-QSet Config::subVars(const QString& var) const
-{
- QSet result;
- QString varDot = var + QLatin1Char('.');
- ConfigVarMultimap::ConstIterator i = configVars_.constBegin();
- while (i != configVars_.constEnd()) {
- if (i.key().startsWith(varDot)) {
- QString subVar = i.key().mid(varDot.length());
- int dot = subVar.indexOf(QLatin1Char('.'));
- if (dot != -1)
- subVar.truncate(dot);
- if (!result.contains(subVar))
- result.insert(subVar);
- }
- ++i;
- }
- return result;
-}
-
-/*!
- Same as subVars(), but in this case we return a config var
- multimap with the matching keys (stripped of the prefix \a var
- and mapped to their values. The pairs are inserted into \a t
- */
-void Config::subVarsAndValues(const QString& var, ConfigVarMultimap& t) const
-{
- QString varDot = var + QLatin1Char('.');
- ConfigVarMultimap::ConstIterator v = configVars_.constBegin();
- while (v != configVars_.constEnd()) {
- if (v.key().startsWith(varDot)) {
- QString subVar = v.key().mid(varDot.length());
- int dot = subVar.indexOf(QLatin1Char('.'));
- if (dot != -1)
- subVar.truncate(dot);
- t.insert(subVar,v.value());
- }
- ++v;
- }
-}
-
-/*!
- Get all .qdocinc files.
- */
-QString Config::getIncludeFilePath(const QString& fileName) const
-{
- QString ext = fileName.mid(fileName.lastIndexOf('.'));
- ext.prepend('*');
-
- if (!includeFilesMap_.contains(ext)) {
- QSet t;
- QStringList result;
- QStringList dirs = getCanonicalPathList(CONFIG_SOURCEDIRS);
- QStringList::ConstIterator d = dirs.constBegin();
- while (d != dirs.constEnd()) {
- result += getFilesHere(*d, ext, location(), t, t);
- ++d;
- }
- includeFilesMap_.insert(ext, result);
- }
- const QStringList& paths = (*includeFilesMap_.find(ext));
- for (int i=0; i &excludedDirs,
- const QSet &excludedFiles)
-{
- QStringList result = getCanonicalPathList(filesVar);
- QStringList dirs = getCanonicalPathList(dirsVar);
-
- QString nameFilter = getString(filesVar + dot + CONFIG_FILEEXTENSIONS);
-
- QStringList::ConstIterator d = dirs.constBegin();
- while (d != dirs.constEnd()) {
- result += getFilesHere(*d, nameFilter, location(), excludedDirs, excludedFiles);
- ++d;
- }
- return result;
-}
-
-QStringList Config::getExampleQdocFiles(const QSet &excludedDirs,
- const QSet &excludedFiles)
-{
- QStringList result;
- QStringList dirs = getCanonicalPathList("exampledirs");
- QString nameFilter = " *.qdoc";
-
- QStringList::ConstIterator d = dirs.constBegin();
- while (d != dirs.constEnd()) {
- result += getFilesHere(*d, nameFilter, location(), excludedDirs, excludedFiles);
- ++d;
- }
- return result;
-}
-
-QStringList Config::getExampleImageFiles(const QSet &excludedDirs,
- const QSet &excludedFiles)
-{
- QStringList result;
- QStringList dirs = getCanonicalPathList("exampledirs");
- QString nameFilter = getString(CONFIG_EXAMPLES + dot + CONFIG_IMAGEEXTENSIONS);
-
- QStringList::ConstIterator d = dirs.constBegin();
- while (d != dirs.constEnd()) {
- result += getFilesHere(*d, nameFilter, location(), excludedDirs, excludedFiles);
- ++d;
- }
- return result;
-}
-
-/*!
- \a fileName is the path of the file to find.
-
- \a files and \a dirs are the lists where we must find the
- components of \a fileName.
-
- \a location is used for obtaining the file and line numbers
- for report qdoc errors.
- */
-QString Config::findFile(const Location& location,
- const QStringList& files,
- const QStringList& dirs,
- const QString& fileName,
- QString& userFriendlyFilePath)
-{
- if (fileName.isEmpty() || fileName.startsWith(QLatin1Char('/'))) {
- userFriendlyFilePath = fileName;
- return fileName;
- }
-
- QFileInfo fileInfo;
- QStringList components = fileName.split(QLatin1Char('?'));
- QString firstComponent = components.first();
-
- QStringList::ConstIterator f = files.constBegin();
- while (f != files.constEnd()) {
- if (*f == firstComponent ||
- (*f).endsWith(QLatin1Char('/') + firstComponent)) {
- fileInfo.setFile(*f);
- if (!fileInfo.exists())
- location.fatal(tr("File '%1' does not exist").arg(*f));
- break;
- }
- ++f;
- }
-
- if (fileInfo.fileName().isEmpty()) {
- QStringList::ConstIterator d = dirs.constBegin();
- while (d != dirs.constEnd()) {
- fileInfo.setFile(QDir(*d), firstComponent);
- if (fileInfo.exists())
- break;
- ++d;
- }
- }
-
- userFriendlyFilePath = QString();
- if (!fileInfo.exists())
- return QString();
-
- QStringList::ConstIterator c = components.constBegin();
- for (;;) {
- bool isArchive = (c != components.constEnd() - 1);
- QString userFriendly = *c;
-
- userFriendlyFilePath += userFriendly;
-
- if (isArchive) {
- QString extracted = extractedDirs[fileInfo.filePath()];
- ++c;
- fileInfo.setFile(QDir(extracted), *c);
- } else {
- break;
- }
-
- userFriendlyFilePath += QLatin1Char('?');
- }
- return fileInfo.filePath();
-}
-
-/*!
- */
-QString Config::findFile(const Location& location,
- const QStringList& files,
- const QStringList& dirs,
- const QString& fileBase,
- const QStringList& fileExtensions,
- QString& userFriendlyFilePath)
-{
- QStringList::ConstIterator e = fileExtensions.constBegin();
- while (e != fileExtensions.constEnd()) {
- QString filePath = findFile(location,
- files,
- dirs,
- fileBase + QLatin1Char('.') + *e,
- userFriendlyFilePath);
- if (!filePath.isEmpty())
- return filePath;
- ++e;
- }
- return findFile(location, files, dirs, fileBase, userFriendlyFilePath);
-}
-
-/*!
- Copies the \a sourceFilePath to the file name constructed by
- concatenating \a targetDirPath and the file name from the
- \a userFriendlySourceFilePath. \a location is for identifying
- the file and line number where a qdoc error occurred. The
- constructed output file name is returned.
- */
-QString Config::copyFile(const Location& location,
- const QString& sourceFilePath,
- const QString& userFriendlySourceFilePath,
- const QString& targetDirPath)
-{
- QFile inFile(sourceFilePath);
- if (!inFile.open(QFile::ReadOnly)) {
- location.warning(tr("Cannot open input file for copy: '%1': %2")
- .arg(sourceFilePath).arg(inFile.errorString()));
- return QString();
- }
-
- QString outFileName = userFriendlySourceFilePath;
- int slash = outFileName.lastIndexOf(QLatin1Char('/'));
- if (slash != -1)
- outFileName = outFileName.mid(slash);
- if ((outFileName.size()) > 0 && (outFileName[0] != '/'))
- outFileName = targetDirPath + QLatin1Char('/') + outFileName;
- else
- outFileName = targetDirPath + outFileName;
- QFile outFile(outFileName);
- if (!outFile.open(QFile::WriteOnly)) {
- location.warning(tr("Cannot open output file for copy: '%1': %2")
- .arg(outFileName).arg(outFile.errorString()));
- return QString();
- }
-
- char buffer[1024];
- int len;
- while ((len = inFile.read(buffer, sizeof(buffer))) > 0)
- outFile.write(buffer, len);
- return outFileName;
-}
-
-/*!
- Finds the largest unicode digit in \a value in the range
- 1..7 and returns it.
- */
-int Config::numParams(const QString& value)
-{
- int max = 0;
- for (int i = 0; i != value.length(); i++) {
- uint c = value[i].unicode();
- if (c > 0 && c < 8)
- max = qMax(max, (int)c);
- }
- return max;
-}
-
-/*!
- Removes everything from \a dir. This function is recursive.
- It doesn't remove \a dir itself, but if it was called
- recursively, then the caller will remove \a dir.
- */
-bool Config::removeDirContents(const QString& dir)
-{
- QDir dirInfo(dir);
- QFileInfoList entries = dirInfo.entryInfoList();
-
- bool ok = true;
-
- QFileInfoList::Iterator it = entries.begin();
- while (it != entries.end()) {
- if ((*it).isFile()) {
- if (!dirInfo.remove((*it).fileName()))
- ok = false;
- }
- else if ((*it).isDir()) {
- if ((*it).fileName() != QLatin1String(".") && (*it).fileName() != QLatin1String("..")) {
- if (removeDirContents((*it).absoluteFilePath())) {
- if (!dirInfo.rmdir((*it).fileName()))
- ok = false;
- }
- else {
- ok = false;
- }
- }
- }
- ++it;
- }
- return ok;
-}
-
-/*!
- Returns \c true if \a ch is a letter, number, '_', '.',
- '{', '}', or ','.
- */
-bool Config::isMetaKeyChar(QChar ch)
-{
- return ch.isLetterOrNumber()
- || ch == QLatin1Char('_')
- || ch == QLatin1Char('.')
- || ch == QLatin1Char('{')
- || ch == QLatin1Char('}')
- || ch == QLatin1Char(',');
-}
-
-/*!
- \a fileName is a master qdocconf file. It contains a list of
- qdocconf files and nothing else. Read the list and return it.
- */
-QStringList Config::loadMaster(const QString& fileName)
-{
- Location location = Location::null;
- QFile fin(fileName);
- if (!fin.open(QFile::ReadOnly | QFile::Text)) {
- if (!Config::installDir.isEmpty()) {
- int prefix = location.filePath().length() - location.fileName().length();
- fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix));
- }
- if (!fin.open(QFile::ReadOnly | QFile::Text))
- location.fatal(tr("Cannot open master qdocconf file '%1': %2").arg(fileName).arg(fin.errorString()));
- }
- QTextStream stream(&fin);
-#ifndef QT_NO_TEXTCODEC
- stream.setCodec("UTF-8");
-#endif
- QStringList qdocFiles;
- QString line = stream.readLine();
- while (!line.isNull()) {
- qdocFiles.append(line);
- line = stream.readLine();
- }
- fin.close();
- return qdocFiles;
-}
-
-/*!
- Load, parse, and process a qdoc configuration file. This
- function is only called by the other load() function, but
- this one is recursive, i.e., it calls itself when it sees
- an \c{include} statement in the qdoc configuration file.
- */
-void Config::load(Location location, const QString& fileName)
-{
- QFileInfo fileInfo(fileName);
- QString path = fileInfo.canonicalPath();
- pushWorkingDir(path);
- QDir::setCurrent(path);
- QRegExp keySyntax(QLatin1String("\\w+(?:\\.\\w+)*"));
-
-#define SKIP_CHAR() \
- do { \
- location.advance(c); \
- ++i; \
- c = text.at(i); \
- cc = c.unicode(); \
-} while (0)
-
-#define SKIP_SPACES() \
- while (c.isSpace() && cc != '\n') \
- SKIP_CHAR()
-
-#define PUT_CHAR() \
- word += c; \
- SKIP_CHAR();
-
- if (location.depth() > 16)
- location.fatal(tr("Too many nested includes"));
-
- QFile fin(fileInfo.fileName());
- if (!fin.open(QFile::ReadOnly | QFile::Text)) {
- if (!Config::installDir.isEmpty()) {
- int prefix = location.filePath().length() - location.fileName().length();
- fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix));
- }
- if (!fin.open(QFile::ReadOnly | QFile::Text))
- location.fatal(tr("Cannot open file '%1': %2").arg(fileName).arg(fin.errorString()));
- }
-
- QTextStream stream(&fin);
-#ifndef QT_NO_TEXTCODEC
- stream.setCodec("UTF-8");
-#endif
- QString text = stream.readAll();
- text += QLatin1String("\n\n");
- text += QLatin1Char('\0');
- fin.close();
-
- location.push(fileName);
- location.start();
-
- int i = 0;
- QChar c = text.at(0);
- uint cc = c.unicode();
- while (i < (int) text.length()) {
- if (cc == 0) {
- ++i;
- } else if (c.isSpace()) {
- SKIP_CHAR();
- } else if (cc == '#') {
- do {
- SKIP_CHAR();
- } while (cc != '\n');
- } else if (isMetaKeyChar(c)) {
- Location keyLoc = location;
- bool plus = false;
- QString stringValue;
- QStringList rhsValues;
- QString word;
- bool inQuote = false;
- bool prevWordQuoted = true;
- bool metWord = false;
-
- MetaStack stack;
- do {
- stack.process(c, location);
- SKIP_CHAR();
- } while (isMetaKeyChar(c));
-
- QStringList keys = stack.getExpanded(location);
- SKIP_SPACES();
-
- if (keys.count() == 1 && keys.first() == QLatin1String("include")) {
- QString includeFile;
-
- if (cc != '(')
- location.fatal(tr("Bad include syntax"));
- SKIP_CHAR();
- SKIP_SPACES();
-
- while (!c.isSpace() && cc != '#' && cc != ')') {
-
- if (cc == '$') {
- QString var;
- SKIP_CHAR();
- while (c.isLetterOrNumber() || cc == '_') {
- var += c;
- SKIP_CHAR();
- }
- if (!var.isEmpty()) {
- const QByteArray val = qgetenv(var.toLatin1().data());
- if (val.isNull()) {
- location.fatal(tr("Environment variable '%1' undefined").arg(var));
- }
- else {
- includeFile += QString::fromLatin1(val);
- }
- }
- } else {
- includeFile += c;
- SKIP_CHAR();
- }
- }
- SKIP_SPACES();
- if (cc != ')')
- location.fatal(tr("Bad include syntax"));
- SKIP_CHAR();
- SKIP_SPACES();
- if (cc != '#' && cc != '\n')
- location.fatal(tr("Trailing garbage"));
-
- /*
- Here is the recursive call.
- */
- load(location, QFileInfo(QDir(path), includeFile).filePath());
- }
- else {
- /*
- It wasn't an include statement, so it's something else.
- We must see either '=' or '+=' next. If not, fatal error.
- */
- if (cc == '+') {
- plus = true;
- SKIP_CHAR();
- }
- if (cc != '=')
- location.fatal(tr("Expected '=' or '+=' after key"));
- SKIP_CHAR();
- SKIP_SPACES();
-
- for (;;) {
- if (cc == '\\') {
- int metaCharPos;
-
- SKIP_CHAR();
- if (cc == '\n') {
- SKIP_CHAR();
- }
- else if (cc > '0' && cc < '8') {
- word += QChar(c.digitValue());
- SKIP_CHAR();
- }
- else if ((metaCharPos = QString::fromLatin1("abfnrtv").indexOf(c)) != -1) {
- word += QLatin1Char("\a\b\f\n\r\t\v"[metaCharPos]);
- SKIP_CHAR();
- }
- else {
- PUT_CHAR();
- }
- }
- else if (c.isSpace() || cc == '#') {
- if (inQuote) {
- if (cc == '\n')
- location.fatal(tr("Unterminated string"));
- PUT_CHAR();
- }
- else {
- if (!word.isEmpty()) {
- if (metWord)
- stringValue += QLatin1Char(' ');
- stringValue += word;
-#if 0
- if (metWord)
- rhsValues << QString(" " + word);
- else
-#endif
- rhsValues << word;
- metWord = true;
- word.clear();
- prevWordQuoted = false;
- }
- if (cc == '\n' || cc == '#')
- break;
- SKIP_SPACES();
- }
- }
- else if (cc == '"') {
- if (inQuote) {
- if (!prevWordQuoted)
- stringValue += QLatin1Char(' ');
- stringValue += word;
- if (!word.isEmpty())
- rhsValues << word;
- metWord = true;
- word.clear();
- prevWordQuoted = true;
- }
- inQuote = !inQuote;
- SKIP_CHAR();
- }
- else if (cc == '$') {
- QString var;
- SKIP_CHAR();
- while (c.isLetterOrNumber() || cc == '_') {
- var += c;
- SKIP_CHAR();
- }
- if (!var.isEmpty()) {
- const QByteArray val = qgetenv(var.toLatin1().constData());
- if (val.isNull()) {
- location.fatal(tr("Environment variable '%1' undefined").arg(var));
- }
- else {
- word += QString::fromLatin1(val);
- }
- }
- }
- else {
- if (!inQuote && cc == '=')
- location.fatal(tr("Unexpected '='"));
- PUT_CHAR();
- }
- }
-
- QStringList::ConstIterator key = keys.constBegin();
- while (key != keys.constEnd()) {
- if (!keySyntax.exactMatch(*key))
- keyLoc.fatal(tr("Invalid key '%1'").arg(*key));
-
- ConfigVarMultimap::Iterator i;
- i = configVars_.insert(*key, ConfigVar(*key, rhsValues, QDir::currentPath(), keyLoc));
- i.value().plus_ = plus;
- ++key;
- }
- }
- } else {
- location.fatal(tr("Unexpected character '%1' at beginning of line").arg(c));
- }
- }
- popWorkingDir();
- if (!workingDirs_.isEmpty())
- QDir::setCurrent(workingDirs_.top());
-}
-
-QStringList Config::getFilesHere(const QString& uncleanDir,
- const QString& nameFilter,
- const Location &location,
- const QSet &excludedDirs,
- const QSet &excludedFiles)
-{
- QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : QDir(uncleanDir).canonicalPath();
- QStringList result;
- if (excludedDirs.contains(dir))
- return result;
-
- QDir dirInfo(dir);
- QStringList fileNames;
- QStringList::const_iterator fn;
-
- dirInfo.setNameFilters(nameFilter.split(QLatin1Char(' ')));
- dirInfo.setSorting(QDir::Name);
- dirInfo.setFilter(QDir::Files);
- fileNames = dirInfo.entryList();
- fn = fileNames.constBegin();
- while (fn != fileNames.constEnd()) {
- if (!fn->startsWith(QLatin1Char('~'))) {
- QString s = dirInfo.filePath(*fn);
- QString c = QDir::cleanPath(s);
- if (!excludedFiles.contains(c))
- result.append(c);
- }
- ++fn;
- }
-
- dirInfo.setNameFilters(QStringList(QLatin1String("*")));
- dirInfo.setFilter(QDir::Dirs|QDir::NoDotAndDotDot);
- fileNames = dirInfo.entryList();
- fn = fileNames.constBegin();
- while (fn != fileNames.constEnd()) {
- result += getFilesHere(dirInfo.filePath(*fn), nameFilter, location, excludedDirs, excludedFiles);
- ++fn;
- }
- return result;
-}
-
-/*!
- Push \a dir onto the stack of working directories.
- */
-void Config::pushWorkingDir(const QString& dir)
-{
- workingDirs_.push(dir);
-}
-
-/*!
- If the stack of working directories is not empty, pop the
- top entry and return it. Otherwise return an empty string.
- */
-QString Config::popWorkingDir()
-{
- if (!workingDirs_.isEmpty())
- return workingDirs_.pop();
-
- qDebug() << "RETURNED EMPTY WORKING DIR";
- return QString();
-}
-
-QT_END_NAMESPACE
diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h
deleted file mode 100644
index 740568ca0c..0000000000
--- a/src/tools/qdoc/config.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- config.h
-*/
-
-#ifndef CONFIG_H
-#define CONFIG_H
-
-#include
-#include
-#include
-#include
-#include
-#include "location.h"
-
-QT_BEGIN_NAMESPACE
-
-/*
- This struct contains all the information for
- one config variable found in a qdocconf file.
- */
-struct ConfigVar {
- bool plus_;
- QString name_;
- QStringList values_;
- QString currentPath_;
- Location location_;
-
- ConfigVar() : plus_(false) { }
-
- ConfigVar(const QString& name, const QStringList& values, const QString& dir)
- : plus_(true), name_(name), values_(values), currentPath_(dir) { }
-
- ConfigVar(const QString& name, const QStringList& values, const QString& dir, const Location& loc)
- : plus_(false), name_(name), values_(values), currentPath_(dir), location_(loc) { }
-};
-
-/*
- In this multimap, the key is a config variable name.
- */
-typedef QMultiMap ConfigVarMultimap;
-
-class Config
-{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Config)
-
-public:
- Config(const QString& programName);
- ~Config();
-
- static bool debug_;
-
- void load(const QString& fileName);
- void setStringList(const QString& var, const QStringList& values);
-
- const QString& programName() const { return prog; }
- const Location& location() const { return loc; }
- const Location& lastLocation() const { return lastLocation_; }
- bool getBool(const QString& var) const;
- int getInt(const QString& var) const;
- QString getOutputDir() const;
- QSet getOutputFormats() const;
- QString getString(const QString& var) const;
- QSet getStringSet(const QString& var) const;
- QStringList getStringList(const QString& var) const;
- QStringList getCanonicalPathList(const QString& var, bool validate = false) const;
- QRegExp getRegExp(const QString& var) const;
- QList getRegExpList(const QString& var) const;
- QSet subVars(const QString& var) const;
- void subVarsAndValues(const QString& var, ConfigVarMultimap& t) const;
- QStringList getAllFiles(const QString& filesVar,
- const QString& dirsVar,
- const QSet &excludedDirs = QSet(),
- const QSet &excludedFiles = QSet());
- QString getIncludeFilePath(const QString& fileName) const;
- QStringList getExampleQdocFiles(const QSet &excludedDirs, const QSet &excludedFiles);
- QStringList getExampleImageFiles(const QSet &excludedDirs, const QSet &excludedFiles);
-
- static QStringList loadMaster(const QString& fileName);
- static QStringList getFilesHere(const QString& dir,
- const QString& nameFilter,
- const Location &location = Location(),
- const QSet &excludedDirs = QSet(),
- const QSet &excludedFiles = QSet());
- static QString findFile(const Location& location,
- const QStringList &files,
- const QStringList& dirs,
- const QString& fileName,
- QString& userFriendlyFilePath);
- static QString findFile(const Location &location,
- const QStringList &files,
- const QStringList &dirs,
- const QString &fileBase,
- const QStringList &fileExtensions,
- QString &userFriendlyFilePath);
- static QString copyFile(const Location& location,
- const QString& sourceFilePath,
- const QString& userFriendlySourceFilePath,
- const QString& targetDirPath);
- static int numParams(const QString& value);
- static bool removeDirContents(const QString& dir);
- static void pushWorkingDir(const QString& dir);
- static QString popWorkingDir();
-
- static const QString dot;
-
- static bool generateExamples;
- static QString installDir;
- static QString overrideOutputDir;
- static QSet overrideOutputFormats;
-
-private:
- static bool isMetaKeyChar(QChar ch);
- void load(Location location, const QString& fileName);
-
- QString prog;
- Location loc;
- Location lastLocation_;
- ConfigVarMultimap configVars_;
-
- static QMap uncompressedFiles;
- static QMap extractedDirs;
- static int numInstances;
- static QStack workingDirs_;
- static QMap includeFilesMap_;
-};
-
-struct ConfigStrings
-{
- static QString ALIAS;
- static QString AUTOLINKERRORS;
- static QString BASE;
- static QString BASEDIR;
- static QString BUILDVERSION;
- static QString CODEINDENT;
- static QString CODEPREFIX;
- static QString CODESUFFIX;
- static QString CPPCLASSESPAGE;
- static QString DEFINES;
- static QString DEPENDS;
- static QString DESCRIPTION;
- static QString EDITION;
- static QString ENDHEADER;
- static QString EXAMPLEDIRS;
- static QString EXAMPLES;
- static QString EXAMPLESINSTALLPATH;
- static QString EXCLUDEDIRS;
- static QString EXCLUDEFILES;
- static QString EXTRAIMAGES;
- static QString FALSEHOODS;
- static QString FORMATTING;
- static QString GENERATEINDEX;
- static QString HEADERDIRS;
- static QString HEADERS;
- static QString HEADERSCRIPTS;
- static QString HEADERSTYLES;
- static QString HOMEPAGE;
- static QString IGNOREDIRECTIVES;
- static QString IGNORETOKENS;
- static QString IMAGEDIRS;
- static QString IMAGES;
- static QString INDEXES;
- static QString LANDINGPAGE;
- static QString LANGUAGE;
- static QString MACRO;
- static QString MANIFESTMETA;
- static QString NATURALLANGUAGE;
- static QString NAVIGATION;
- static QString NOLINKERRORS;
- static QString OBSOLETELINKS;
- static QString OUTPUTDIR;
- static QString OUTPUTENCODING;
- static QString OUTPUTLANGUAGE;
- static QString OUTPUTFORMATS;
- static QString OUTPUTPREFIXES;
- static QString OUTPUTSUFFIXES;
- static QString PROJECT;
- static QString REDIRECTDOCUMENTATIONTODEVNULL;
- static QString QHP;
- static QString QUOTINGINFORMATION;
- static QString SCRIPTDIRS;
- static QString SCRIPTS;
- static QString SHOWINTERNAL;
- static QString SINGLEEXEC;
- static QString SOURCEDIRS;
- static QString SOURCEENCODING;
- static QString SOURCES;
- static QString SPURIOUS;
- static QString STYLEDIRS;
- static QString STYLE;
- static QString STYLES;
- static QString STYLESHEETS;
- static QString SYNTAXHIGHLIGHTING;
- static QString TEMPLATEDIR;
- static QString TABSIZE;
- static QString TAGFILE;
- static QString TRANSLATORS;
- static QString URL;
- static QString VERSION;
- static QString VERSIONSYM;
- static QString FILEEXTENSIONS;
- static QString IMAGEEXTENSIONS;
- static QString QMLONLY;
- static QString QMLTYPESPAGE;
- static QString WRITEQAPAGES;
-};
-
-#define CONFIG_ALIAS ConfigStrings::ALIAS
-#define CONFIG_AUTOLINKERRORS ConfigStrings::AUTOLINKERRORS
-#define CONFIG_BASE ConfigStrings::BASE
-#define CONFIG_BASEDIR ConfigStrings::BASEDIR
-#define CONFIG_BUILDVERSION ConfigStrings::BUILDVERSION
-#define CONFIG_CODEINDENT ConfigStrings::CODEINDENT
-#define CONFIG_CODEPREFIX ConfigStrings::CODEPREFIX
-#define CONFIG_CODESUFFIX ConfigStrings::CODESUFFIX
-#define CONFIG_CPPCLASSESPAGE ConfigStrings::CPPCLASSESPAGE
-#define CONFIG_DEFINES ConfigStrings::DEFINES
-#define CONFIG_DEPENDS ConfigStrings::DEPENDS
-#define CONFIG_DESCRIPTION ConfigStrings::DESCRIPTION
-#define CONFIG_EDITION ConfigStrings::EDITION
-#define CONFIG_ENDHEADER ConfigStrings::ENDHEADER
-#define CONFIG_EXAMPLEDIRS ConfigStrings::EXAMPLEDIRS
-#define CONFIG_EXAMPLES ConfigStrings::EXAMPLES
-#define CONFIG_EXAMPLESINSTALLPATH ConfigStrings::EXAMPLESINSTALLPATH
-#define CONFIG_EXCLUDEDIRS ConfigStrings::EXCLUDEDIRS
-#define CONFIG_EXCLUDEFILES ConfigStrings::EXCLUDEFILES
-#define CONFIG_EXTRAIMAGES ConfigStrings::EXTRAIMAGES
-#define CONFIG_FALSEHOODS ConfigStrings::FALSEHOODS
-#define CONFIG_FORMATTING ConfigStrings::FORMATTING
-#define CONFIG_GENERATEINDEX ConfigStrings::GENERATEINDEX
-#define CONFIG_HEADERDIRS ConfigStrings::HEADERDIRS
-#define CONFIG_HEADERS ConfigStrings::HEADERS
-#define CONFIG_HEADERSCRIPTS ConfigStrings::HEADERSCRIPTS
-#define CONFIG_HEADERSTYLES ConfigStrings::HEADERSTYLES
-#define CONFIG_HOMEPAGE ConfigStrings::HOMEPAGE
-#define CONFIG_IGNOREDIRECTIVES ConfigStrings::IGNOREDIRECTIVES
-#define CONFIG_IGNORETOKENS ConfigStrings::IGNORETOKENS
-#define CONFIG_IMAGEDIRS ConfigStrings::IMAGEDIRS
-#define CONFIG_IMAGES ConfigStrings::IMAGES
-#define CONFIG_INDEXES ConfigStrings::INDEXES
-#define CONFIG_LANDINGPAGE ConfigStrings::LANDINGPAGE
-#define CONFIG_LANGUAGE ConfigStrings::LANGUAGE
-#define CONFIG_MACRO ConfigStrings::MACRO
-#define CONFIG_MANIFESTMETA ConfigStrings::MANIFESTMETA
-#define CONFIG_NATURALLANGUAGE ConfigStrings::NATURALLANGUAGE
-#define CONFIG_NAVIGATION ConfigStrings::NAVIGATION
-#define CONFIG_NOLINKERRORS ConfigStrings::NOLINKERRORS
-#define CONFIG_OBSOLETELINKS ConfigStrings::OBSOLETELINKS
-#define CONFIG_OUTPUTDIR ConfigStrings::OUTPUTDIR
-#define CONFIG_OUTPUTENCODING ConfigStrings::OUTPUTENCODING
-#define CONFIG_OUTPUTLANGUAGE ConfigStrings::OUTPUTLANGUAGE
-#define CONFIG_OUTPUTFORMATS ConfigStrings::OUTPUTFORMATS
-#define CONFIG_OUTPUTPREFIXES ConfigStrings::OUTPUTPREFIXES
-#define CONFIG_OUTPUTSUFFIXES ConfigStrings::OUTPUTSUFFIXES
-#define CONFIG_PROJECT ConfigStrings::PROJECT
-#define CONFIG_REDIRECTDOCUMENTATIONTODEVNULL ConfigStrings::REDIRECTDOCUMENTATIONTODEVNULL
-#define CONFIG_QHP ConfigStrings::QHP
-#define CONFIG_QUOTINGINFORMATION ConfigStrings::QUOTINGINFORMATION
-#define CONFIG_SCRIPTDIRS ConfigStrings::SCRIPTDIRS
-#define CONFIG_SCRIPTS ConfigStrings::SCRIPTS
-#define CONFIG_SHOWINTERNAL ConfigStrings::SHOWINTERNAL
-#define CONFIG_SINGLEEXEC ConfigStrings::SINGLEEXEC
-#define CONFIG_SOURCEDIRS ConfigStrings::SOURCEDIRS
-#define CONFIG_SOURCEENCODING ConfigStrings::SOURCEENCODING
-#define CONFIG_SOURCES ConfigStrings::SOURCES
-#define CONFIG_SPURIOUS ConfigStrings::SPURIOUS
-#define CONFIG_STYLEDIRS ConfigStrings::STYLEDIRS
-#define CONFIG_STYLE ConfigStrings::STYLE
-#define CONFIG_STYLES ConfigStrings::STYLES
-#define CONFIG_STYLESHEETS ConfigStrings::STYLESHEETS
-#define CONFIG_SYNTAXHIGHLIGHTING ConfigStrings::SYNTAXHIGHLIGHTING
-#define CONFIG_TEMPLATEDIR ConfigStrings::TEMPLATEDIR
-#define CONFIG_TABSIZE ConfigStrings::TABSIZE
-#define CONFIG_TAGFILE ConfigStrings::TAGFILE
-#define CONFIG_TRANSLATORS ConfigStrings::TRANSLATORS
-#define CONFIG_URL ConfigStrings::URL
-#define CONFIG_VERSION ConfigStrings::VERSION
-#define CONFIG_VERSIONSYM ConfigStrings::VERSIONSYM
-#define CONFIG_FILEEXTENSIONS ConfigStrings::FILEEXTENSIONS
-#define CONFIG_IMAGEEXTENSIONS ConfigStrings::IMAGEEXTENSIONS
-#define CONFIG_QMLONLY ConfigStrings::QMLONLY
-#define CONFIG_QMLTYPESPAGE ConfigStrings::QMLTYPESPAGE
-#define CONFIG_WRITEQAPAGES ConfigStrings::WRITEQAPAGES
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
deleted file mode 100644
index 01ff827d58..0000000000
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ /dev/null
@@ -1,1326 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- cppcodemarker.cpp
-*/
-
-#include "atom.h"
-#include "cppcodemarker.h"
-#include "node.h"
-#include "text.h"
-#include "tree.h"
-#include
-#include
-
-QT_BEGIN_NAMESPACE
-
-/*!
- The constructor does nothing.
- */
-CppCodeMarker::CppCodeMarker()
-{
- // nothing.
-}
-
-/*!
- The destructor does nothing.
- */
-CppCodeMarker::~CppCodeMarker()
-{
- // nothing.
-}
-
-/*!
- Returns \c true.
- */
-bool CppCodeMarker::recognizeCode(const QString & /* code */)
-{
- return true;
-}
-
-/*!
- Returns \c true if \a ext is any of a list of file extensions
- for the C++ language.
- */
-bool CppCodeMarker::recognizeExtension(const QString& extension)
-{
- QByteArray ext = extension.toLatin1();
- return ext == "c" ||
- ext == "c++" ||
- ext == "qdoc" ||
- ext == "qtt" ||
- ext == "qtx" ||
- ext == "cc" ||
- ext == "cpp" ||
- ext == "cxx" ||
- ext == "ch" ||
- ext == "h" ||
- ext == "h++" ||
- ext == "hh" ||
- ext == "hpp" ||
- ext == "hxx";
-}
-
-/*!
- Returns \c true if \a lang is either "C" or "Cpp".
- */
-bool CppCodeMarker::recognizeLanguage(const QString &lang)
-{
- return lang == QLatin1String("C") || lang == QLatin1String("Cpp");
-}
-
-/*!
- Returns the type of atom used to represent C++ code in the documentation.
-*/
-Atom::AtomType CppCodeMarker::atomType() const
-{
- return Atom::Code;
-}
-
-QString CppCodeMarker::markedUpCode(const QString &code,
- const Node *relative,
- const Location &location)
-{
- return addMarkUp(code, relative, location);
-}
-
-QString CppCodeMarker::markedUpSynopsis(const Node *node,
- const Node * /* relative */,
- SynopsisStyle style)
-{
- const int MaxEnumValues = 6;
- const FunctionNode *func;
- const PropertyNode *property;
- const VariableNode *variable;
- const EnumNode *enume;
- const TypedefNode *typedeff;
- QString synopsis;
- QString extra;
- QString name;
-
- name = taggedNode(node);
- if (style != Detailed)
- name = linkTag(node, name);
- name = "<@name>" + name + "@name>";
-
- if ((style == Detailed) && !node->parent()->name().isEmpty() &&
- (node->type() != Node::Property) && !node->isQmlNode() && !node->isJsNode())
- name.prepend(taggedNode(node->parent()) + "::");
-
- switch (node->type()) {
- case Node::Namespace:
- synopsis = "namespace " + name;
- break;
- case Node::Class:
- synopsis = "class " + name;
- break;
- case Node::Function:
- case Node::QmlSignal:
- case Node::QmlSignalHandler:
- case Node::QmlMethod:
- func = (const FunctionNode *) node;
-
- if (style != Subpage && !func->returnType().isEmpty())
- synopsis = typified(func->returnType(), true);
- synopsis += name;
- if (func->metaness() != FunctionNode::MacroWithoutParams) {
- synopsis += QLatin1Char('(');
- if (!func->parameters().isEmpty()) {
- QVector::ConstIterator p = func->parameters().constBegin();
- while (p != func->parameters().constEnd()) {
- if (p != func->parameters().constBegin())
- synopsis += ", ";
- synopsis += typified((*p).dataType(), true);
- if (style != Subpage && !(*p).name().isEmpty())
- synopsis +=
- "<@param>" + protect((*p).name()) + "@param>";
- synopsis += protect((*p).rightType());
- if (style != Subpage && !(*p).defaultValue().isEmpty())
- synopsis += " = " + protect((*p).defaultValue());
- ++p;
- }
- }
- synopsis += QLatin1Char(')');
- }
- if (func->isConst())
- synopsis += " const";
-
- if (style == Summary || style == Accessors) {
- if (func->virtualness() != FunctionNode::NonVirtual)
- synopsis.prepend("virtual ");
- if (func->virtualness() == FunctionNode::PureVirtual)
- synopsis.append(" = 0");
- }
- else if (style == Subpage) {
- if (!func->returnType().isEmpty() && func->returnType() != "void")
- synopsis += " : " + typified(func->returnType());
- }
- else {
- QStringList bracketed;
- if (func->isStatic()) {
- bracketed += "static";
- }
- else if (func->virtualness() != FunctionNode::NonVirtual) {
- if (func->virtualness() == FunctionNode::PureVirtual)
- bracketed += "pure";
- bracketed += "virtual";
- }
-
- if (func->access() == Node::Protected) {
- bracketed += "protected";
- }
- else if (func->access() == Node::Private) {
- bracketed += "private";
- }
-
- if (func->metaness() == FunctionNode::Signal) {
- bracketed += "signal";
- }
- else if (func->metaness() == FunctionNode::Slot) {
- bracketed += "slot";
- }
- if (!bracketed.isEmpty())
- extra += QLatin1Char('[') + bracketed.join(' ') + QStringLiteral("] ");
- }
- break;
- case Node::Enum:
- enume = static_cast(node);
- synopsis = "enum " + name;
- if (style == Summary) {
- synopsis += " { ";
-
- QStringList documentedItems = enume->doc().enumItemNames();
- if (documentedItems.isEmpty()) {
- foreach (const EnumItem &item, enume->items())
- documentedItems << item.name();
- }
- QStringList omitItems = enume->doc().omitEnumItemNames();
- foreach (const QString &item, omitItems)
- documentedItems.removeAll(item);
-
- if (documentedItems.size() <= MaxEnumValues) {
- for (int i = 0; i < documentedItems.size(); ++i) {
- if (i != 0)
- synopsis += ", ";
- synopsis += documentedItems.at(i);
- }
- }
- else {
- for (int i = 0; i < documentedItems.size(); ++i) {
- if (i < MaxEnumValues-2 || i == documentedItems.size()-1) {
- if (i != 0)
- synopsis += ", ";
- synopsis += documentedItems.at(i);
- }
- else if (i == MaxEnumValues - 1) {
- synopsis += ", ...";
- }
- }
- }
- if (!documentedItems.isEmpty())
- synopsis += QLatin1Char(' ');
- synopsis += QLatin1Char('}');
- }
- break;
- case Node::Typedef:
- typedeff = static_cast(node);
- if (typedeff->associatedEnum()) {
- synopsis = "flags " + name;
- }
- else {
- synopsis = "typedef " + name;
- }
- break;
- case Node::Property:
- property = static_cast(node);
- synopsis = name + " : " + typified(property->qualifiedDataType());
- break;
- case Node::Variable:
- variable = static_cast(node);
- if (style == Subpage) {
- synopsis = name + " : " + typified(variable->dataType());
- }
- else {
- synopsis = typified(variable->leftType(), true) +
- name + protect(variable->rightType());
- }
- break;
- default:
- synopsis = name;
- }
-
- if (style == Summary) {
- if (node->status() == Node::Preliminary) {
- extra += "(preliminary) ";
- }
- else if (node->status() == Node::Deprecated) {
- extra += "(deprecated) ";
- }
- else if (node->status() == Node::Obsolete) {
- extra += "(obsolete) ";
- }
- }
-
- if (!extra.isEmpty()) {
- extra.prepend("<@extra>");
- extra.append("@extra>");
- }
- return extra + synopsis;
-}
-
-/*!
- */
-QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
-{
- QString name = taggedQmlNode(node);
- if (summary)
- name = linkTag(node,name);
- else if (node->isQmlProperty() || node->isJsProperty()) {
- const QmlPropertyNode* pn = static_cast(node);
- if (pn->isAttached())
- name.prepend(pn->element() + QLatin1Char('.'));
- }
- name = "<@name>" + name + "@name>";
- QString synopsis;
- if (node->isQmlProperty() || node->isJsProperty()) {
- const QmlPropertyNode* pn = static_cast(node);
- synopsis = name + " : " + typified(pn->dataType());
- }
- else if ((node->type() == Node::QmlMethod) ||
- (node->type() == Node::QmlSignal) ||
- (node->type() == Node::QmlSignalHandler)) {
- const FunctionNode* func = static_cast(node);
- if (!func->returnType().isEmpty())
- synopsis = typified(func->returnType(), true) + name;
- else
- synopsis = name;
- synopsis += QLatin1Char('(');
- if (!func->parameters().isEmpty()) {
- QVector::ConstIterator p = func->parameters().constBegin();
- while (p != func->parameters().constEnd()) {
- if (p != func->parameters().constBegin())
- synopsis += ", ";
- synopsis += typified((*p).dataType(), true);
- if (!(*p).name().isEmpty())
- synopsis += "<@param>" + protect((*p).name()) + "@param>";
- synopsis += protect((*p).rightType());
- ++p;
- }
- }
- synopsis += QLatin1Char(')');
- }
- else
- synopsis = name;
-
- QString extra;
- if (summary) {
- if (node->status() == Node::Preliminary) {
- extra += " (preliminary)";
- }
- else if (node->status() == Node::Deprecated) {
- extra += " (deprecated)";
- }
- else if (node->status() == Node::Obsolete) {
- extra += " (obsolete)";
- }
- }
-
- if (!extra.isEmpty()) {
- extra.prepend("<@extra>");
- extra.append("@extra>");
- }
- return synopsis + extra;
-}
-
-QString CppCodeMarker::markedUpName(const Node *node)
-{
- QString name = linkTag(node, taggedNode(node));
- if (node->type() == Node::Function)
- name += "()";
- return name;
-}
-
-QString CppCodeMarker::markedUpFullName(const Node *node, const Node *relative)
-{
- if (node->name().isEmpty()) {
- return "global";
- }
- else {
- QString fullName;
- for (;;) {
- fullName.prepend(markedUpName(node));
- if (node->parent() == relative || node->parent()->name().isEmpty())
- break;
- fullName.prepend("<@op>::@op>");
- node = node->parent();
- }
- return fullName;
- }
-}
-
-QString CppCodeMarker::markedUpEnumValue(const QString &enumValue, const Node *relative)
-{
- if (relative->type() != Node::Enum)
- return enumValue;
-
- const Node *node = relative->parent();
- QString fullName;
- while (node->parent()) {
- fullName.prepend(markedUpName(node));
- if (node->parent() == relative || node->parent()->name().isEmpty())
- break;
- fullName.prepend("<@op>::@op>");
- node = node->parent();
- }
- if (!fullName.isEmpty())
- fullName.append("<@op>::@op>");
- fullName.append(enumValue);
- return fullName;
-}
-
-QString CppCodeMarker::markedUpIncludes(const QStringList& includes)
-{
- QString code;
-
- QStringList::ConstIterator inc = includes.constBegin();
- while (inc != includes.constEnd()) {
- code += "<@preprocessor>#include <<@headerfile>" + *inc + "@headerfile>>@preprocessor>\n";
- ++inc;
- }
- return code;
-}
-
-QString CppCodeMarker::functionBeginRegExp(const QString& funcName)
-{
- return QLatin1Char('^') + QRegExp::escape(funcName) + QLatin1Char('$');
-
-}
-
-QString CppCodeMarker::functionEndRegExp(const QString& /* funcName */)
-{
- return "^\\}$";
-}
-
-QList CppCodeMarker::sections(const Aggregate *inner,
- SynopsisStyle style,
- Status status)
-{
- QList sections;
-
- if (inner->isClass()) {
- if (style == Summary) {
- FastSection privateFunctions(inner,
- "Private Functions",
- QString(),
- "private function",
- "private functions");
- FastSection privateSlots(inner, "Private Slots", QString(), "private slot", "private slots");
- FastSection privateTypes(inner, "Private Types", QString(), "private type", "private types");
- FastSection protectedFunctions(inner,
- "Protected Functions",
- QString(),
- "protected function",
- "protected functions");
- FastSection protectedSlots(inner,
- "Protected Slots",
- QString(),
- "protected slot",
- "protected slots");
- FastSection protectedTypes(inner,
- "Protected Types",
- QString(),
- "protected type",
- "protected types");
- FastSection protectedVariables(inner,
- "Protected Variables",
- QString(),
- "protected type",
- "protected variables");
- FastSection publicFunctions(inner,
- "Public Functions",
- QString(),
- "public function",
- "public functions");
- FastSection publicSignals(inner, "Signals", QString(), "signal", "signals");
- FastSection publicSlots(inner, "Public Slots", QString(), "public slot", "public slots");
- FastSection publicTypes(inner, "Public Types", QString(), "public type", "public types");
- FastSection publicVariables(inner,
- "Public Variables",
- QString(),
- "public variable",
- "public variables");
- FastSection properties(inner, "Properties", QString(), "property", "properties");
- FastSection relatedNonMembers(inner,
- "Related Non-Members",
- QString(),
- "related non-member",
- "related non-members");
- FastSection staticPrivateMembers(inner,
- "Static Private Members",
- QString(),
- "static private member",
- "static private members");
- FastSection staticProtectedMembers(inner,
- "Static Protected Members",
- QString(),
- "static protected member",
- "static protected members");
- FastSection staticPublicMembers(inner,
- "Static Public Members",
- QString(),
- "static public member",
- "static public members");
- FastSection macros(inner, "Macros", QString(), "macro", "macros");
-
- NodeList::ConstIterator r = inner->relatedNodes().constBegin();
- while (r != inner->relatedNodes().constEnd()) {
- if ((*r)->type() == Node::Function) {
- FunctionNode *func = static_cast(*r);
- if (func->isMacro())
- insert(macros, *r, style, status);
- else
- insert(relatedNonMembers, *r, style, status);
- }
- else {
- insert(relatedNonMembers, *r, style, status);
- }
- ++r;
- }
-
- QStack stack;
- stack.push(inner);
- while (!stack.isEmpty()) {
- const Aggregate* ancestor = stack.pop();
-
- NodeList::ConstIterator c = ancestor->childNodes().constBegin();
- while (c != ancestor->childNodes().constEnd()) {
- bool isSlot = false;
- bool isSignal = false;
- bool isStatic = false;
- if ((*c)->type() == Node::Function) {
- const FunctionNode *func = (const FunctionNode *) *c;
- isSlot = (func->metaness() == FunctionNode::Slot);
- isSignal = (func->metaness() == FunctionNode::Signal);
- isStatic = func->isStatic();
- if (func->hasAssociatedProperties() && !func->hasActiveAssociatedProperty()) {
- ++c;
- continue;
- }
- }
- else if ((*c)->type() == Node::Variable) {
- const VariableNode *var = static_cast(*c);
- isStatic = var->isStatic();
- }
-
- switch ((*c)->access()) {
- case Node::Public:
- if (isSlot) {
- insert(publicSlots, *c, style, status);
- }
- else if (isSignal) {
- insert(publicSignals, *c, style, status);
- }
- else if (isStatic) {
- if ((*c)->type() != Node::Variable || !(*c)->doc().isEmpty())
- insert(staticPublicMembers,*c,style,status);
- }
- else if ((*c)->type() == Node::Property) {
- insert(properties, *c, style, status);
- }
- else if ((*c)->type() == Node::Variable) {
- if (!(*c)->doc().isEmpty())
- insert(publicVariables, *c, style, status);
- }
- else if ((*c)->type() == Node::Function) {
- if (!insertReimpFunc(publicFunctions,*c,status)) {
- insert(publicFunctions, *c, style, status);
- }
- }
- else {
- insert(publicTypes, *c, style, status);
- }
- break;
- case Node::Protected:
- if (isSlot) {
- insert(protectedSlots, *c, style, status);
- }
- else if (isStatic) {
- if ((*c)->type() != Node::Variable || !(*c)->doc().isEmpty())
- insert(staticProtectedMembers,*c,style,status);
- }
- else if ((*c)->type() == Node::Variable) {
- if (!(*c)->doc().isEmpty())
- insert(protectedVariables,*c,style,status);
- }
- else if ((*c)->type() == Node::Function) {
- if (!insertReimpFunc(protectedFunctions,*c,status)) {
- insert(protectedFunctions, *c, style, status);
- }
- }
- else {
- insert(protectedTypes, *c, style, status);
- }
- break;
- case Node::Private:
- if (isSlot) {
- insert(privateSlots, *c, style, status);
- }
- else if (isStatic) {
- if ((*c)->type() != Node::Variable || !(*c)->doc().isEmpty())
- insert(staticPrivateMembers,*c,style,status);
- }
- else if ((*c)->type() == Node::Function) {
- if (!insertReimpFunc(privateFunctions,*c,status)) {
- insert(privateFunctions, *c, style, status);
- }
- }
- else {
- insert(privateTypes,*c,style,status);
- }
- }
- ++c;
- }
-
- if (ancestor->isClass()) {
- const ClassNode* cn = static_cast(ancestor);
- QList::ConstIterator r = cn->baseClasses().constBegin();
- while (r != cn->baseClasses().constEnd()) {
- if ((*r).node_)
- stack.prepend((*r).node_);
- ++r;
- }
- }
- }
- append(sections, publicTypes);
- append(sections, properties);
- append(sections, publicFunctions);
- append(sections, publicSlots);
- append(sections, publicSignals);
- append(sections, publicVariables);
- append(sections, staticPublicMembers);
- append(sections, protectedTypes);
- append(sections, protectedFunctions);
- append(sections, protectedSlots);
- append(sections, protectedVariables);
- append(sections, staticProtectedMembers);
- append(sections, privateTypes);
- append(sections, privateFunctions);
- append(sections, privateSlots);
- append(sections, staticPrivateMembers);
- append(sections, relatedNonMembers);
- append(sections, macros);
- }
- else if (style == Detailed) {
- FastSection memberFunctions(inner,"Member Function Documentation","func","member","members");
- FastSection memberTypes(inner,"Member Type Documentation","types","member","members");
- FastSection memberVariables(inner,"Member Variable Documentation","vars","member","members");
- FastSection properties(inner,"Property Documentation","prop","member","members");
- FastSection relatedNonMembers(inner,"Related Non-Members","relnonmem","member","members");
- FastSection macros(inner,"Macro Documentation","macros","member","members");
-
- NodeList::ConstIterator r = inner->relatedNodes().constBegin();
- while (r != inner->relatedNodes().constEnd()) {
- if ((*r)->type() == Node::Function) {
- FunctionNode *func = static_cast(*r);
- if (func->isMacro())
- insert(macros, *r, style, status);
- else
- insert(relatedNonMembers, *r, style, status);
- }
- else {
- insert(relatedNonMembers, *r, style, status);
- }
- ++r;
- }
-
- NodeList::ConstIterator c = inner->childNodes().constBegin();
- while (c != inner->childNodes().constEnd()) {
- if ((*c)->type() == Node::Enum ||
- (*c)->type() == Node::Typedef) {
- insert(memberTypes, *c, style, status);
- }
- else if ((*c)->type() == Node::Property) {
- insert(properties, *c, style, status);
- }
- else if ((*c)->type() == Node::Variable) {
- if (!(*c)->doc().isEmpty())
- insert(memberVariables, *c, style, status);
- }
- else if ((*c)->type() == Node::Function) {
- FunctionNode *function = static_cast(*c);
- if (!function->hasAssociatedProperties() || !function->doc().isEmpty())
- insert(memberFunctions, function, style, status);
- }
- ++c;
- }
-
- append(sections, memberTypes);
- append(sections, properties);
- append(sections, memberFunctions);
- append(sections, memberVariables);
- append(sections, relatedNonMembers);
- append(sections, macros);
- }
- else {
- FastSection all(inner,QString(),QString(),"member","members");
-
- QStack stack;
- stack.push(inner);
-
- while (!stack.isEmpty()) {
- const Aggregate* ancestor = stack.pop();
- NodeList::ConstIterator c = ancestor->childNodes().constBegin();
- while (c != ancestor->childNodes().constEnd()) {
- if ((*c)->access() != Node::Private && (*c)->type() != Node::Property)
- insert(all, *c, style, status);
- ++c;
- }
-
- if (ancestor->isClass()) {
- const ClassNode* cn = static_cast(ancestor);
- QList::ConstIterator r = cn->baseClasses().constBegin();
- while (r != cn->baseClasses().constEnd()) {
- if ((*r).node_)
- stack.prepend((*r).node_);
- ++r;
- }
- }
- }
- append(sections, all);
- }
- }
- else {
- if (style == Summary || style == Detailed) {
- FastSection namespaces(inner,
- "Namespaces",
- style == Detailed ? "nmspace" : QString(),
- "namespace",
- "namespaces");
- FastSection classes(inner,
- "Classes",
- style == Detailed ? "classes" : QString(),
- "class",
- "classes");
- FastSection types(inner,
- style == Summary ? "Types" : "Type Documentation",
- style == Detailed ? "types" : QString(),
- "type",
- "types");
- FastSection variables(inner,
- style == Summary ? "Variables" : "Variable Documentation",
- style == Detailed ? "vars" : QString(),
- "variable",
- "variables");
- FastSection staticVariables(inner,
- "Static Variables",
- QString(),
- "static variable",
- "static variables");
- FastSection functions(inner,
- style == Summary ?
- "Functions" : "Function Documentation",
- style == Detailed ? "func" : QString(),
- "function",
- "functions");
- FastSection macros(inner,
- style == Summary ?
- "Macros" : "Macro Documentation",
- style == Detailed ? "macros" : QString(),
- "macro",
- "macros");
-
- NodeList nodeList = inner->childNodes();
- nodeList += inner->relatedNodes();
-
- NodeList::ConstIterator n = nodeList.constBegin();
- while (n != nodeList.constEnd()) {
- switch ((*n)->type()) {
- case Node::Namespace:
- insert(namespaces, *n, style, status);
- break;
- case Node::Class:
- insert(classes, *n, style, status);
- break;
- case Node::Enum:
- case Node::Typedef:
- insert(types, *n, style, status);
- break;
- case Node::Function:
- {
- FunctionNode *func = static_cast(*n);
- if (func->isMacro())
- insert(macros, *n, style, status);
- else
- insert(functions, *n, style, status);
- }
- break;
- case Node::Variable:
- {
- const VariableNode* var = static_cast(*n);
- if (!var->doc().isEmpty()) {
- if (var->isStatic())
- insert(staticVariables,*n,style,status);
- else
- insert(variables, *n, style, status);
- }
- }
- break;
- default:
- break;
- }
- ++n;
- }
- if (inner->isNamespace()) {
- const NamespaceNode* ns = static_cast(inner);
- if (!ns->orphans().isEmpty()) {
- foreach (Node* n, ns->orphans()) {
- // Use inner as a temporary parent when inserting orphans
- Aggregate* p = n->parent();
- n->setParent(const_cast(inner));
- if (n->isClass())
- insert(classes, n, style, status);
- else if (n->isNamespace())
- insert(namespaces, n, style, status);
- n->setParent(p);
- }
- }
- }
- append(sections, namespaces);
- append(sections, classes);
- append(sections, types);
- append(sections, variables);
- append(sections, staticVariables);
- append(sections, functions);
- append(sections, macros);
- }
- }
-
- return sections;
-}
-
-/*
- @char
- @class
- @comment
- @function
- @keyword
- @number
- @op
- @preprocessor
- @string
- @type
-*/
-
-QString CppCodeMarker::addMarkUp(const QString &in,
- const Node * /* relative */,
- const Location & /* location */)
-{
- static QSet types;
- static QSet keywords;
-
- if (types.isEmpty()) {
- // initialize statics
- Q_ASSERT(keywords.isEmpty());
- static const QString typeTable[] = {
- QLatin1String("bool"), QLatin1String("char"), QLatin1String("double"), QLatin1String("float"), QLatin1String("int"), QLatin1String("long"), QLatin1String("short"),
- QLatin1String("signed"), QLatin1String("unsigned"), QLatin1String("uint"), QLatin1String("ulong"), QLatin1String("ushort"), QLatin1String("uchar"), QLatin1String("void"),
- QLatin1String("qlonglong"), QLatin1String("qulonglong"),
- QLatin1String("qint"), QLatin1String("qint8"), QLatin1String("qint16"), QLatin1String("qint32"), QLatin1String("qint64"),
- QLatin1String("quint"), QLatin1String("quint8"), QLatin1String("quint16"), QLatin1String("quint32"), QLatin1String("quint64"),
- QLatin1String("qreal"), QLatin1String("cond")
- };
-
- static const QString keywordTable[] = {
- QLatin1String("and"), QLatin1String("and_eq"), QLatin1String("asm"), QLatin1String("auto"), QLatin1String("bitand"), QLatin1String("bitor"), QLatin1String("break"),
- QLatin1String("case"), QLatin1String("catch"), QLatin1String("class"), QLatin1String("compl"), QLatin1String("const"), QLatin1String("const_cast"),
- QLatin1String("continue"), QLatin1String("default"), QLatin1String("delete"), QLatin1String("do"), QLatin1String("dynamic_cast"), QLatin1String("else"),
- QLatin1String("enum"), QLatin1String("explicit"), QLatin1String("export"), QLatin1String("extern"), QLatin1String("false"), QLatin1String("for"), QLatin1String("friend"),
- QLatin1String("goto"), QLatin1String("if"), QLatin1String("include"), QLatin1String("inline"), QLatin1String("monitor"), QLatin1String("mutable"), QLatin1String("namespace"),
- QLatin1String("new"), QLatin1String("not"), QLatin1String("not_eq"), QLatin1String("operator"), QLatin1String("or"), QLatin1String("or_eq"), QLatin1String("private"), QLatin1String("protected"),
- QLatin1String("public"), QLatin1String("register"), QLatin1String("reinterpret_cast"), QLatin1String("return"), QLatin1String("sizeof"),
- QLatin1String("static"), QLatin1String("static_cast"), QLatin1String("struct"), QLatin1String("switch"), QLatin1String("template"), QLatin1String("this"),
- QLatin1String("throw"), QLatin1String("true"), QLatin1String("try"), QLatin1String("typedef"), QLatin1String("typeid"), QLatin1String("typename"), QLatin1String("union"),
- QLatin1String("using"), QLatin1String("virtual"), QLatin1String("volatile"), QLatin1String("wchar_t"), QLatin1String("while"), QLatin1String("xor"),
- QLatin1String("xor_eq"), QLatin1String("synchronized"),
- // Qt specific
- QLatin1String("signals"), QLatin1String("slots"), QLatin1String("emit")
- };
-
- types.reserve(sizeof(typeTable) / sizeof(QString));
- for (int j = sizeof(typeTable) / sizeof(QString) - 1; j; --j)
- types.insert(typeTable[j]);
-
- keywords.reserve(sizeof(keywordTable) / sizeof(QString));
- for (int j = sizeof(keywordTable) / sizeof(QString) - 1; j; --j)
- keywords.insert(keywordTable[j]);
- }
-#define readChar() \
- ch = (i < (int)code.length()) ? code[i++].cell() : EOF
-
- QString code = in;
- QString out;
- QStringRef text;
- int braceDepth = 0;
- int parenDepth = 0;
- int i = 0;
- int start = 0;
- int finish = 0;
- QChar ch;
- QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)");
- QRegExp functionRegExp("q([A-Z][a-z]+)+");
- QRegExp findFunctionRegExp(QStringLiteral("^\\s*\\("));
-
- readChar();
-
- while (ch != EOF) {
- QString tag;
- bool target = false;
-
- if (ch.isLetter() || ch == '_') {
- QString ident;
- do {
- ident += ch;
- finish = i;
- readChar();
- } while (ch.isLetterOrNumber() || ch == '_');
-
- if (classRegExp.exactMatch(ident)) {
- tag = QStringLiteral("type");
- } else if (functionRegExp.exactMatch(ident)) {
- tag = QStringLiteral("func");
- target = true;
- } else if (types.contains(ident)) {
- tag = QStringLiteral("type");
- } else if (keywords.contains(ident)) {
- tag = QStringLiteral("keyword");
- } else if (braceDepth == 0 && parenDepth == 0) {
- if (code.indexOf(findFunctionRegExp, i - 1) == i - 1)
- tag = QStringLiteral("func");
- target = true;
- }
- } else if (ch.isDigit()) {
- do {
- finish = i;
- readChar();
- } while (ch.isLetterOrNumber() || ch == '.');
- tag = QStringLiteral("number");
- } else {
- switch (ch.unicode()) {
- case '+':
- case '-':
- case '!':
- case '%':
- case '^':
- case '&':
- case '*':
- case ',':
- case '.':
- case '<':
- case '=':
- case '>':
- case '?':
- case '[':
- case ']':
- case '|':
- case '~':
- finish = i;
- readChar();
- tag = QStringLiteral("op");
- break;
- case '"':
- finish = i;
- readChar();
-
- while (ch != EOF && ch != '"') {
- if (ch == '\\')
- readChar();
- readChar();
- }
- finish = i;
- readChar();
- tag = QStringLiteral("string");
- break;
- case '#':
- finish = i;
- readChar();
- while (ch != EOF && ch != '\n') {
- if (ch == '\\')
- readChar();
- finish = i;
- readChar();
- }
- tag = QStringLiteral("preprocessor");
- break;
- case '\'':
- finish = i;
- readChar();
-
- while (ch != EOF && ch != '\'') {
- if (ch == '\\')
- readChar();
- readChar();
- }
- finish = i;
- readChar();
- tag = QStringLiteral("char");
- break;
- case '(':
- finish = i;
- readChar();
- parenDepth++;
- break;
- case ')':
- finish = i;
- readChar();
- parenDepth--;
- break;
- case ':':
- finish = i;
- readChar();
- if (ch == ':') {
- finish = i;
- readChar();
- tag = QStringLiteral("op");
- }
- break;
- case '/':
- finish = i;
- readChar();
- if (ch == '/') {
- do {
- finish = i;
- readChar();
- } while (ch != EOF && ch != '\n');
- tag = QStringLiteral("comment");
- } else if (ch == '*') {
- bool metAster = false;
- bool metAsterSlash = false;
-
- finish = i;
- readChar();
-
- while (!metAsterSlash) {
- if (ch == EOF)
- break;
-
- if (ch == '*')
- metAster = true;
- else if (metAster && ch == '/')
- metAsterSlash = true;
- else
- metAster = false;
- finish = i;
- readChar();
- }
- tag = QStringLiteral("comment");
- } else {
- tag = QStringLiteral("op");
- }
- break;
- case '{':
- finish = i;
- readChar();
- braceDepth++;
- break;
- case '}':
- finish = i;
- readChar();
- braceDepth--;
- break;
- default:
- finish = i;
- readChar();
- }
- }
-
- text = code.midRef(start, finish - start);
- start = finish;
-
- if (!tag.isEmpty()) {
- out += QStringLiteral("<@");
- out += tag;
- if (target) {
- out += QStringLiteral(" target=\"");
- out += text;
- out += QStringLiteral("()\"");
- }
- out += QStringLiteral(">");
- }
-
- appendProtectedString(&out, text);
-
- if (!tag.isEmpty()) {
- out += QStringLiteral("@");
- out += tag;
- out += QStringLiteral(">");
- }
- }
-
- if (start < code.length()) {
- appendProtectedString(&out, code.midRef(start));
- }
-
- return out;
-}
-
-/*!
- This function is for documenting QML properties. It returns
- the list of documentation sections for the children of the
- \a qmlTypeNode.
- */
-QList CppCodeMarker::qmlSections(QmlTypeNode* qmlTypeNode, SynopsisStyle style, Status status)
-{
- QList sections;
- if (qmlTypeNode) {
- if (style == Summary) {
- FastSection qmlproperties(qmlTypeNode,
- "Properties",
- QString(),
- "property",
- "properties");
- FastSection qmlattachedproperties(qmlTypeNode,
- "Attached Properties",
- QString(),
- "property",
- "properties");
- FastSection qmlsignals(qmlTypeNode,
- "Signals",
- QString(),
- "signal",
- "signals");
- FastSection qmlsignalhandlers(qmlTypeNode,
- "Signal Handlers",
- QString(),
- "signal handler",
- "signal handlers");
- FastSection qmlattachedsignals(qmlTypeNode,
- "Attached Signals",
- QString(),
- "signal",
- "signals");
- FastSection qmlmethods(qmlTypeNode,
- "Methods",
- QString(),
- "method",
- "methods");
- FastSection qmlattachedmethods(qmlTypeNode,
- "Attached Methods",
- QString(),
- "method",
- "methods");
-
- QmlTypeNode* qcn = qmlTypeNode;
- while (qcn != 0) {
- NodeList::ConstIterator c = qcn->childNodes().constBegin();
- while (c != qcn->childNodes().constEnd()) {
- if ((*c)->status() == Node::Internal) {
- ++c;
- continue;
- }
- if ((*c)->isQmlPropertyGroup() || (*c)->isJsPropertyGroup()) {
- insert(qmlproperties, *c, style, status);
- }
- else if ((*c)->isQmlProperty() || (*c)->isJsProperty()) {
- const QmlPropertyNode* pn = static_cast(*c);
- if (pn->isAttached())
- insert(qmlattachedproperties,*c,style, status);
- else {
- insert(qmlproperties,*c,style, status);
- }
- }
- else if ((*c)->isQmlSignal() || (*c)->isJsSignal()) {
- const FunctionNode* sn = static_cast(*c);
- if (sn->isAttached())
- insert(qmlattachedsignals,*c,style, status);
- else
- insert(qmlsignals,*c,style, status);
- }
- else if ((*c)->isQmlSignalHandler() || (*c)->isJsSignalHandler()) {
- insert(qmlsignalhandlers,*c,style, status);
- }
- else if ((*c)->isQmlMethod() || (*c)->isJsMethod()) {
- const FunctionNode* mn = static_cast(*c);
- if (mn->isAttached())
- insert(qmlattachedmethods,*c,style, status);
- else
- insert(qmlmethods,*c,style, status);
- }
- ++c;
- }
- if (qcn->qmlBaseNode() != 0) {
- qcn = static_cast(qcn->qmlBaseNode());
- if (!qcn->isAbstract())
- qcn = 0;
- }
- else
- qcn = 0;
- }
- append(sections,qmlproperties);
- append(sections,qmlattachedproperties);
- append(sections,qmlsignals);
- append(sections,qmlsignalhandlers);
- append(sections,qmlattachedsignals);
- append(sections,qmlmethods);
- append(sections,qmlattachedmethods);
- }
- else if (style == Detailed) {
- FastSection qmlproperties(qmlTypeNode, "Property Documentation","qmlprop","member","members");
- FastSection qmlattachedproperties(qmlTypeNode,"Attached Property Documentation","qmlattprop",
- "member","members");
- FastSection qmlsignals(qmlTypeNode,"Signal Documentation","qmlsig","signal","signals");
- FastSection qmlsignalhandlers(qmlTypeNode,"Signal Handler Documentation","qmlsighan","signal handler","signal handlers");
- FastSection qmlattachedsignals(qmlTypeNode,"Attached Signal Documentation","qmlattsig",
- "signal","signals");
- FastSection qmlmethods(qmlTypeNode,"Method Documentation","qmlmeth","member","members");
- FastSection qmlattachedmethods(qmlTypeNode,"Attached Method Documentation","qmlattmeth",
- "member","members");
- QmlTypeNode* qcn = qmlTypeNode;
- while (qcn != 0) {
- NodeList::ConstIterator c = qcn->childNodes().constBegin();
- while (c != qcn->childNodes().constEnd()) {
- if ((*c)->status() == Node::Internal) {
- ++c;
- continue;
- }
- if ((*c)->isQmlPropertyGroup() || (*c)->isJsPropertyGroup()) {
- insert(qmlproperties,*c,style, status);
- }
- else if ((*c)->isQmlProperty() || (*c)->isJsProperty()) {
- const QmlPropertyNode* pn = static_cast(*c);
- if (pn->isAttached())
- insert(qmlattachedproperties,*c,style, status);
- else
- insert(qmlproperties,*c,style, status);
- }
- else if ((*c)->isQmlSignal() || (*c)->isJsSignal()) {
- const FunctionNode* sn = static_cast(*c);
- if (sn->isAttached())
- insert(qmlattachedsignals,*c,style, status);
- else
- insert(qmlsignals,*c,style, status);
- }
- else if ((*c)->isQmlSignalHandler() || (*c)->isJsSignalHandler()) {
- insert(qmlsignalhandlers,*c,style, status);
- }
- else if ((*c)->isQmlMethod() || (*c)->isJsMethod()) {
- const FunctionNode* mn = static_cast(*c);
- if (mn->isAttached())
- insert(qmlattachedmethods,*c,style, status);
- else
- insert(qmlmethods,*c,style, status);
- }
- ++c;
- }
- if (qcn->qmlBaseNode() != 0) {
- qcn = static_cast(qcn->qmlBaseNode());
- if (!qcn->isAbstract())
- qcn = 0;
- }
- else
- qcn = 0;
- }
- append(sections,qmlproperties);
- append(sections,qmlattachedproperties);
- append(sections,qmlsignals);
- append(sections,qmlsignalhandlers);
- append(sections,qmlattachedsignals);
- append(sections,qmlmethods);
- append(sections,qmlattachedmethods);
- }
- else {
- /*
- This is where the list of all members including inherited
- members is prepared.
- */
- ClassMap* classMap = 0;
- FastSection all(qmlTypeNode,QString(),QString(),"member","members");
- QmlTypeNode* current = qmlTypeNode;
- while (current != 0) {
- /*
- If the QML type is abstract, do not create
- a new entry in the list for it. Instead,
- add its members to the current entry.
-
- However, if the first class is abstract,
- there is no current entry. In that case,
- create a new entry in the list anyway.
- I'm not sure that is correct, but it at
- least can prevent a crash.
- */
- if (!current->isAbstract() || !classMap) {
- classMap = new ClassMap;
- classMap->first = current;
- all.classMapList_.append(classMap);
- }
- NodeList::ConstIterator c = current->childNodes().constBegin();
- while (c != current->childNodes().constEnd()) {
- if ((*c)->isQmlPropertyGroup() || (*c)->isJsPropertyGroup()) {
- const QmlPropertyGroupNode* qpgn = static_cast(*c);
- NodeList::ConstIterator p = qpgn->childNodes().constBegin();
- while (p != qpgn->childNodes().constEnd()) {
- if ((*p)->isQmlProperty() || (*c)->isJsProperty()) {
- QString key = (*p)->name();
- key = sortName(*p, &key);
- all.memberMap.insert(key,*p);
- classMap->second.insert(key,*p);
- }
- ++p;
- }
- }
- else {
- QString key = (*c)->name();
- key = sortName(*c, &key);
- all.memberMap.insert(key,*c);
- classMap->second.insert(key,*c);
- }
- ++c;
- }
- current = current->qmlBaseNode();
- while (current) {
- if (current->isAbstract())
- break;
- if (current->isInternal())
- current = current->qmlBaseNode();
- else
- break;
- }
- }
- append(sections, all, true);
- }
- }
-
- return sections;
-}
-
-QT_END_NAMESPACE
diff --git a/src/tools/qdoc/cppcodemarker.h b/src/tools/qdoc/cppcodemarker.h
deleted file mode 100644
index aa759f2993..0000000000
--- a/src/tools/qdoc/cppcodemarker.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- cppcodemarker.h
-*/
-
-#ifndef CPPCODEMARKER_H
-#define CPPCODEMARKER_H
-
-#include "codemarker.h"
-
-QT_BEGIN_NAMESPACE
-
-class CppCodeMarker : public CodeMarker
-{
- Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeMarker)
-
-public:
- CppCodeMarker();
- ~CppCodeMarker();
-
- virtual bool recognizeCode(const QString& code) Q_DECL_OVERRIDE;
- virtual bool recognizeExtension(const QString& ext) Q_DECL_OVERRIDE;
- virtual bool recognizeLanguage(const QString& lang) Q_DECL_OVERRIDE;
- virtual Atom::AtomType atomType() const Q_DECL_OVERRIDE;
- virtual QString markedUpCode(const QString& code,
- const Node *relative,
- const Location &location) Q_DECL_OVERRIDE;
- virtual QString markedUpSynopsis(const Node *node,
- const Node *relative,
- SynopsisStyle style) Q_DECL_OVERRIDE;
- virtual QString markedUpQmlItem(const Node *node, bool summary) Q_DECL_OVERRIDE;
- virtual QString markedUpName(const Node *node) Q_DECL_OVERRIDE;
- virtual QString markedUpFullName(const Node *node, const Node *relative) Q_DECL_OVERRIDE;
- virtual QString markedUpEnumValue(const QString &enumValue, const Node *relative) Q_DECL_OVERRIDE;
- virtual QString markedUpIncludes(const QStringList& includes) Q_DECL_OVERRIDE;
- virtual QString functionBeginRegExp(const QString& funcName) Q_DECL_OVERRIDE;
- virtual QString functionEndRegExp(const QString& funcName) Q_DECL_OVERRIDE;
- virtual QList sections(const Aggregate *innerNode,
- SynopsisStyle style,
- Status status) Q_DECL_OVERRIDE;
- virtual QList qmlSections(QmlTypeNode* qmlTypeNode,
- SynopsisStyle style,
- Status status = Okay) Q_DECL_OVERRIDE;
-
-private:
- QString addMarkUp(const QString& protectedCode,
- const Node *relative,
- const Location &location);
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp
deleted file mode 100644
index 0405cc2c2b..0000000000
--- a/src/tools/qdoc/cppcodeparser.cpp
+++ /dev/null
@@ -1,2611 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- cppcodeparser.cpp
-*/
-
-#include
-#include
-#include
-#include "codechunk.h"
-#include "config.h"
-#include "cppcodeparser.h"
-#include "tokenizer.h"
-#include "qdocdatabase.h"
-#include
-#include "generator.h"
-
-QT_BEGIN_NAMESPACE
-
-/* qmake ignore Q_OBJECT */
-
-static bool inMacroCommand_ = false;
-static bool parsingHeaderFile_ = false;
-QStringList CppCodeParser::exampleFiles;
-QStringList CppCodeParser::exampleDirs;
-CppCodeParser* CppCodeParser::cppParser_ = 0;
-
-/*!
- The constructor initializes some regular expressions
- and calls reset().
- */
-CppCodeParser::CppCodeParser()
- : varComment("/\\*\\s*([a-zA-Z_0-9]+)\\s*\\*/"), sep("(?:<[^>]+>)?::")
-{
- reset();
- cppParser_ = this;
-}
-
-/*!
- The destructor is trivial.
- */
-CppCodeParser::~CppCodeParser()
-{
- // nothing.
-}
-
-/*!
- The constructor initializes a map of special node types
- for identifying important nodes. And it initializes
- some filters for identifying certain kinds of files.
- */
-void CppCodeParser::initializeParser(const Config &config)
-{
- CodeParser::initializeParser(config);
-
- /*
- All these can appear in a C++ namespace. Don't add
- anything that can't be in a C++ namespace.
- */
- nodeTypeMap.insert(COMMAND_NAMESPACE, Node::Namespace);
- nodeTypeMap.insert(COMMAND_CLASS, Node::Class);
- nodeTypeMap.insert(COMMAND_ENUM, Node::Enum);
- nodeTypeMap.insert(COMMAND_TYPEDEF, Node::Typedef);
- nodeTypeMap.insert(COMMAND_PROPERTY, Node::Property);
- nodeTypeMap.insert(COMMAND_VARIABLE, Node::Variable);
-
- exampleFiles = config.getCanonicalPathList(CONFIG_EXAMPLES);
- exampleDirs = config.getCanonicalPathList(CONFIG_EXAMPLEDIRS);
- QStringList exampleFilePatterns = config.getStringList(
- CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS);
-
- if (!exampleFilePatterns.isEmpty())
- exampleNameFilter = exampleFilePatterns.join(' ');
- else
- exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.dita *.ui";
-
- QStringList exampleImagePatterns = config.getStringList(
- CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
-
- if (!exampleImagePatterns.isEmpty())
- exampleImageFilter = exampleImagePatterns.join(' ');
- else
- exampleImageFilter = "*.png";
-}
-
-/*!
- Clear the map of common node types and call
- the same function in the base class.
- */
-void CppCodeParser::terminateParser()
-{
- nodeTypeMap.clear();
- CodeParser::terminateParser();
-}
-
-/*!
- Returns "Cpp".
- */
-QString CppCodeParser::language()
-{
- return "Cpp";
-}
-
-/*!
- Returns a list of extensions for header files.
- */
-QStringList CppCodeParser::headerFileNameFilter()
-{
- return QStringList() << "*.ch" << "*.h" << "*.h++" << "*.hh" << "*.hpp" << "*.hxx";
-}
-
-/*!
- Returns a list of extensions for source files, i.e. not
- header files.
- */
-QStringList CppCodeParser::sourceFileNameFilter()
-{
- return QStringList() << "*.c++" << "*.cc" << "*.cpp" << "*.cxx" << "*.mm";
-}
-
-/*!
- Parse the C++ header file identified by \a filePath and add
- the parsed contents to the database. The \a location is used
- for reporting errors.
- */
-void CppCodeParser::parseHeaderFile(const Location& location, const QString& filePath)
-{
- QFile in(filePath);
- currentFile_ = filePath;
- if (!in.open(QIODevice::ReadOnly)) {
- location.error(tr("Cannot open C++ header file '%1'").arg(filePath));
- currentFile_.clear();
- return;
- }
-
- reset();
- Location fileLocation(filePath);
- Tokenizer fileTokenizer(fileLocation, in);
- tokenizer = &fileTokenizer;
- readToken();
- parsingHeaderFile_ = true;
- matchDeclList(qdb_->primaryTreeRoot());
- parsingHeaderFile_ = false;
- if (!fileTokenizer.version().isEmpty())
- qdb_->setVersion(fileTokenizer.version());
- in.close();
-
- if (fileLocation.fileName() == "qiterator.h")
- parseQiteratorDotH(location, filePath);
- currentFile_.clear();
-}
-
-/*!
- Get ready to parse the C++ cpp file identified by \a filePath
- and add its parsed contents to the database. \a location is
- used for reporting errors.
-
- Call matchDocsAndStuff() to do all the parsing and tree building.
- */
-void CppCodeParser::parseSourceFile(const Location& location, const QString& filePath)
-{
- QFile in(filePath);
- currentFile_ = filePath;
- if (!in.open(QIODevice::ReadOnly)) {
- location.error(tr("Cannot open C++ source file '%1' (%2)").arg(filePath).arg(strerror(errno)));
- currentFile_.clear();
- return;
- }
-
- reset();
- Location fileLocation(filePath);
- Tokenizer fileTokenizer(fileLocation, in);
- tokenizer = &fileTokenizer;
- readToken();
-
- /*
- The set of open namespaces is cleared before parsing
- each source file. The word "source" here means cpp file.
- */
- qdb_->clearOpenNamespaces();
-
- matchDocsAndStuff();
- in.close();
- currentFile_.clear();
-}
-
-/*!
- This is called after all the C++ header files have been
- parsed. The most important thing it does is resolve C++
- class inheritance links in the tree. It also initializes
- a bunch of other collections.
- */
-void CppCodeParser::doneParsingHeaderFiles()
-{
- QMapIterator i(sequentialIteratorClasses);
- while (i.hasNext()) {
- i.next();
- instantiateIteratorMacro(i.key(), i.value(), sequentialIteratorDefinition);
- }
- i = mutableSequentialIteratorClasses;
- while (i.hasNext()) {
- i.next();
- instantiateIteratorMacro(i.key(), i.value(), mutableSequentialIteratorDefinition);
- }
- i = associativeIteratorClasses;
- while (i.hasNext()) {
- i.next();
- instantiateIteratorMacro(i.key(), i.value(), associativeIteratorDefinition);
- }
- i = mutableAssociativeIteratorClasses;
- while (i.hasNext()) {
- i.next();
- instantiateIteratorMacro(i.key(), i.value(), mutableAssociativeIteratorDefinition);
- }
- sequentialIteratorDefinition.clear();
- mutableSequentialIteratorDefinition.clear();
- associativeIteratorDefinition.clear();
- mutableAssociativeIteratorDefinition.clear();
- sequentialIteratorClasses.clear();
- mutableSequentialIteratorClasses.clear();
- associativeIteratorClasses.clear();
- mutableAssociativeIteratorClasses.clear();
-}
-
-/*!
- This is called after all the source files (i.e., not the
- header files) have been parsed. Currently nothing to do.
- */
-void CppCodeParser::doneParsingSourceFiles()
-{
- // contents moved to QdocDatabase::resolveIssues()
-}
-
-static QSet topicCommands_;
-/*!
- Returns the set of strings reopresenting the topic commands.
- */
-const QSet& CppCodeParser::topicCommands()
-{
- if (topicCommands_.isEmpty()) {
- topicCommands_ << COMMAND_CLASS
- << COMMAND_DITAMAP
- << COMMAND_ENUM
- << COMMAND_EXAMPLE
- << COMMAND_EXTERNALPAGE
- << COMMAND_FILE
- << COMMAND_FN
- << COMMAND_GROUP
- << COMMAND_HEADERFILE
- << COMMAND_MACRO
- << COMMAND_MODULE
- << COMMAND_NAMESPACE
- << COMMAND_PAGE
- << COMMAND_PROPERTY
- << COMMAND_TYPEDEF
- << COMMAND_VARIABLE
- << COMMAND_QMLTYPE
- << COMMAND_QMLPROPERTY
- << COMMAND_QMLPROPERTYGROUP
- << COMMAND_QMLATTACHEDPROPERTY
- << COMMAND_QMLSIGNAL
- << COMMAND_QMLATTACHEDSIGNAL
- << COMMAND_QMLMETHOD
- << COMMAND_QMLATTACHEDMETHOD
- << COMMAND_QMLBASICTYPE
- << COMMAND_QMLMODULE
- << COMMAND_JSTYPE
- << COMMAND_JSPROPERTY
- << COMMAND_JSPROPERTYGROUP
- << COMMAND_JSATTACHEDPROPERTY
- << COMMAND_JSSIGNAL
- << COMMAND_JSATTACHEDSIGNAL
- << COMMAND_JSMETHOD
- << COMMAND_JSATTACHEDMETHOD
- << COMMAND_JSBASICTYPE
- << COMMAND_JSMODULE;
- }
- return topicCommands_;
-}
-
-/*!
- Process the topic \a command found in the \a doc with argument \a arg.
- */
-Node* CppCodeParser::processTopicCommand(const Doc& doc,
- const QString& command,
- const ArgLocPair& arg)
-{
- ExtraFuncData extra;
- if (command == COMMAND_FN) {
- QStringList parentPath;
- FunctionNode *func = 0;
- FunctionNode *clone = 0;
-
- if (!makeFunctionNode(arg.first, &parentPath, &clone, extra) &&
- !makeFunctionNode("void " + arg.first, &parentPath, &clone, extra)) {
- doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN));
- }
- else {
- func = qdb_->findFunctionNode(parentPath, clone);
- if (func == 0) {
- if (parentPath.isEmpty() && !lastPath_.isEmpty())
- func = qdb_->findFunctionNode(lastPath_, clone);
- }
-
- /*
- If the node was not found, then search for it in the
- open C++ namespaces. We don't expect this search to
- be necessary often. Nor do we expect it to succeed
- very often.
- */
- if (func == 0)
- func = qdb_->findNodeInOpenNamespace(parentPath, clone);
-
- if (func == 0) {
- doc.location().warning(tr("Cannot find '%1' in '\\%2' %3")
- .arg(clone->name() + "(...)")
- .arg(COMMAND_FN)
- .arg(arg.first),
- tr("I cannot find any function of that name with the "
- "specified signature. Make sure that the signature "
- "is identical to the declaration, including 'const' "
- "qualifiers."));
- }
- else
- lastPath_ = parentPath;
- if (func) {
- func->borrowParameterNames(clone);
- func->setParentPath(clone->parentPath());
- }
- delete clone;
- }
- return func;
- }
- else if (command == COMMAND_MACRO) {
- QStringList parentPath;
- FunctionNode *func = 0;
-
- extra.root = qdb_->primaryTreeRoot();
- extra.isMacro = true;
- if (makeFunctionNode(arg.first, &parentPath, &func, extra)) {
- if (!parentPath.isEmpty()) {
- doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_MACRO));
- delete func;
- func = 0;
- }
- else {
- func->setMetaness(FunctionNode::MacroWithParams);
- QVector params = func->parameters();
- for (int i = 0; i < params.size(); ++i) {
- Parameter ¶m = params[i];
- if (param.name().isEmpty() && !param.dataType().isEmpty()
- && param.dataType() != "...")
- param = Parameter("", "", param.dataType());
- }
- func->setParameters(params);
- }
- return func;
- }
- else if (QRegExp("[A-Za-z_][A-Za-z0-9_]+").exactMatch(arg.first)) {
- func = new FunctionNode(qdb_->primaryTreeRoot(), arg.first);
- func->setAccess(Node::Public);
- func->setLocation(doc.startLocation());
- func->setMetaness(FunctionNode::MacroWithoutParams);
- }
- else {
- doc.location().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_MACRO));
-
- }
- return func;
- }
- else if (nodeTypeMap.contains(command)) {
- /*
- We should only get in here if the command refers to
- something that can appear in a C++ namespace,
- i.e. a class, another namespace, an enum, a typedef,
- a property or a variable. I think these are handled
- this way to allow the writer to refer to the entity
- without including the namespace qualifier.
- */
- Node::NodeType type = nodeTypeMap[command];
- QStringList paths = arg.first.split(QLatin1Char(' '));
- QStringList path = paths[0].split("::");
- Node *node = 0;
-
- node = qdb_->findNodeInOpenNamespace(path, type);
- if (node == 0)
- node = qdb_->findNodeByNameAndType(path, type);
- if (node == 0) {
- doc.location().warning(tr("Cannot find '%1' specified with '\\%2' in any header file")
- .arg(arg.first).arg(command));
- lastPath_ = path;
-
- }
- else if (node->isAggregate()) {
- if (type == Node::Namespace) {
- NamespaceNode* ns = static_cast(node);
- ns->markSeen();
- }
- /*
- This treats a class as a namespace.
- */
- if ((type == Node::Class) || (type == Node::Namespace)) {
- if (path.size() > 1) {
- path.pop_back();
- QString ns = path.join("::");
- qdb_->insertOpenNamespace(ns);
- }
- }
- }
- return node;
- }
- else if (command == COMMAND_EXAMPLE) {
- if (Config::generateExamples) {
- ExampleNode* en = new ExampleNode(qdb_->primaryTreeRoot(), arg.first);
- en->setLocation(doc.startLocation());
- createExampleFileNodes(en);
- return en;
- }
- }
- else if (command == COMMAND_EXTERNALPAGE) {
- DocumentNode* dn = new DocumentNode(qdb_->primaryTreeRoot(),
- arg.first,
- Node::ExternalPage,
- Node::ArticlePage);
- dn->setLocation(doc.startLocation());
- return dn;
- }
- else if (command == COMMAND_FILE) {
- DocumentNode* dn = new DocumentNode(qdb_->primaryTreeRoot(),
- arg.first,
- Node::File,
- Node::NoPageType);
- dn->setLocation(doc.startLocation());
- return dn;
- }
- else if (command == COMMAND_HEADERFILE) {
- DocumentNode* dn = new DocumentNode(qdb_->primaryTreeRoot(),
- arg.first,
- Node::HeaderFile,
- Node::ApiPage);
- dn->setLocation(doc.startLocation());
- return dn;
- }
- else if (command == COMMAND_GROUP) {
- CollectionNode* cn = qdb_->addGroup(arg.first);
- cn->setLocation(doc.startLocation());
- cn->markSeen();
- return cn;
- }
- else if (command == COMMAND_MODULE) {
- CollectionNode* cn = qdb_->addModule(arg.first);
- cn->setLocation(doc.startLocation());
- cn->markSeen();
- return cn;
- }
- else if (command == COMMAND_QMLMODULE) {
- QStringList blankSplit = arg.first.split(QLatin1Char(' '));
- CollectionNode* cn = qdb_->addQmlModule(blankSplit[0]);
- cn->setLogicalModuleInfo(blankSplit);
- cn->setLocation(doc.startLocation());
- cn->markSeen();
- return cn;
- }
- else if (command == COMMAND_JSMODULE) {
- QStringList blankSplit = arg.first.split(QLatin1Char(' '));
- CollectionNode* cn = qdb_->addJsModule(blankSplit[0]);
- cn->setLogicalModuleInfo(blankSplit);
- cn->setLocation(doc.startLocation());
- cn->markSeen();
- return cn;
- }
- else if (command == COMMAND_PAGE) {
- Node::PageType ptype = Node::ArticlePage;
- QStringList args = arg.first.split(QLatin1Char(' '));
- if (args.size() > 1) {
- QString t = args[1].toLower();
- if (t == "howto")
- ptype = Node::HowToPage;
- else if (t == "api")
- ptype = Node::ApiPage;
- else if (t == "example")
- ptype = Node::ExamplePage;
- else if (t == "overview")
- ptype = Node::OverviewPage;
- else if (t == "tutorial")
- ptype = Node::TutorialPage;
- else if (t == "faq")
- ptype = Node::FAQPage;
- else if (t == "ditamap")
- ptype = Node::DitaMapPage;
- }
- DocumentNode* dn = 0;
- if (ptype == Node::DitaMapPage)
- dn = new DitaMapNode(qdb_->primaryTreeRoot(), args[0]);
- else
- dn = new DocumentNode(qdb_->primaryTreeRoot(), args[0], Node::Page, ptype);
- dn->setLocation(doc.startLocation());
- return dn;
- }
- else if (command == COMMAND_DITAMAP) {
- DocumentNode* dn = new DitaMapNode(qdb_->primaryTreeRoot(), arg.first);
- dn->setLocation(doc.startLocation());
- return dn;
- }
- else if ((command == COMMAND_QMLTYPE) || (command == COMMAND_JSTYPE)) {
- QmlTypeNode* qcn = new QmlTypeNode(qdb_->primaryTreeRoot(), arg.first);
- if (command == COMMAND_JSTYPE)
- qcn->setGenus(Node::JS);
- qcn->setLocation(doc.startLocation());
- return qcn;
- }
- else if ((command == COMMAND_QMLBASICTYPE) || (command == COMMAND_JSBASICTYPE)) {
- QmlBasicTypeNode* n = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first);
- if (command == COMMAND_JSBASICTYPE)
- n->setGenus(Node::JS);
- n->setLocation(doc.startLocation());
- return n;
- }
- else if ((command == COMMAND_QMLSIGNAL) ||
- (command == COMMAND_QMLMETHOD) ||
- (command == COMMAND_QMLATTACHEDSIGNAL) ||
- (command == COMMAND_QMLATTACHEDMETHOD) ||
- (command == COMMAND_JSSIGNAL) ||
- (command == COMMAND_JSMETHOD) ||
- (command == COMMAND_JSATTACHEDSIGNAL) ||
- (command == COMMAND_JSATTACHEDMETHOD)) {
- QString module;
- QString qmlTypeName;
- QString type;
- if (splitQmlMethodArg(arg.first, type, module, qmlTypeName)) {
- QmlTypeNode* qmlType = qdb_->findQmlType(module, qmlTypeName);
- if (qmlType) {
- bool attached = false;
- Node::NodeType nodeType = Node::QmlMethod;
- if ((command == COMMAND_QMLSIGNAL) ||
- (command == COMMAND_JSSIGNAL))
- nodeType = Node::QmlSignal;
- else if ((command == COMMAND_QMLATTACHEDSIGNAL) ||
- (command == COMMAND_JSATTACHEDSIGNAL)) {
- nodeType = Node::QmlSignal;
- attached = true;
- }
- else if ((command == COMMAND_QMLMETHOD) ||
- (command == COMMAND_JSMETHOD)) {
- // do nothing
- }
- else if ((command == COMMAND_QMLATTACHEDMETHOD) ||
- (command == COMMAND_JSATTACHEDMETHOD))
- attached = true;
- else
- return 0; // never get here.
- FunctionNode* fn = makeFunctionNode(doc,
- arg.first,
- qmlType,
- nodeType,
- attached,
- command);
- if (fn) {
- fn->setLocation(doc.startLocation());
- if ((command == COMMAND_JSSIGNAL) ||
- (command == COMMAND_JSMETHOD) ||
- (command == COMMAND_JSATTACHEDSIGNAL) ||
- (command == COMMAND_JSATTACHEDMETHOD))
- fn->setGenus(Node::JS);
- }
- return fn;
- }
- }
- }
- return 0;
-}
-
-/*!
- A QML property group argument has the form...
-
- ::::
-
- This function splits the argument into those parts.
- A is the QML equivalent of a C++ namespace.
- So this function splits \a arg on "::" and stores the
- parts in \a module, \a qmlTypeName, and \a name, and returns
- true. If any part is not found, a qdoc warning is emitted
- and false is returned.
- */
-bool CppCodeParser::splitQmlPropertyGroupArg(const QString& arg,
- QString& module,
- QString& qmlTypeName,
- QString& name)
-{
- QStringList colonSplit = arg.split("::");
- if (colonSplit.size() == 3) {
- module = colonSplit[0];
- qmlTypeName = colonSplit[1];
- name = colonSplit[2];
- return true;
- }
- QString msg = "Unrecognizable QML module/component qualifier for " + arg;
- location().warning(tr(msg.toLatin1().data()));
- return false;
-}
-
-/*!
- A QML property argument has the form...
-
- ::
- ::::
-
- This function splits the argument into one of those
- two forms. The three part form is the old form, which
- was used before the creation of Qt Quick 2 and Qt
- Components. A is the QML equivalent of a
- C++ namespace. So this function splits \a arg on "::"
- and stores the parts in \a type, \a module, \a qmlTypeName,
- and \a name, and returns \c true. If any part other than
- \a module is not found, a qdoc warning is emitted and
- false is returned.
-
- \note The two QML types \e{Component} and \e{QtObject}
- never have a module qualifier.
- */
-bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
- QString& type,
- QString& module,
- QString& qmlTypeName,
- QString& name)
-{
- QStringList blankSplit = arg.split(QLatin1Char(' '));
- if (blankSplit.size() > 1) {
- type = blankSplit[0];
- QStringList colonSplit(blankSplit[1].split("::"));
- if (colonSplit.size() == 3) {
- module = colonSplit[0];
- qmlTypeName = colonSplit[1];
- name = colonSplit[2];
- return true;
- }
- if (colonSplit.size() == 2) {
- module.clear();
- qmlTypeName = colonSplit[0];
- name = colonSplit[1];
- return true;
- }
- QString msg = "Unrecognizable QML module/component qualifier for " + arg;
- location().warning(tr(msg.toLatin1().data()));
- }
- else {
- QString msg = "Missing property type for " + arg;
- location().warning(tr(msg.toLatin1().data()));
- }
- return false;
-}
-
-/*!
- A QML signal or method argument has the form...
-
- ::(, , ...)
- ::::(, , ...)
-
- This function splits the \a{arg}ument into one of those
- two forms, sets \a type, \a module, and \a qmlTypeName,
- and returns true. If the argument doesn't match either
- form, an error message is emitted and false is returned.
-
- \note The two QML types \e{Component} and \e{QtObject} never
- have a module qualifier.
- */
-bool CppCodeParser::splitQmlMethodArg(const QString& arg,
- QString& type,
- QString& module,
- QString& qmlTypeName)
-{
- QString name;
- int leftParen = arg.indexOf(QChar('('));
- if (leftParen > 0)
- name = arg.left(leftParen);
- else
- name = arg;
- int firstBlank = name.indexOf(QChar(' '));
- if (firstBlank > 0) {
- type = name.left(firstBlank);
- name = name.right(name.length() - firstBlank - 1);
- }
- else
- type.clear();
-
- QStringList colonSplit(name.split("::"));
- if (colonSplit.size() > 1) {
- if (colonSplit.size() > 2) {
- module = colonSplit[0];
- qmlTypeName = colonSplit[1];
- }
- else {
- module.clear();
- qmlTypeName = colonSplit[0];
- }
- return true;
- }
- QString msg = "Unrecognizable QML module/component qualifier for " + arg;
- location().warning(tr(msg.toLatin1().data()));
- return false;
-}
-
-/*!
- Process the topic \a command group found in the \a doc with arguments \a args.
-
- Currently, this function is called only for \e{qmlproperty}
- and \e{qmlattachedproperty}.
- */
-void CppCodeParser::processQmlProperties(const Doc& doc,
- NodeList& nodes,
- DocList& docs,
- bool jsProps)
-{
- QString arg;
- QString type;
- QString topic;
- QString module;
- QString qmlTypeName;
- QString property;
- QmlPropertyNode* qpn = 0;
- QmlTypeNode* qmlType = 0;
- QmlPropertyGroupNode* qpgn = 0;
-
- Topic qmlPropertyGroupTopic;
- const TopicList& topics = doc.topicsUsed();
- for (int i=0; i 1) {
- qmlPropertyGroupTopic = topics.at(0);
- if (jsProps)
- qmlPropertyGroupTopic.topic = COMMAND_JSPROPERTYGROUP;
- else
- qmlPropertyGroupTopic.topic = COMMAND_QMLPROPERTYGROUP;
- arg = qmlPropertyGroupTopic.args;
- if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property)) {
- int i = property.indexOf('.');
- if (i != -1) {
- property = property.left(i);
- qmlPropertyGroupTopic.args = module + "::" + qmlTypeName + "::" + property;
- doc.location().warning(tr("No QML property group command found; using \\%1 %2")
- .arg(COMMAND_QMLPROPERTYGROUP).arg(qmlPropertyGroupTopic.args));
- }
- else {
- /*
- Assumption: No '.' in the property name
- means there is no property group.
- */
- qmlPropertyGroupTopic.clear();
- }
- }
- }
-
- if (!qmlPropertyGroupTopic.isEmpty()) {
- arg = qmlPropertyGroupTopic.args;
- if (splitQmlPropertyGroupArg(arg, module, qmlTypeName, property)) {
- qmlType = qdb_->findQmlType(module, qmlTypeName);
- if (qmlType) {
- qpgn = new QmlPropertyGroupNode(qmlType, property);
- qpgn->setLocation(doc.startLocation());
- if (jsProps)
- qpgn->setGenus(Node::JS);
- nodes.append(qpgn);
- docs.append(doc);
- }
- }
- }
- for (int i=0; ifindQmlType(module, qmlTypeName);
- if (qmlType) {
- if (qmlType->hasQmlProperty(property, attached) != 0) {
- QString msg = tr("QML property documented multiple times: '%1'").arg(arg);
- doc.startLocation().warning(msg);
- }
- else if (qpgn) {
- qpn = new QmlPropertyNode(qpgn, property, type, attached);
- qpn->setLocation(doc.startLocation());
- if (jsProps)
- qpn->setGenus(Node::JS);
- }
- else {
- qpn = new QmlPropertyNode(qmlType, property, type, attached);
- qpn->setLocation(doc.startLocation());
- if (jsProps)
- qpn->setGenus(Node::JS);
- nodes.append(qpn);
- docs.append(doc);
- }
- }
- }
- } else if (qpgn) {
- doc.startLocation().warning(
- tr("Invalid use of '\\%1'; not allowed in a '\\%2'").arg(
- topic, qmlPropertyGroupTopic.topic));
- }
- }
-}
-
-static QSet otherMetaCommands_;
-/*!
- Returns the set of strings representing the common metacommands
- plus some other metacommands.
- */
-const QSet& CppCodeParser::otherMetaCommands()
-{
- if (otherMetaCommands_.isEmpty()) {
- otherMetaCommands_ = commonMetaCommands();
- otherMetaCommands_ << COMMAND_INHEADERFILE
- << COMMAND_OVERLOAD
- << COMMAND_REIMP
- << COMMAND_RELATES
- << COMMAND_CONTENTSPAGE
- << COMMAND_NEXTPAGE
- << COMMAND_PREVIOUSPAGE
- << COMMAND_INDEXPAGE
- << COMMAND_STARTPAGE
- << COMMAND_QMLINHERITS
- << COMMAND_QMLINSTANTIATES
- << COMMAND_QMLDEFAULT
- << COMMAND_QMLREADONLY
- << COMMAND_QMLABSTRACT
- << COMMAND_ABSTRACT;
- }
- return otherMetaCommands_;
-}
-
-/*!
- Process the metacommand \a command in the context of the
- \a node associated with the topic command and the \a doc.
- \a arg is the argument to the metacommand.
- */
-void CppCodeParser::processOtherMetaCommand(const Doc& doc,
- const QString& command,
- const ArgLocPair& argLocPair,
- Node *node)
-{
- QString arg = argLocPair.first;
- if (command == COMMAND_INHEADERFILE) {
- if (node != 0 && node->isAggregate()) {
- ((Aggregate *) node)->addInclude(arg);
- }
- else {
- doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_INHEADERFILE));
- }
- }
- else if (command == COMMAND_OVERLOAD) {
- if (node && node->isFunction())
- ((FunctionNode *) node)->setOverloadFlag(true);
- else
- doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_OVERLOAD));
- }
- else if (command == COMMAND_REIMP) {
- if (node != 0 && node->parent() && !node->parent()->isInternal()) {
- if (node->type() == Node::Function) {
- FunctionNode *func = (FunctionNode *) node;
- const FunctionNode *from = func->reimplementedFrom();
- if (from == 0) {
- doc.location().warning(tr("Cannot find base function for '\\%1' in %2()")
- .arg(COMMAND_REIMP).arg(node->name()),
- tr("The function either doesn't exist in any "
- "base class with the same signature or it "
- "exists but isn't virtual."));
- }
- /*
- Ideally, we would enable this check to warn whenever
- \reimp is used incorrectly, and only make the node
- internal if the function is a reimplementation of
- another function in a base class.
- */
- else if (from->access() == Node::Private
- || from->parent()->access() == Node::Private) {
- doc.location().warning(tr("'\\%1' in %2() should be '\\internal' "
- "because its base function is private "
- "or internal").arg(COMMAND_REIMP).arg(node->name()));
- }
- func->setReimplemented(true);
- }
- else {
- doc.location().warning(tr("Ignored '\\%1' in %2").arg(COMMAND_REIMP).arg(node->name()));
- }
- }
- }
- else if (command == COMMAND_RELATES) {
- QStringList path = arg.split("::");
- Node* n = qdb_->findRelatesNode(path);
- if (!n) {
- // Store just a string to write to the index file
- if (Generator::preparing())
- node->setRelates(arg);
- else
- doc.location().warning(tr("Cannot find '%1' in '\\%2'").arg(arg).arg(COMMAND_RELATES));
-
- }
- else if (node->parent() != n)
- node->setRelates(static_cast(n));
- else
- doc.location().warning(tr("Invalid use of '\\%1' (already a member of '%2')")
- .arg(COMMAND_RELATES, arg));
- }
- else if (command == COMMAND_CONTENTSPAGE) {
- setLink(node, Node::ContentsLink, arg);
- }
- else if (command == COMMAND_NEXTPAGE) {
- setLink(node, Node::NextLink, arg);
- }
- else if (command == COMMAND_PREVIOUSPAGE) {
- setLink(node, Node::PreviousLink, arg);
- }
- else if (command == COMMAND_INDEXPAGE) {
- setLink(node, Node::IndexLink, arg);
- }
- else if (command == COMMAND_STARTPAGE) {
- setLink(node, Node::StartLink, arg);
- }
- else if (command == COMMAND_QMLINHERITS) {
- if (node->name() == arg)
- doc.location().warning(tr("%1 tries to inherit itself").arg(arg));
- else if (node->isQmlType() || node->isJsType()) {
- QmlTypeNode* qmlType = static_cast(node);
- qmlType->setQmlBaseName(arg);
- QmlTypeNode::addInheritedBy(arg,node);
- }
- }
- else if (command == COMMAND_QMLINSTANTIATES) {
- if (node->isQmlType() || node->isJsType()) {
- ClassNode* classNode = qdb_->findClassNode(arg.split("::"));
- if (classNode)
- node->setClassNode(classNode);
- else
- doc.location().warning(tr("C++ class %1 not found: \\instantiates %1").arg(arg));
- }
- else
- doc.location().warning(tr("\\instantiates is only allowed in \\qmltype"));
- }
- else if (command == COMMAND_QMLDEFAULT) {
- if (node->type() == Node::QmlProperty) {
- QmlPropertyNode* qpn = static_cast(node);
- qpn->setDefault();
- }
- else if (node->type() == Node::QmlPropertyGroup) {
- QmlPropertyGroupNode* qpgn = static_cast(node);
- NodeList::ConstIterator p = qpgn->childNodes().constBegin();
- while (p != qpgn->childNodes().constEnd()) {
- if ((*p)->type() == Node::QmlProperty) {
- QmlPropertyNode* qpn = static_cast(*p);
- qpn->setDefault();
- }
- ++p;
- }
- }
- }
- else if (command == COMMAND_QMLREADONLY) {
- if (node->type() == Node::QmlProperty) {
- QmlPropertyNode* qpn = static_cast(node);
- qpn->setReadOnly(1);
- }
- else if (node->type() == Node::QmlPropertyGroup) {
- QmlPropertyGroupNode* qpgn = static_cast(node);
- NodeList::ConstIterator p = qpgn->childNodes().constBegin();
- while (p != qpgn->childNodes().constEnd()) {
- if ((*p)->type() == Node::QmlProperty) {
- QmlPropertyNode* qpn = static_cast(*p);
- qpn->setReadOnly(1);
- }
- ++p;
- }
- }
- }
- else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
- if (node->isQmlType() || node->isJsType())
- node->setAbstract(true);
- }
- else {
- processCommonMetaCommand(doc.location(),command,argLocPair,node);
- }
-}
-
-/*!
- The topic command has been processed resulting in the \a doc
- and \a node passed in here. Process the other meta commands,
- which are found in \a doc, in the context of the topic \a node.
- */
-void CppCodeParser::processOtherMetaCommands(const Doc& doc, Node *node)
-{
- const QSet metaCommands = doc.metaCommandsUsed();
- QSet::ConstIterator cmd = metaCommands.constBegin();
- while (cmd != metaCommands.constEnd()) {
- ArgList args = doc.metaCommandArgs(*cmd);
- ArgList::ConstIterator arg = args.constBegin();
- while (arg != args.constEnd()) {
- processOtherMetaCommand(doc, *cmd, *arg, node);
- ++arg;
- }
- ++cmd;
- }
-}
-
-/*!
- Resets the C++ code parser to its default initialized state.
- */
-void CppCodeParser::reset()
-{
- tokenizer = 0;
- tok = 0;
- access = Node::Public;
- metaness_ = FunctionNode::Plain;
- lastPath_.clear();
- physicalModuleName.clear();
-}
-
-/*!
- Get the next token from the file being parsed and store it
- in the token variable.
- */
-void CppCodeParser::readToken()
-{
- tok = tokenizer->getToken();
-}
-
-/*!
- Return the current location in the file being parsed,
- i.e. the file name, line number, and column number.
- */
-const Location& CppCodeParser::location()
-{
- return tokenizer->location();
-}
-
-/*!
- Return the previous string read from the file being parsed.
- */
-QString CppCodeParser::previousLexeme()
-{
- return tokenizer->previousLexeme();
-}
-
-/*!
- Return the current string string from the file being parsed.
- */
-QString CppCodeParser::lexeme()
-{
- return tokenizer->lexeme();
-}
-
-bool CppCodeParser::match(int target)
-{
- if (tok == target) {
- readToken();
- return true;
- }
- return false;
-}
-
-/*!
- Skip to \a target. If \a target is found before the end
- of input, return true. Otherwise return false.
- */
-bool CppCodeParser::skipTo(int target)
-{
- while ((tok != Tok_Eoi) && (tok != target))
- readToken();
- return tok == target;
-}
-
-/*!
- If the current token is one of the keyword thingees that
- are used in Qt, skip over it to the next token and return
- true. Otherwise just return false without reading the
- next token.
- */
-bool CppCodeParser::matchCompat()
-{
- switch (tok) {
- case Tok_QT_COMPAT:
- case Tok_QT_COMPAT_CONSTRUCTOR:
- case Tok_QT_DEPRECATED:
- case Tok_QT_MOC_COMPAT:
- case Tok_QT3_SUPPORT:
- case Tok_QT3_SUPPORT_CONSTRUCTOR:
- case Tok_QT3_MOC_SUPPORT:
- readToken();
- return true;
- default:
- return false;
- }
-}
-
-bool CppCodeParser::matchModuleQualifier(QString& name)
-{
- bool matches = (lexeme() == QString('.'));
- if (matches) {
- do {
- name += lexeme();
- readToken();
- } while ((tok == Tok_Ident) || (lexeme() == QString('.')));
- }
- return matches;
-}
-
-bool CppCodeParser::matchTemplateAngles(CodeChunk *dataType)
-{
- bool matches = (tok == Tok_LeftAngle);
- if (matches) {
- int leftAngleDepth = 0;
- int parenAndBraceDepth = 0;
- do {
- if (tok == Tok_LeftAngle) {
- leftAngleDepth++;
- }
- else if (tok == Tok_RightAngle) {
- leftAngleDepth--;
- }
- else if (tok == Tok_LeftParen || tok == Tok_LeftBrace) {
- ++parenAndBraceDepth;
- }
- else if (tok == Tok_RightParen || tok == Tok_RightBrace) {
- if (--parenAndBraceDepth < 0)
- return false;
- }
- if (dataType != 0)
- dataType->append(lexeme());
- readToken();
- } while (leftAngleDepth > 0 && tok != Tok_Eoi);
- }
- return matches;
-}
-
-/*
- This function is no longer used.
- */
-bool CppCodeParser::matchTemplateHeader()
-{
- readToken();
- return matchTemplateAngles();
-}
-
-bool CppCodeParser::matchDataType(CodeChunk *dataType, QString *var)
-{
- /*
- This code is really hard to follow... sorry. The loop is there to match
- Alpha::Beta::Gamma::...::Omega.
- */
- for (;;) {
- bool virgin = true;
-
- if (tok != Tok_Ident) {
- /*
- There is special processing for 'Foo::operator int()'
- and such elsewhere. This is the only case where we
- return something with a trailing gulbrandsen ('Foo::').
- */
- if (tok == Tok_operator)
- return true;
-
- /*
- People may write 'const unsigned short' or
- 'short unsigned const' or any other permutation.
- */
- while (match(Tok_const) || match(Tok_volatile))
- dataType->append(previousLexeme());
- while (match(Tok_signed) || match(Tok_unsigned) ||
- match(Tok_short) || match(Tok_long) || match(Tok_int64)) {
- dataType->append(previousLexeme());
- virgin = false;
- }
- while (match(Tok_const) || match(Tok_volatile))
- dataType->append(previousLexeme());
-
- if (match(Tok_Tilde))
- dataType->append(previousLexeme());
- }
-
- if (virgin) {
- if (match(Tok_Ident)) {
- /*
- This is a hack until we replace this "parser"
- with the real one used in Qt Creator.
- */
- if (!inMacroCommand_ && lexeme() == "(" &&
- ((previousLexeme() == "QT_PREPEND_NAMESPACE") || (previousLexeme() == "NS"))) {
- readToken();
- readToken();
- dataType->append(previousLexeme());
- readToken();
- }
- else
- dataType->append(previousLexeme());
- }
- else if (match(Tok_void) || match(Tok_int) || match(Tok_char) ||
- match(Tok_double) || match(Tok_Ellipsis)) {
- dataType->append(previousLexeme());
- }
- else {
- return false;
- }
- }
- else if (match(Tok_int) || match(Tok_char) || match(Tok_double)) {
- dataType->append(previousLexeme());
- }
-
- matchTemplateAngles(dataType);
-
- while (match(Tok_const) || match(Tok_volatile))
- dataType->append(previousLexeme());
-
- if (match(Tok_Gulbrandsen))
- dataType->append(previousLexeme());
- else
- break;
- }
-
- while (match(Tok_Ampersand) || match(Tok_Aster) || match(Tok_const) ||
- match(Tok_Caret))
- dataType->append(previousLexeme());
-
- if (match(Tok_LeftParenAster)) {
- /*
- A function pointer. This would be rather hard to handle without a
- tokenizer hack, because a type can be followed with a left parenthesis
- in some cases (e.g., 'operator int()'). The tokenizer recognizes '(*'
- as a single token.
- */
- dataType->append(previousLexeme());
- dataType->appendHotspot();
- if (var != 0 && match(Tok_Ident))
- *var = previousLexeme();
- if (!match(Tok_RightParen) || tok != Tok_LeftParen) {
- return false;
- }
- dataType->append(previousLexeme());
-
- int parenDepth0 = tokenizer->parenDepth();
- while (tokenizer->parenDepth() >= parenDepth0 && tok != Tok_Eoi) {
- dataType->append(lexeme());
- readToken();
- }
- if (match(Tok_RightParen))
- dataType->append(previousLexeme());
- }
- else {
- /*
- The common case: Look for an optional identifier, then for
- some array brackets.
- */
- dataType->appendHotspot();
-
- if (var != 0) {
- if (match(Tok_Ident)) {
- *var = previousLexeme();
- }
- else if (match(Tok_Comment)) {
- /*
- A neat hack: Commented-out parameter names are
- recognized by qdoc. It's impossible to illustrate
- here inside a C-style comment, because it requires
- an asterslash. It's also impossible to illustrate
- inside a C++-style comment, because the explanation
- does not fit on one line.
- */
- if (varComment.exactMatch(previousLexeme()))
- *var = varComment.cap(1);
- }
- }
-
- if (tok == Tok_LeftBracket) {
- int bracketDepth0 = tokenizer->bracketDepth();
- while ((tokenizer->bracketDepth() >= bracketDepth0 &&
- tok != Tok_Eoi) ||
- tok == Tok_RightBracket) {
- dataType->append(lexeme());
- readToken();
- }
- }
- }
- return true;
-}
-
-/*!
- Parse the next function parameter, if there is one, and
- append it to parameter vector \a pvect. Return true if
- a parameter is parsed and appended to \a pvect.
- Otherwise return false.
- */
-bool CppCodeParser::matchParameter(QVector& pvect, bool& isQPrivateSignal)
-{
- if (match(Tok_QPrivateSignal)) {
- isQPrivateSignal = true;
- return true;
- }
-
- Parameter p;
- CodeChunk chunk;
- if (!matchDataType(&chunk, &p.name_)) {
- return false;
- }
- p.dataType_ = chunk.toString();
- chunk.clear();
- match(Tok_Comment);
- if (match(Tok_Equal)) {
- int pdepth = tokenizer->parenDepth();
- while (tokenizer->parenDepth() >= pdepth &&
- (tok != Tok_Comma || (tokenizer->parenDepth() > pdepth)) &&
- tok != Tok_Eoi) {
- chunk.append(lexeme());
- readToken();
- }
- }
- p.defaultValue_ = chunk.toString();
- pvect.append(p);
- return true;
-}
-
-/*!
- If the current token is any of several function modifiers,
- return that token value after reading the next token. If it
- is not one of the function modieifer tokens, return -1 but
- don\t read the next token.
- */
-int CppCodeParser::matchFunctionModifier()
-{
- switch (tok) {
- case Tok_friend:
- case Tok_inline:
- case Tok_explicit:
- case Tok_static:
- case Tok_QT_DEPRECATED:
- readToken();
- return tok;
- case Tok_QT_COMPAT:
- case Tok_QT_COMPAT_CONSTRUCTOR:
- case Tok_QT_MOC_COMPAT:
- case Tok_QT3_SUPPORT:
- case Tok_QT3_SUPPORT_CONSTRUCTOR:
- case Tok_QT3_MOC_SUPPORT:
- readToken();
- return Tok_QT_COMPAT;
- default:
- break;
- }
- return -1;
-}
-
-bool CppCodeParser::matchFunctionDecl(Aggregate *parent,
- QStringList *parentPathPtr,
- FunctionNode **funcPtr,
- const QString &templateStuff,
- ExtraFuncData& extra)
-{
- CodeChunk returnType;
- QStringList parentPath;
- QString name;
-
- bool matched_QT_DEPRECATED = false;
- bool matched_friend = false;
- bool matched_static = false;
- bool matched_inline = false;
- bool matched_explicit = false;
- bool matched_compat = false;
-
- int token = tok;
- while (token != -1) {
- switch (token) {
- case Tok_friend:
- matched_friend = true;
- break;
- case Tok_inline:
- matched_inline = true;
- break;
- case Tok_explicit:
- matched_explicit = true;
- break;
- case Tok_static:
- matched_static = true;
- break;
- case Tok_QT_DEPRECATED:
- // no break here.
- matched_QT_DEPRECATED = true;
- case Tok_QT_COMPAT:
- matched_compat = true;
- break;
- }
- token = matchFunctionModifier();
- }
-
- FunctionNode::Virtualness virtuality = FunctionNode::NonVirtual;
- if (match(Tok_virtual)) {
- virtuality = FunctionNode::NormalVirtual;
- if (!matched_compat)
- matched_compat = matchCompat();
- }
-
- if (!matchDataType(&returnType)) {
- if (tokenizer->parsingFnOrMacro()
- && (match(Tok_Q_DECLARE_FLAGS) ||
- match(Tok_Q_PROPERTY) ||
- match(Tok_Q_PRIVATE_PROPERTY)))
- returnType = CodeChunk(previousLexeme());
- else {
- return false;
- }
- }
-
- if (returnType.toString() == "QBool")
- returnType = CodeChunk("bool");
-
- if (!matched_compat)
- matched_compat = matchCompat();
-
- if (tok == Tok_operator &&
- (returnType.toString().isEmpty() ||
- returnType.toString().endsWith("::"))) {
- // 'QString::operator const char *()'
- parentPath = returnType.toString().split(sep);
- parentPath.removeAll(QString());
- returnType = CodeChunk();
- readToken();
-
- CodeChunk restOfName;
- if (tok != Tok_Tilde && matchDataType(&restOfName)) {
- name = "operator " + restOfName.toString();
- }
- else {
- name = previousLexeme() + lexeme();
- readToken();
- while (tok != Tok_LeftParen && tok != Tok_Eoi) {
- name += lexeme();
- readToken();
- }
- }
- if (tok != Tok_LeftParen) {
- return false;
- }
- }
- else if (tok == Tok_LeftParen) {
- // constructor or destructor
- parentPath = returnType.toString().split(sep);
- if (!parentPath.isEmpty()) {
- name = parentPath.last();
- parentPath.erase(parentPath.end() - 1);
- }
- returnType = CodeChunk();
- }
- else {
- while (match(Tok_Ident)) {
- name = previousLexeme();
- /*
- This is a hack to let QML module identifiers through.
- */
- matchModuleQualifier(name);
- matchTemplateAngles();
-
- if (match(Tok_Gulbrandsen))
- parentPath.append(name);
- else
- break;
- }
-
- if (tok == Tok_operator) {
- name = lexeme();
- readToken();
- while (tok != Tok_Eoi) {
- name += lexeme();
- readToken();
- if (tok == Tok_LeftParen)
- break;
- }
- }
- if (parent && (tok == Tok_Semicolon ||
- tok == Tok_LeftBracket ||
- tok == Tok_Colon)
- && access != Node::Private) {
- if (tok == Tok_LeftBracket) {
- returnType.appendHotspot();
-
- int bracketDepth0 = tokenizer->bracketDepth();
- while ((tokenizer->bracketDepth() >= bracketDepth0 &&
- tok != Tok_Eoi) ||
- tok == Tok_RightBracket) {
- returnType.append(lexeme());
- readToken();
- }
- if (tok != Tok_Semicolon) {
- return false;
- }
- }
- else if (tok == Tok_Colon) {
- returnType.appendHotspot();
-
- while (tok != Tok_Semicolon && tok != Tok_Eoi) {
- returnType.append(lexeme());
- readToken();
- }
- if (tok != Tok_Semicolon) {
- return false;
- }
- }
-
- VariableNode *var = new VariableNode(parent, name);
- var->setAccess(access);
- var->setLocation(location());
- var->setLeftType(returnType.left());
- var->setRightType(returnType.right());
- if (matched_compat)
- var->setStatus(Node::Compat);
- var->setStatic(matched_static);
- return false;
- }
- if (tok != Tok_LeftParen)
- return false;
- }
- readToken();
-
- // A left paren was seen. Parse the parameters
- bool isQPrivateSignal = false;
- QVector pvect;
- if (tok != Tok_RightParen) {
- do {
- if (!matchParameter(pvect, isQPrivateSignal))
- return false;
- } while (match(Tok_Comma));
- }
- // The parameters must end with a right paren
- if (!match(Tok_RightParen))
- return false;
-
- // look for const
- bool matchedConst = match(Tok_const);
-
- // look for 0 indicating pure virtual
- if (match(Tok_Equal) && match(Tok_Number))
- virtuality = FunctionNode::PureVirtual;
-
- // look for colon indicating ctors which must be skipped
- if (match(Tok_Colon)) {
- while (tok != Tok_LeftBrace && tok != Tok_Eoi)
- readToken();
- }
-
- // If no ';' expect a body, which must be skipped.
- bool body_expected = false;
- bool body_present = false;
- if (!match(Tok_Semicolon) && tok != Tok_Eoi) {
- body_expected = true;
- int nesting = tokenizer->braceDepth();
- if (!match(Tok_LeftBrace))
- return false;
- // skip the body
- while (tokenizer->braceDepth() >= nesting && tok != Tok_Eoi)
- readToken();
- body_present = true;
- match(Tok_RightBrace);
- }
-
- FunctionNode *func = 0;
- bool createFunctionNode = false;
- if (parsingHeaderFile_) {
- if (matched_friend) {
- if (matched_inline) {
- // nothing yet
- }
- if (body_present) {
- if (body_expected) {
- // nothing yet
- }
- createFunctionNode = true;
- if (parent && parent->parent())
- parent = parent->parent();
- else
- return false;
- }
- }
- else
- createFunctionNode = true;
- }
- else
- createFunctionNode = true;
-
- if (createFunctionNode) {
- func = new FunctionNode(extra.type, parent, name, extra.isAttached);
- if (matched_friend)
- access = Node::Public;
- func->setAccess(access);
- func->setLocation(location());
- func->setReturnType(returnType.toString());
- func->setParentPath(parentPath);
- func->setTemplateStuff(templateStuff);
- if (matched_compat)
- func->setStatus(Node::Compat);
- if (matched_QT_DEPRECATED)
- func->setStatus(Node::Deprecated);
- if (matched_explicit) { /* What can be done? */ }
- func->setMetaness(metaness_);
- if (parent) {
- if (name == parent->name())
- func->setMetaness(FunctionNode::Ctor);
- else if (name.startsWith(QLatin1Char('~')))
- func->setMetaness(FunctionNode::Dtor);
- }
- func->setStatic(matched_static);
- func->setConst(matchedConst);
- func->setVirtualness(virtuality);
- if (isQPrivateSignal)
- func->setPrivateSignal();
- if (!pvect.isEmpty()) {
- func->setParameters(pvect);
- }
- }
- if (parentPathPtr != 0)
- *parentPathPtr = parentPath;
- if (funcPtr != 0)
- *funcPtr = func;
- return true;
-}
-
-bool CppCodeParser::matchBaseSpecifier(ClassNode *classe, bool isClass)
-{
- Node::Access access;
-
- switch (tok) {
- case Tok_public:
- access = Node::Public;
- readToken();
- break;
- case Tok_protected:
- access = Node::Protected;
- readToken();
- break;
- case Tok_private:
- access = Node::Private;
- readToken();
- break;
- default:
- access = isClass ? Node::Private : Node::Public;
- }
-
- if (tok == Tok_virtual)
- readToken();
-
- CodeChunk baseClass;
- if (!matchDataType(&baseClass))
- return false;
-
- classe->addUnresolvedBaseClass(access, baseClass.toPath(), baseClass.toString());
- return true;
-}
-
-bool CppCodeParser::matchBaseList(ClassNode *classe, bool isClass)
-{
- for (;;) {
- if (!matchBaseSpecifier(classe, isClass))
- return false;
- if (tok == Tok_LeftBrace)
- return true;
- if (!match(Tok_Comma))
- return false;
- }
-}
-
-/*!
- Parse a C++ class, union, or struct declaration.
-
- This function only handles one level of class nesting, but that is
- sufficient for Qt because there are no cases of class nesting more
- than one level deep.
- */
-bool CppCodeParser::matchClassDecl(Aggregate *parent,
- const QString &templateStuff)
-{
- bool isClass = (tok == Tok_class);
- readToken();
-
- bool compat = matchCompat();
-
- if (tok != Tok_Ident)
- return false;
- while (tok == Tok_Ident)
- readToken();
- if (tok == Tok_Gulbrandsen) {
- Node* n = parent->findChildNode(previousLexeme(),Node::Class);
- if (n) {
- parent = static_cast(n);
- if (parent) {
- readToken();
- if (tok != Tok_Ident)
- return false;
- readToken();
- }
- }
- }
- if (tok != Tok_Colon && tok != Tok_LeftBrace)
- return false;
-
- /*
- So far, so good. We have 'class Foo {' or 'class Foo :'.
- This is enough to recognize a class definition.
- */
- ClassNode *classe = new ClassNode(parent, previousLexeme());
- classe->setAccess(access);
- classe->setLocation(location());
- if (compat)
- classe->setStatus(Node::Compat);
- if (!physicalModuleName.isEmpty())
- classe->setPhysicalModuleName(physicalModuleName);
- classe->setTemplateStuff(templateStuff);
-
- if (match(Tok_Colon) && !matchBaseList(classe, isClass))
- return false;
- if (!match(Tok_LeftBrace))
- return false;
-
- Node::Access outerAccess = access;
- access = isClass ? Node::Private : Node::Public;
- FunctionNode::Metaness outerMetaness = metaness_;
- metaness_ = FunctionNode::Plain;
-
- bool matches = (matchDeclList(classe) && match(Tok_RightBrace) &&
- match(Tok_Semicolon));
- access = outerAccess;
- metaness_ = outerMetaness;
- return matches;
-}
-
-bool CppCodeParser::matchNamespaceDecl(Aggregate *parent)
-{
- readToken(); // skip 'namespace'
- if (tok != Tok_Ident)
- return false;
- while (tok == Tok_Ident)
- readToken();
- if (tok != Tok_LeftBrace)
- return false;
-
- /*
- So far, so good. We have 'namespace Foo {'.
- */
- QString namespaceName = previousLexeme();
- NamespaceNode* ns = 0;
- if (parent)
- ns = static_cast(parent->findChildNode(namespaceName, Node::Namespace));
- if (!ns) {
- ns = new NamespaceNode(parent, namespaceName);
- ns->setAccess(access);
- ns->setLocation(location());
- }
-
- readToken(); // skip '{'
- bool matched = matchDeclList(ns);
- return matched && match(Tok_RightBrace);
-}
-
-/*!
- Match a C++ \c using clause. Return \c true if the match
- is successful. Otherwise false.
-
- If the \c using clause is for a namespace, an open namespace
- insertOpenNamespace(name);
- }
- else if (parent && parent->isClass()) {
- ClassNode* cn = static_cast(parent);
- cn->addUnresolvedUsingClause(name);
- }
- return true;
-}
-
-bool CppCodeParser::matchEnumItem(Aggregate *parent, EnumNode *enume)
-{
- if (!match(Tok_Ident))
- return false;
-
- QString name = previousLexeme();
- CodeChunk val;
- int parenLevel = 0;
-
- if (match(Tok_Equal)) {
- while (tok != Tok_RightBrace && tok != Tok_Eoi) {
- if (tok == Tok_LeftParen)
- parenLevel++;
- else if (tok == Tok_RightParen)
- parenLevel--;
- else if (tok == Tok_Comma) {
- if (parenLevel <= 0)
- break;
- }
- val.append(lexeme());
- readToken();
- }
- }
-
- if (enume) {
- QString strVal = val.toString();
- if (strVal.isEmpty()) {
- if (enume->items().isEmpty()) {
- strVal = "0";
- }
- else {
- QString last = enume->items().last().value();
- bool ok;
- int n = last.toInt(&ok);
- if (ok) {
- if (last.startsWith(QLatin1Char('0')) && last.size() > 1) {
- if (last.startsWith("0x") || last.startsWith("0X"))
- strVal = last.left(2) + QString::number(n + 1, 16);
- else
- strVal = QLatin1Char('0') + QString::number(n + 1, 8);
- }
- else
- strVal = QString::number(n + 1);
- }
- }
- }
-
- enume->addItem(EnumItem(name, strVal));
- }
- else {
- VariableNode *var = new VariableNode(parent, name);
- var->setAccess(access);
- var->setLocation(location());
- var->setLeftType("const int");
- var->setStatic(true);
- }
- return true;
-}
-
-bool CppCodeParser::matchEnumDecl(Aggregate *parent)
-{
- QString name;
-
- if (!match(Tok_enum))
- return false;
- if (match(Tok_Ident))
- name = previousLexeme();
- if (tok != Tok_LeftBrace)
- return false;
-
- EnumNode *enume = 0;
-
- if (!name.isEmpty()) {
- enume = new EnumNode(parent, name);
- enume->setAccess(access);
- enume->setLocation(location());
- }
-
- readToken();
-
- if (!matchEnumItem(parent, enume))
- return false;
-
- while (match(Tok_Comma)) {
- if (!matchEnumItem(parent, enume))
- return false;
- }
- return match(Tok_RightBrace) && match(Tok_Semicolon);
-}
-
-bool CppCodeParser::matchTypedefDecl(Aggregate *parent)
-{
- CodeChunk dataType;
- QString name;
-
- if (!match(Tok_typedef))
- return false;
- if (!matchDataType(&dataType, &name))
- return false;
- if (!match(Tok_Semicolon))
- return false;
-
- if (parent && !parent->findChildNode(name, Node::Typedef)) {
- TypedefNode* td = new TypedefNode(parent, name);
- td->setAccess(access);
- td->setLocation(location());
- }
- return true;
-}
-
-bool CppCodeParser::matchProperty(Aggregate *parent)
-{
- int expected_tok = Tok_LeftParen;
- if (match(Tok_Q_PRIVATE_PROPERTY)) {
- expected_tok = Tok_Comma;
- if (!skipTo(Tok_Comma))
- return false;
- }
- else if (!match(Tok_Q_PROPERTY) &&
- !match(Tok_Q_OVERRIDE) &&
- !match(Tok_QDOC_PROPERTY)) {
- return false;
- }
-
- if (!match(expected_tok))
- return false;
-
- QString name;
- CodeChunk dataType;
- if (!matchDataType(&dataType, &name))
- return false;
-
- PropertyNode *property = new PropertyNode(parent, name);
- property->setAccess(Node::Public);
- property->setLocation(location());
- property->setDataType(dataType.toString());
-
- while (tok != Tok_RightParen && tok != Tok_Eoi) {
- if (!match(Tok_Ident))
- return false;
- QString key = previousLexeme();
- QString value;
-
- // Keywords with no associated values
- if (key == "CONSTANT") {
- property->setConstant();
- continue;
- }
- else if (key == "FINAL") {
- property->setFinal();
- continue;
- }
-
- if (match(Tok_Ident) || match(Tok_Number)) {
- value = previousLexeme();
- }
- else if (match(Tok_LeftParen)) {
- int depth = 1;
- while (tok != Tok_Eoi) {
- if (tok == Tok_LeftParen) {
- readToken();
- ++depth;
- } else if (tok == Tok_RightParen) {
- readToken();
- if (--depth == 0)
- break;
- } else {
- readToken();
- }
- }
- value = "?";
- }
-
- if (key == "READ")
- qdb_->addPropertyFunction(property, value, PropertyNode::Getter);
- else if (key == "WRITE") {
- qdb_->addPropertyFunction(property, value, PropertyNode::Setter);
- property->setWritable(true);
- }
- else if (key == "STORED")
- property->setStored(value.toLower() == "true");
- else if (key == "DESIGNABLE") {
- QString v = value.toLower();
- if (v == "true")
- property->setDesignable(true);
- else if (v == "false")
- property->setDesignable(false);
- else {
- property->setDesignable(false);
- property->setRuntimeDesFunc(value);
- }
- }
- else if (key == "RESET")
- qdb_->addPropertyFunction(property, value, PropertyNode::Resetter);
- else if (key == "NOTIFY") {
- qdb_->addPropertyFunction(property, value, PropertyNode::Notifier);
- } else if (key == "REVISION") {
- int revision;
- bool ok;
- revision = value.toInt(&ok);
- if (ok)
- property->setRevision(revision);
- else
- location().warning(tr("Invalid revision number: %1").arg(value));
- } else if (key == "SCRIPTABLE") {
- QString v = value.toLower();
- if (v == "true")
- property->setScriptable(true);
- else if (v == "false")
- property->setScriptable(false);
- else {
- property->setScriptable(false);
- property->setRuntimeScrFunc(value);
- }
- }
- }
- match(Tok_RightParen);
- return true;
-}
-
-/*!
- Parse a C++ declaration.
- */
-bool CppCodeParser::matchDeclList(Aggregate *parent)
-{
- ExtraFuncData extra;
- QString templateStuff;
- int braceDepth0 = tokenizer->braceDepth();
- if (tok == Tok_RightBrace) // prevents failure on empty body
- braceDepth0++;
-
- while (tokenizer->braceDepth() >= braceDepth0 && tok != Tok_Eoi) {
- switch (tok) {
- case Tok_Colon:
- readToken();
- break;
- case Tok_class:
- case Tok_struct:
- case Tok_union:
- matchClassDecl(parent, templateStuff);
- break;
- case Tok_namespace:
- matchNamespaceDecl(parent);
- break;
- case Tok_using:
- matchUsingDecl(parent);
- break;
- case Tok_template:
- {
- CodeChunk dataType;
- readToken();
- matchTemplateAngles(&dataType);
- templateStuff = dataType.toString();
- }
- continue;
- case Tok_enum:
- matchEnumDecl(parent);
- break;
- case Tok_typedef:
- matchTypedefDecl(parent);
- break;
- case Tok_private:
- readToken();
- access = Node::Private;
- metaness_ = FunctionNode::Plain;
- break;
- case Tok_protected:
- readToken();
- access = Node::Protected;
- metaness_ = FunctionNode::Plain;
- break;
- case Tok_public:
- readToken();
- access = Node::Public;
- metaness_ = FunctionNode::Plain;
- break;
- case Tok_signals:
- case Tok_Q_SIGNALS:
- readToken();
- access = Node::Public;
- metaness_ = FunctionNode::Signal;
- break;
- case Tok_slots:
- case Tok_Q_SLOTS:
- readToken();
- metaness_ = FunctionNode::Slot;
- break;
- case Tok_Q_OBJECT:
- readToken();
- break;
- case Tok_Q_OVERRIDE:
- case Tok_Q_PROPERTY:
- case Tok_Q_PRIVATE_PROPERTY:
- case Tok_QDOC_PROPERTY:
- if (!matchProperty(parent)) {
- location().warning(tr("Failed to parse token %1 in property declaration").arg(lexeme()));
- skipTo(Tok_RightParen);
- match(Tok_RightParen);
- }
- break;
- case Tok_Q_DECLARE_SEQUENTIAL_ITERATOR:
- readToken();
- if (match(Tok_LeftParen) && match(Tok_Ident))
- sequentialIteratorClasses.insert(previousLexeme(), location().fileName());
- match(Tok_RightParen);
- break;
- case Tok_Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR:
- readToken();
- if (match(Tok_LeftParen) && match(Tok_Ident))
- mutableSequentialIteratorClasses.insert(previousLexeme(), location().fileName());
- match(Tok_RightParen);
- break;
- case Tok_Q_DECLARE_ASSOCIATIVE_ITERATOR:
- readToken();
- if (match(Tok_LeftParen) && match(Tok_Ident))
- associativeIteratorClasses.insert(previousLexeme(), location().fileName());
- match(Tok_RightParen);
- break;
- case Tok_Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR:
- readToken();
- if (match(Tok_LeftParen) && match(Tok_Ident))
- mutableAssociativeIteratorClasses.insert(previousLexeme(), location().fileName());
- match(Tok_RightParen);
- break;
- case Tok_Q_DECLARE_FLAGS:
- readToken();
- if (match(Tok_LeftParen) && match(Tok_Ident)) {
- QString flagsType = previousLexeme();
- if (match(Tok_Comma) && match(Tok_Ident)) {
- QString name = previousLexeme();
- TypedefNode *flagsNode = new TypedefNode(parent, flagsType);
- flagsNode->setAccess(access);
- flagsNode->setLocation(location());
- EnumNode* en = static_cast(parent->findChildNode(name, Node::Enum));
- if (en)
- en->setFlagsType(flagsNode);
- }
- }
- match(Tok_RightParen);
- break;
- case Tok_QT_MODULE:
- readToken();
- if (match(Tok_LeftParen) && match(Tok_Ident))
- physicalModuleName = previousLexeme();
- if (!physicalModuleName.startsWith("Qt"))
- physicalModuleName.prepend("Qt");
- match(Tok_RightParen);
- break;
- default:
- if (!matchFunctionDecl(parent, 0, 0, templateStuff, extra)) {
- while (tok != Tok_Eoi &&
- (tokenizer->braceDepth() > braceDepth0 ||
- (!match(Tok_Semicolon) &&
- tok != Tok_public && tok != Tok_protected &&
- tok != Tok_private))) {
- readToken();
- }
- }
- }
- templateStuff.clear();
- }
- return true;
-}
-
-/*!
- This is called by parseSourceFile() to do the actual parsing
- and tree building.
- */
-bool CppCodeParser::matchDocsAndStuff()
-{
- ExtraFuncData extra;
- const QSet& topicCommandsAllowed = topicCommands();
- const QSet& otherMetacommandsAllowed = otherMetaCommands();
- const QSet& metacommandsAllowed = topicCommandsAllowed + otherMetacommandsAllowed;
-
- while (tok != Tok_Eoi) {
- if (tok == Tok_Doc) {
- /*
- lexeme() returns an entire qdoc comment.
- */
- QString comment = lexeme();
- Location start_loc(location());
- readToken();
-
- Doc::trimCStyleComment(start_loc,comment);
- Location end_loc(location());
-
- /*
- Doc parses the comment.
- */
- Doc doc(start_loc,end_loc,comment,metacommandsAllowed, topicCommandsAllowed);
- QString topic;
- bool isQmlPropertyTopic = false;
- bool isJsPropertyTopic = false;
-
- const TopicList& topics = doc.topicsUsed();
- if (!topics.isEmpty()) {
- topic = topics[0].topic;
- if ((topic == COMMAND_QMLPROPERTY) ||
- (topic == COMMAND_QMLPROPERTYGROUP) ||
- (topic == COMMAND_QMLATTACHEDPROPERTY)) {
- isQmlPropertyTopic = true;
- }
- else if ((topic == COMMAND_JSPROPERTY) ||
- (topic == COMMAND_JSPROPERTYGROUP) ||
- (topic == COMMAND_JSATTACHEDPROPERTY)) {
- isJsPropertyTopic = true;
- }
- }
- NodeList nodes;
- DocList docs;
-
- if (topic.isEmpty()) {
- QStringList parentPath;
- FunctionNode *clone;
- FunctionNode *func = 0;
-
- if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) {
- func = qdb_->findFunctionNode(parentPath, clone);
- /*
- If the node was not found, then search for it in the
- open C++ namespaces. We don't expect this search to
- be necessary often. Nor do we expect it to succeed
- very often.
- */
- if (func == 0)
- func = qdb_->findNodeInOpenNamespace(parentPath, clone);
-
- if (func) {
- func->borrowParameterNames(clone);
- nodes.append(func);
- docs.append(doc);
- }
- delete clone;
- }
- else {
- doc.location().warning(tr("Cannot tie this documentation to anything"),
- tr("I found a /*! ... */ comment, but there was no "
- "topic command (e.g., '\\%1', '\\%2') in the "
- "comment and no function definition following "
- "the comment.")
- .arg(COMMAND_FN).arg(COMMAND_PAGE));
- }
- }
- else if (isQmlPropertyTopic || isJsPropertyTopic) {
- Doc nodeDoc = doc;
- processQmlProperties(nodeDoc, nodes, docs, isJsPropertyTopic);
- }
- else {
- ArgList args;
- const QSet& topicCommandsUsed = topicCommandsAllowed & doc.metaCommandsUsed();
- if (topicCommandsUsed.count() > 0) {
- topic = *topicCommandsUsed.constBegin();
- args = doc.metaCommandArgs(topic);
- }
- if (topicCommandsUsed.count() > 1) {
- QString topics;
- QSet::ConstIterator t = topicCommandsUsed.constBegin();
- while (t != topicCommandsUsed.constEnd()) {
- topics += " \\" + *t + QLatin1Char(',');
- ++t;
- }
- topics[topics.lastIndexOf(',')] = '.';
- int i = topics.lastIndexOf(',');
- topics[i] = ' ';
- topics.insert(i+1,"and");
- doc.location().warning(tr("Multiple topic commands found in comment: %1").arg(topics));
- }
- ArgList::ConstIterator a = args.constBegin();
- while (a != args.constEnd()) {
- Doc nodeDoc = doc;
- Node *node = processTopicCommand(nodeDoc,topic,*a);
- if (node != 0) {
- nodes.append(node);
- docs.append(nodeDoc);
- }
- ++a;
- }
- }
-
- NodeList::Iterator n = nodes.begin();
- QList::Iterator d = docs.begin();
- while (n != nodes.end()) {
- processOtherMetaCommands(*d, *n);
- (*n)->setDoc(*d);
- checkModuleInclusion(*n);
- if ((*n)->isAggregate() && ((Aggregate *)*n)->includes().isEmpty()) {
- Aggregate *m = static_cast(*n);
- while (m->parent() && m->physicalModuleName().isEmpty()) {
- m = m->parent();
- }
- if (m == *n)
- ((Aggregate *)*n)->addInclude((*n)->name());
- else
- ((Aggregate *)*n)->setIncludes(m->includes());
- }
- ++d;
- ++n;
- }
- }
- else if (tok == Tok_using) {
- matchUsingDecl(0);
- }
- else {
- QStringList parentPath;
- FunctionNode *clone;
- FunctionNode *node = 0;
-
- if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) {
- /*
- The location of the definition is more interesting
- than that of the declaration. People equipped with
- a sophisticated text editor can respond to warnings
- concerning undocumented functions very quickly.
-
- Signals are implemented in uninteresting files
- generated by moc.
- */
- node = qdb_->findFunctionNode(parentPath, clone);
- if (node != 0 && node->metaness() != FunctionNode::Signal)
- node->setLocation(clone->location());
- delete clone;
- }
- else {
- if (tok != Tok_Doc)
- readToken();
- }
- }
- }
- return true;
-}
-
-/*!
- This function uses a Tokenizer to parse the function \a signature
- in an attempt to match it to the signature of a child node of \a root.
- If a match is found, \a funcPtr is set to point to the matching node
- and true is returned.
- */
-bool CppCodeParser::makeFunctionNode(const QString& signature,
- QStringList* parentPathPtr,
- FunctionNode** funcPtr,
- ExtraFuncData& extra)
-{
- Tokenizer* outerTokenizer = tokenizer;
- int outerTok = tok;
-
- QByteArray latin1 = signature.toLatin1();
- Tokenizer stringTokenizer(location(), latin1);
- stringTokenizer.setParsingFnOrMacro(true);
- tokenizer = &stringTokenizer;
- readToken();
-
- inMacroCommand_ = extra.isMacro;
- bool ok = matchFunctionDecl(extra.root, parentPathPtr, funcPtr, QString(), extra);
- inMacroCommand_ = false;
- // potential memory leak with funcPtr
-
- tokenizer = outerTokenizer;
- tok = outerTok;
- return ok;
-}
-
-/*!
- This function uses a Tokenizer to parse the \a parameters of a
- function into the parameter vector \a {pvect}.
- */
-bool CppCodeParser::parseParameters(const QString& parameters,
- QVector& pvect,
- bool& isQPrivateSignal)
-{
- Tokenizer* outerTokenizer = tokenizer;
- int outerTok = tok;
-
- QByteArray latin1 = parameters.toLatin1();
- Tokenizer stringTokenizer(Location(), latin1);
- stringTokenizer.setParsingFnOrMacro(true);
- tokenizer = &stringTokenizer;
- readToken();
-
- inMacroCommand_ = false;
- do {
- if (!matchParameter(pvect, isQPrivateSignal))
- return false;
- } while (match(Tok_Comma));
-
- tokenizer = outerTokenizer;
- tok = outerTok;
- return true;
-}
-
-/*!
- Create a new FunctionNode for a QML method or signal, as
- specified by \a type, as a child of \a parent. \a sig is
- the complete signature, and if \a attached is true, the
- method or signal is "attached". \a qdoctag is the text of
- the \a type.
-
- \a parent is the QML class node. The QML module and QML
- type names have already been consumed to find \a parent.
- What remains in \a sig is the method signature. The method
- must be a child of \a parent.
- */
-FunctionNode* CppCodeParser::makeFunctionNode(const Doc& doc,
- const QString& sig,
- Aggregate* parent,
- Node::NodeType type,
- bool attached,
- QString qdoctag)
-{
- QStringList pp;
- FunctionNode* fn = 0;
- ExtraFuncData extra(parent, type, attached);
- if (!makeFunctionNode(sig, &pp, &fn, extra) && !makeFunctionNode("void " + sig, &pp, &fn, extra)) {
- doc.location().warning(tr("Invalid syntax in '\\%1'").arg(qdoctag));
- }
- return fn;
-}
-
-void CppCodeParser::parseQiteratorDotH(const Location &location, const QString &filePath)
-{
- QFile file(filePath);
- if (!file.open(QFile::ReadOnly))
- return;
-
- QString text = file.readAll();
- text.remove("\r");
- text.remove("\\\n");
- QStringList lines = text.split(QLatin1Char('\n'));
- lines = lines.filter("Q_DECLARE");
- lines.replaceInStrings(QRegExp("#define Q[A-Z_]*\\(C\\)"), QString());
-
- if (lines.size() == 4) {
- sequentialIteratorDefinition = lines[0];
- mutableSequentialIteratorDefinition = lines[1];
- associativeIteratorDefinition = lines[2];
- mutableAssociativeIteratorDefinition = lines[3];
- }
- else {
- location.warning(tr("The qiterator.h hack failed"));
- }
-}
-
-void CppCodeParser::instantiateIteratorMacro(const QString &container,
- const QString &includeFile,
- const QString ¯oDef)
-{
- QString resultingCode = macroDef;
- resultingCode.replace(QRegExp("\\bC\\b"), container);
- resultingCode.remove(QRegExp("\\s*##\\s*"));
-
- Location loc(includeFile); // hack to get the include file for free
- QByteArray latin1 = resultingCode.toLatin1();
- Tokenizer stringTokenizer(loc, latin1);
- tokenizer = &stringTokenizer;
- readToken();
- matchDeclList(QDocDatabase::qdocDB()->primaryTreeRoot());
-}
-
-void CppCodeParser::createExampleFileNodes(DocumentNode *dn)
-{
- QString examplePath = dn->name();
- QString proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pro";
- QString userFriendlyFilePath;
-
- QString fullPath = Config::findFile(dn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName,
- userFriendlyFilePath);
-
- if (fullPath.isEmpty()) {
- QString tmp = proFileName;
- proFileName = examplePath + QLatin1Char('/') + "qbuild.pro";
- userFriendlyFilePath.clear();
- fullPath = Config::findFile(dn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName,
- userFriendlyFilePath);
- if (fullPath.isEmpty()) {
- proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".qmlproject";
- userFriendlyFilePath.clear();
- fullPath = Config::findFile(dn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName,
- userFriendlyFilePath);
- if (fullPath.isEmpty()) {
- QString details = QLatin1String("Example directories: ") + exampleDirs.join(QLatin1Char(' '));
- if (!exampleFiles.isEmpty())
- details += QLatin1String(", example files: ") + exampleFiles.join(QLatin1Char(' '));
- dn->location().warning(tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName), details);
- dn->location().warning(tr(" EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath), details);
- return;
- }
- }
- }
-
- int sizeOfBoringPartOfName = fullPath.size() - proFileName.size();
- if (fullPath.startsWith("./"))
- sizeOfBoringPartOfName = sizeOfBoringPartOfName - 2;
- fullPath.truncate(fullPath.lastIndexOf('/'));
-
- QStringList exampleFiles = Config::getFilesHere(fullPath,exampleNameFilter);
- QString imagesPath = fullPath + "/images";
- QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter);
- if (!exampleFiles.isEmpty()) {
- // move main.cpp and to the end, if it exists
- QString mainCpp;
- QMutableStringListIterator i(exampleFiles);
- i.toBack();
- while (i.hasPrevious()) {
- QString fileName = i.previous();
- if (fileName.endsWith("/main.cpp")) {
- mainCpp = fileName;
- i.remove();
- }
- else if (fileName.contains("/qrc_") || fileName.contains("/moc_")
- || fileName.contains("/ui_"))
- i.remove();
- }
- if (!mainCpp.isEmpty())
- exampleFiles.append(mainCpp);
-
- // add any qmake Qt resource files and qmake project files
- exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro *.qmlproject qmldir");
- }
-
- foreach (const QString &exampleFile, exampleFiles) {
- new DocumentNode(dn,
- exampleFile.mid(sizeOfBoringPartOfName),
- Node::File,
- Node::NoPageType);
- }
- foreach (const QString &imageFile, imageFiles) {
- new DocumentNode(dn,
- imageFile.mid(sizeOfBoringPartOfName),
- Node::Image,
- Node::NoPageType);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h
deleted file mode 100644
index ec04482321..0000000000
--- a/src/tools/qdoc/cppcodeparser.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CPPCODEPARSER_H
-#define CPPCODEPARSER_H
-
-#include
-
-#include "codeparser.h"
-
-QT_BEGIN_NAMESPACE
-
-class ClassNode;
-class CodeChunk;
-class CppCodeParserPrivate;
-class FunctionNode;
-class Aggregate;
-class Tokenizer;
-
-class CppCodeParser : public CodeParser
-{
- Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser)
-
- struct ExtraFuncData {
- Aggregate* root; // Used as the parent.
- Node::NodeType type; // The node type: Function, etc.
- bool isAttached; // If true, the method is attached.
- bool isMacro; // If true, we are parsing a macro signature.
- ExtraFuncData() : root(0), type(Node::Function), isAttached(false), isMacro(false) { }
- ExtraFuncData(Aggregate* r, Node::NodeType t, bool a)
- : root(r), type(t), isAttached(a), isMacro(false) { }
- };
-
-public:
- CppCodeParser();
- ~CppCodeParser();
- static CppCodeParser* cppParser() { return cppParser_; }
-
- virtual void initializeParser(const Config& config) Q_DECL_OVERRIDE;
- virtual void terminateParser() Q_DECL_OVERRIDE;
- virtual QString language() Q_DECL_OVERRIDE;
- virtual QStringList headerFileNameFilter() Q_DECL_OVERRIDE;
- virtual QStringList sourceFileNameFilter() Q_DECL_OVERRIDE;
- virtual void parseHeaderFile(const Location& location, const QString& filePath) Q_DECL_OVERRIDE;
- virtual void parseSourceFile(const Location& location, const QString& filePath) Q_DECL_OVERRIDE;
- virtual void doneParsingHeaderFiles() Q_DECL_OVERRIDE;
- virtual void doneParsingSourceFiles() Q_DECL_OVERRIDE;
- bool parseParameters(const QString& parameters, QVector& pvect, bool& isQPrivateSignal);
-
-protected:
- const QSet& topicCommands();
- const QSet& otherMetaCommands();
- virtual Node* processTopicCommand(const Doc& doc,
- const QString& command,
- const ArgLocPair& arg);
- void processQmlProperties(const Doc& doc, NodeList& nodes, DocList& docs, bool jsProps);
- bool splitQmlPropertyGroupArg(const QString& arg,
- QString& module,
- QString& element,
- QString& name);
- bool splitQmlPropertyArg(const QString& arg,
- QString& type,
- QString& module,
- QString& element,
- QString& name);
- bool splitQmlMethodArg(const QString& arg,
- QString& type,
- QString& module,
- QString& element);
- virtual void processOtherMetaCommand(const Doc& doc,
- const QString& command,
- const ArgLocPair& argLocPair,
- Node *node);
- void processOtherMetaCommands(const Doc& doc, Node *node);
-
- protected:
- void reset();
- void readToken();
- const Location& location();
- QString previousLexeme();
- QString lexeme();
-
- private:
- bool match(int target);
- bool skipTo(int target);
- bool matchCompat();
- bool matchModuleQualifier(QString& name);
- bool matchTemplateAngles(CodeChunk *type = 0);
- bool matchTemplateHeader();
- bool matchDataType(CodeChunk *type, QString *var = 0);
- bool matchParameter(QVector& pvect, bool& isQPrivateSignal);
- bool matchFunctionDecl(Aggregate *parent,
- QStringList *parentPathPtr,
- FunctionNode **funcPtr,
- const QString &templateStuff,
- ExtraFuncData& extra);
- bool matchBaseSpecifier(ClassNode *classe, bool isClass);
- bool matchBaseList(ClassNode *classe, bool isClass);
- bool matchClassDecl(Aggregate *parent,
- const QString &templateStuff = QString());
- bool matchNamespaceDecl(Aggregate *parent);
- bool matchUsingDecl(Aggregate* parent);
- bool matchEnumItem(Aggregate *parent, EnumNode *enume);
- bool matchEnumDecl(Aggregate *parent);
- bool matchTypedefDecl(Aggregate *parent);
- bool matchProperty(Aggregate *parent);
- bool matchDeclList(Aggregate *parent);
- bool matchDocsAndStuff();
- bool makeFunctionNode(const QString &synopsis,
- QStringList *parentPathPtr,
- FunctionNode **funcPtr,
- ExtraFuncData& params);
- FunctionNode* makeFunctionNode(const Doc& doc,
- const QString& sig,
- Aggregate* parent,
- Node::NodeType type,
- bool attached,
- QString qdoctag);
- void parseQiteratorDotH(const Location &location, const QString &filePath);
- void instantiateIteratorMacro(const QString &container,
- const QString &includeFile,
- const QString ¯oDef);
- void createExampleFileNodes(DocumentNode *dn);
- int matchFunctionModifier();
-
- protected:
- QMap nodeTypeMap;
- Tokenizer *tokenizer;
- int tok;
- Node::Access access;
- FunctionNode::Metaness metaness_;
- QString physicalModuleName;
- QStringList lastPath_;
- QRegExp varComment;
- QRegExp sep;
-
- private:
- QString sequentialIteratorDefinition;
- QString mutableSequentialIteratorDefinition;
- QString associativeIteratorDefinition;
- QString mutableAssociativeIteratorDefinition;
- QMap sequentialIteratorClasses;
- QMap mutableSequentialIteratorClasses;
- QMap associativeIteratorClasses;
- QMap mutableAssociativeIteratorClasses;
-
- static QStringList exampleFiles;
- static QStringList exampleDirs;
- static CppCodeParser* cppParser_;
- QString exampleNameFilter;
- QString exampleImageFilter;
-};
-
-#define COMMAND_ABSTRACT Doc::alias("abstract")
-#define COMMAND_CLASS Doc::alias("class")
-#define COMMAND_CONTENTSPAGE Doc::alias("contentspage")
-#define COMMAND_DITAMAP Doc::alias("ditamap")
-#define COMMAND_ENUM Doc::alias("enum")
-#define COMMAND_EXAMPLE Doc::alias("example")
-#define COMMAND_EXTERNALPAGE Doc::alias("externalpage")
-#define COMMAND_FILE Doc::alias("file")
-#define COMMAND_FN Doc::alias("fn")
-#define COMMAND_GROUP Doc::alias("group")
-#define COMMAND_HEADERFILE Doc::alias("headerfile")
-#define COMMAND_INDEXPAGE Doc::alias("indexpage")
-#define COMMAND_INHEADERFILE Doc::alias("inheaderfile")
-#define COMMAND_MACRO Doc::alias("macro")
-#define COMMAND_MODULE Doc::alias("module")
-#define COMMAND_NAMESPACE Doc::alias("namespace")
-#define COMMAND_OVERLOAD Doc::alias("overload")
-#define COMMAND_NEXTPAGE Doc::alias("nextpage")
-#define COMMAND_PAGE Doc::alias("page")
-#define COMMAND_PREVIOUSPAGE Doc::alias("previouspage")
-#define COMMAND_PROPERTY Doc::alias("property")
-#define COMMAND_REIMP Doc::alias("reimp")
-#define COMMAND_RELATES Doc::alias("relates")
-#define COMMAND_STARTPAGE Doc::alias("startpage")
-#define COMMAND_TYPEDEF Doc::alias("typedef")
-#define COMMAND_VARIABLE Doc::alias("variable")
-#define COMMAND_QMLABSTRACT Doc::alias("qmlabstract")
-#define COMMAND_QMLTYPE Doc::alias("qmltype")
-#define COMMAND_QMLPROPERTY Doc::alias("qmlproperty")
-#define COMMAND_QMLPROPERTYGROUP Doc::alias("qmlpropertygroup")
-#define COMMAND_QMLATTACHEDPROPERTY Doc::alias("qmlattachedproperty")
-#define COMMAND_QMLINHERITS Doc::alias("inherits")
-#define COMMAND_QMLINSTANTIATES Doc::alias("instantiates")
-#define COMMAND_QMLSIGNAL Doc::alias("qmlsignal")
-#define COMMAND_QMLATTACHEDSIGNAL Doc::alias("qmlattachedsignal")
-#define COMMAND_QMLMETHOD Doc::alias("qmlmethod")
-#define COMMAND_QMLATTACHEDMETHOD Doc::alias("qmlattachedmethod")
-#define COMMAND_QMLDEFAULT Doc::alias("default")
-#define COMMAND_QMLREADONLY Doc::alias("readonly")
-#define COMMAND_QMLBASICTYPE Doc::alias("qmlbasictype")
-#define COMMAND_QMLMODULE Doc::alias("qmlmodule")
-#define COMMAND_AUDIENCE Doc::alias("audience")
-#define COMMAND_CATEGORY Doc::alias("category")
-#define COMMAND_PRODNAME Doc::alias("prodname")
-#define COMMAND_COMPONENT Doc::alias("component")
-#define COMMAND_AUTHOR Doc::alias("author")
-#define COMMAND_PUBLISHER Doc::alias("publisher")
-#define COMMAND_COPYRYEAR Doc::alias("copyryear")
-#define COMMAND_COPYRHOLDER Doc::alias("copyrholder")
-#define COMMAND_PERMISSIONS Doc::alias("permissions")
-#define COMMAND_LIFECYCLEVERSION Doc::alias("lifecycleversion")
-#define COMMAND_LIFECYCLEWSTATUS Doc::alias("lifecyclestatus")
-#define COMMAND_LICENSEYEAR Doc::alias("licenseyear")
-#define COMMAND_LICENSENAME Doc::alias("licensename")
-#define COMMAND_LICENSEDESCRIPTION Doc::alias("licensedescription")
-#define COMMAND_RELEASEDATE Doc::alias("releasedate")
-#define COMMAND_QTVARIABLE Doc::alias("qtvariable")
-// Some of these are not used currenmtly, but they are included now for completeness.
-#define COMMAND_JSTYPE Doc::alias("jstype")
-#define COMMAND_JSPROPERTY Doc::alias("jsproperty")
-#define COMMAND_JSPROPERTYGROUP Doc::alias("jspropertygroup")
-#define COMMAND_JSATTACHEDPROPERTY Doc::alias("jsattachedproperty")
-#define COMMAND_JSSIGNAL Doc::alias("jssignal")
-#define COMMAND_JSATTACHEDSIGNAL Doc::alias("jsattachedsignal")
-#define COMMAND_JSMETHOD Doc::alias("jsmethod")
-#define COMMAND_JSATTACHEDMETHOD Doc::alias("jsattachedmethod")
-#define COMMAND_JSBASICTYPE Doc::alias("jsbasictype")
-#define COMMAND_JSMODULE Doc::alias("jsmodule")
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/tools/qdoc/doc.cpp b/src/tools/qdoc/doc.cpp
deleted file mode 100644
index 4ed5894543..0000000000
--- a/src/tools/qdoc/doc.cpp
+++ /dev/null
@@ -1,3380 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "config.h"
-#include "doc.h"
-#include "codemarker.h"
-#include "editdistance.h"
-#include "openedlist.h"
-#include "quoter.h"
-#include "text.h"
-#include "atom.h"
-#include "tokenizer.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "generator.h"
-
-QT_BEGIN_NAMESPACE
-
-Q_GLOBAL_STATIC(QSet, null_Set_QString)
-Q_GLOBAL_STATIC(TopicList, nullTopicList)
-Q_GLOBAL_STATIC(QStringList, null_QStringList)
-Q_GLOBAL_STATIC(QList, null_QList_Text)
-Q_GLOBAL_STATIC(QStringMultiMap, null_QStringMultiMap)
-
-struct Macro
-{
- QString defaultDef;
- Location defaultDefLocation;
- QStringMap otherDefs;
- int numParams;
-};
-
-enum {
- CMD_A,
- CMD_ANNOTATEDLIST,
- CMD_B,
- CMD_BADCODE,
- CMD_BOLD,
- CMD_BR,
- CMD_BRIEF,
- CMD_C,
- CMD_CAPTION,
- CMD_CHAPTER,
- CMD_CODE,
- CMD_CODELINE,
- CMD_DIV,
- CMD_DOTS,
- CMD_E,
- CMD_ELSE,
- CMD_ENDCHAPTER,
- CMD_ENDCODE,
- CMD_ENDDIV,
- CMD_ENDFOOTNOTE,
- CMD_ENDIF,
- CMD_ENDLEGALESE,
- CMD_ENDLINK,
- CMD_ENDLIST,
- CMD_ENDMAPREF,
- CMD_ENDOMIT,
- CMD_ENDPART,
- CMD_ENDQUOTATION,
- CMD_ENDRAW,
- CMD_ENDSECTION1,
- CMD_ENDSECTION2,
- CMD_ENDSECTION3,
- CMD_ENDSECTION4,
- CMD_ENDSIDEBAR,
- CMD_ENDTABLE,
- CMD_ENDTOPICREF,
- CMD_FOOTNOTE,
- CMD_GENERATELIST,
- CMD_GRANULARITY,
- CMD_HEADER,
- CMD_HR,
- CMD_I,
- CMD_IF,
- CMD_IMAGE,
- CMD_IMPORTANT,
- CMD_INCLUDE,
- CMD_INLINEIMAGE,
- CMD_INDEX,
- CMD_INPUT,
- CMD_KEYWORD,
- CMD_L,
- CMD_LEGALESE,
- CMD_LI,
- CMD_LINK,
- CMD_LIST,
- CMD_MAPREF,
- CMD_META,
- CMD_NEWCODE,
- CMD_NOTE,
- CMD_O,
- CMD_OLDCODE,
- CMD_OMIT,
- CMD_OMITVALUE,
- CMD_OVERLOAD,
- CMD_PART,
- CMD_PRINTLINE,
- CMD_PRINTTO,
- CMD_PRINTUNTIL,
- CMD_QUOTATION,
- CMD_QUOTEFILE,
- CMD_QUOTEFROMFILE,
- CMD_QUOTEFUNCTION,
- CMD_RAW,
- CMD_ROW,
- CMD_SA,
- CMD_SECTION1,
- CMD_SECTION2,
- CMD_SECTION3,
- CMD_SECTION4,
- CMD_SIDEBAR,
- CMD_SINCELIST,
- CMD_SKIPLINE,
- CMD_SKIPTO,
- CMD_SKIPUNTIL,
- CMD_SNIPPET,
- CMD_SPAN,
- CMD_SUB,
- CMD_SUP,
- CMD_TABLE,
- CMD_TABLEOFCONTENTS,
- CMD_TARGET,
- CMD_TOPICREF,
- CMD_TT,
- CMD_UICONTROL,
- CMD_UNDERLINE,
- CMD_UNICODE,
- CMD_VALUE,
- CMD_WARNING,
- CMD_QML,
- CMD_ENDQML,
- CMD_CPP,
- CMD_ENDCPP,
- CMD_QMLTEXT,
- CMD_ENDQMLTEXT,
- CMD_CPPTEXT,
- CMD_ENDCPPTEXT,
- CMD_JS,
- CMD_ENDJS,
- NOT_A_CMD
-};
-
-static struct {
- const char *english;
- int no;
- QString *alias;
-} cmds[] = {
- { "a", CMD_A, 0 },
- { "annotatedlist", CMD_ANNOTATEDLIST, 0 },
- { "b", CMD_B, 0 },
- { "badcode", CMD_BADCODE, 0 },
- { "bold", CMD_BOLD, 0 },
- { "br", CMD_BR, 0 },
- { "brief", CMD_BRIEF, 0 },
- { "c", CMD_C, 0 },
- { "caption", CMD_CAPTION, 0 },
- { "chapter", CMD_CHAPTER, 0 },
- { "code", CMD_CODE, 0 },
- { "codeline", CMD_CODELINE, 0},
- { "div", CMD_DIV, 0 },
- { "dots", CMD_DOTS, 0 },
- { "e", CMD_E, 0 },
- { "else", CMD_ELSE, 0 },
- { "endchapter", CMD_ENDCHAPTER, 0 },
- { "endcode", CMD_ENDCODE, 0 },
- { "enddiv", CMD_ENDDIV, 0 },
- { "endfootnote", CMD_ENDFOOTNOTE, 0 },
- { "endif", CMD_ENDIF, 0 },
- { "endlegalese", CMD_ENDLEGALESE, 0 },
- { "endlink", CMD_ENDLINK, 0 },
- { "endlist", CMD_ENDLIST, 0 },
- { "endmapref", CMD_ENDMAPREF, 0 },
- { "endomit", CMD_ENDOMIT, 0 },
- { "endpart", CMD_ENDPART, 0 },
- { "endquotation", CMD_ENDQUOTATION, 0 },
- { "endraw", CMD_ENDRAW, 0 },
- { "endsection1", CMD_ENDSECTION1, 0 }, // ### don't document for now
- { "endsection2", CMD_ENDSECTION2, 0 }, // ### don't document for now
- { "endsection3", CMD_ENDSECTION3, 0 }, // ### don't document for now
- { "endsection4", CMD_ENDSECTION4, 0 }, // ### don't document for now
- { "endsidebar", CMD_ENDSIDEBAR, 0 },
- { "endtable", CMD_ENDTABLE, 0 },
- { "endtopicref", CMD_ENDTOPICREF, 0 },
- { "footnote", CMD_FOOTNOTE, 0 },
- { "generatelist", CMD_GENERATELIST, 0 },
- { "granularity", CMD_GRANULARITY, 0 }, // ### don't document for now
- { "header", CMD_HEADER, 0 },
- { "hr", CMD_HR, 0 },
- { "i", CMD_I, 0 },
- { "if", CMD_IF, 0 },
- { "image", CMD_IMAGE, 0 },
- { "important", CMD_IMPORTANT, 0 },
- { "include", CMD_INCLUDE, 0 },
- { "inlineimage", CMD_INLINEIMAGE, 0 },
- { "index", CMD_INDEX, 0 }, // ### don't document for now
- { "input", CMD_INPUT, 0 },
- { "keyword", CMD_KEYWORD, 0 },
- { "l", CMD_L, 0 },
- { "legalese", CMD_LEGALESE, 0 },
- { "li", CMD_LI, 0 },
- { "link", CMD_LINK, 0 },
- { "list", CMD_LIST, 0 },
- { "mapref", CMD_MAPREF, 0 },
- { "meta", CMD_META, 0 },
- { "newcode", CMD_NEWCODE, 0 },
- { "note", CMD_NOTE, 0 },
- { "o", CMD_O, 0 },
- { "oldcode", CMD_OLDCODE, 0 },
- { "omit", CMD_OMIT, 0 },
- { "omitvalue", CMD_OMITVALUE, 0 },
- { "overload", CMD_OVERLOAD, 0 },
- { "part", CMD_PART, 0 },
- { "printline", CMD_PRINTLINE, 0 },
- { "printto", CMD_PRINTTO, 0 },
- { "printuntil", CMD_PRINTUNTIL, 0 },
- { "quotation", CMD_QUOTATION, 0 },
- { "quotefile", CMD_QUOTEFILE, 0 },
- { "quotefromfile", CMD_QUOTEFROMFILE, 0 },
- { "quotefunction", CMD_QUOTEFUNCTION, 0 },
- { "raw", CMD_RAW, 0 },
- { "row", CMD_ROW, 0 },
- { "sa", CMD_SA, 0 },
- { "section1", CMD_SECTION1, 0 },
- { "section2", CMD_SECTION2, 0 },
- { "section3", CMD_SECTION3, 0 },
- { "section4", CMD_SECTION4, 0 },
- { "sidebar", CMD_SIDEBAR, 0 },
- { "sincelist", CMD_SINCELIST, 0 },
- { "skipline", CMD_SKIPLINE, 0 },
- { "skipto", CMD_SKIPTO, 0 },
- { "skipuntil", CMD_SKIPUNTIL, 0 },
- { "snippet", CMD_SNIPPET, 0 },
- { "span", CMD_SPAN, 0 },
- { "sub", CMD_SUB, 0 },
- { "sup", CMD_SUP, 0 },
- { "table", CMD_TABLE, 0 },
- { "tableofcontents", CMD_TABLEOFCONTENTS, 0 },
- { "target", CMD_TARGET, 0 },
- { "topicref", CMD_TOPICREF, 0 },
- { "tt", CMD_TT, 0 },
- { "uicontrol", CMD_UICONTROL, 0 },
- { "underline", CMD_UNDERLINE, 0 },
- { "unicode", CMD_UNICODE, 0 },
- { "value", CMD_VALUE, 0 },
- { "warning", CMD_WARNING, 0 },
- { "qml", CMD_QML, 0 },
- { "endqml", CMD_ENDQML, 0 },
- { "cpp", CMD_CPP, 0 },
- { "endcpp", CMD_ENDCPP, 0 },
- { "qmltext", CMD_QMLTEXT, 0 },
- { "endqmltext", CMD_ENDQMLTEXT, 0 },
- { "cpptext", CMD_CPPTEXT, 0 },
- { "endcpptext", CMD_ENDCPPTEXT, 0 },
- { "js", CMD_JS, 0 },
- { "endjs", CMD_ENDJS, 0 },
- { 0, 0, 0 }
-};
-
-typedef QHash QHash_QString_int;
-typedef QHash QHash_QString_Macro;
-
-Q_GLOBAL_STATIC(QStringMap, aliasMap)
-Q_GLOBAL_STATIC(QHash_QString_int, cmdHash)
-Q_GLOBAL_STATIC(QHash_QString_Macro, macroHash)
-
-class DocPrivateExtra
-{
-public:
- Doc::Sections granularity_;
- Doc::Sections section_; // ###
- QList tableOfContents_;
- QVector tableOfContentsLevels_;
- QList keywords_;
- QList