qdoc is moving back to qttools

Change-Id: Icb5abd32a1cbc3e8d876341c877e8d2a963c0e25
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-03-07 19:22:06 +01:00 committed by Simon Hausmann
parent a903ddd8dc
commit f343989852
125 changed files with 1 additions and 65530 deletions

View File

@ -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

View File

@ -1,87 +0,0 @@
* fix QWSPointerCalibrationData::devPoints and qwsServer
* Fix QMenu::addAction(QAction *) overload, "using" etc.
* fix space between two tables using <p></p>
* 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<QObject *>
* 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 <p>...</p> 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

View File

@ -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 <qregexp.h>
#include "atom.h"
#include "location.h"
#include "qdocdatabase.h"
#include <stdio.h>
#include <qdebug.h>
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

View File

@ -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 <qstringlist.h>
#include "node.h"
#include <qdebug.h>
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

View File

@ -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 <qregexp.h>
#include <qstringlist.h>
#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

View File

@ -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 <qstring.h>
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<QString, QString>
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

View File

@ -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 <qobjectdefs.h>
#include "codemarker.h"
#include "config.h"
#include "node.h"
#include <qdebug.h>
#include <stdio.h>
QT_BEGIN_NAMESPACE
QString CodeMarker::defaultLang;
QList<CodeMarker *> 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<CodeMarker *>::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<CodeMarker *>::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<CodeMarker *>::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<CodeMarker *>::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<CodeMarker *>::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<const Node *>(string.toUInt());
}
else {
return reinterpret_cast<const Node *>(string.toULongLong());
}
}
QString CodeMarker::stringForNode(const Node *node)
{
if (sizeof(const Node *) == sizeof(ulong)) {
return QString::number(reinterpret_cast<quintptr>(node));
}
else {
return QString::number(reinterpret_cast<qulonglong>(node));
}
}
static const QString samp = QLatin1String("&amp;");
static const QString slt = QLatin1String("&lt;");
static const QString sgt = QLatin1String("&gt;");
static const QString squot = QLatin1String("&quot;");
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("&amp;");
break;
case '<':
result += QLatin1String("&lt;");
break;
case '>':
result += QLatin1String("&gt;");
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<const FunctionNode *>(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<const FunctionNode *>(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<const TypedefNode*>(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<Aggregate *, int> 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<const FunctionNode*>(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<Section>& 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 = &sectionList[sectionList.size()-1];
for (int i=0; i<fs.classMapList_.size(); i++) {
ClassMap* classMap = fs.classMapList_[i];
ClassKeysNodes* ckn = new ClassKeysNodes;
ckn->first = 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; i<classKeysNodesList_.size(); i++) {
ClassKeysNodes* classKeysNodes = classKeysNodesList_[i];
classKeysNodesList_[i] = 0;
delete classKeysNodes;
}
}
}
/*!
The destructor must delete the QML class maps in the class
map list, if the class map list is not empty.
*/
FastSection::~FastSection()
{
if (!classMapList_.isEmpty()) {
for (int i=0; i<classMapList_.size(); i++) {
ClassMap* classMap = classMapList_[i];
classMapList_[i] = 0;
delete classMap;
}
}
}
static QString encode(const QString &string)
{
return string;
}
QStringList CodeMarker::macRefsForNode(Node *node)
{
QString result = QLatin1String("cpp/");
switch (node->type()) {
case Node::Class:
{
const ClassNode *classe = static_cast<const ClassNode *>(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<const FunctionNode *>(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<const PropertyNode*>(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<Section> CodeMarker::qmlSections(QmlTypeNode* , SynopsisStyle , Status )
{
return QList<Section>();
}
QT_END_NAMESPACE

View File

@ -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 <qpair.h>
#include "atom.h"
#include "node.h"
QT_BEGIN_NAMESPACE
class Config;
typedef QMultiMap<QString, Node*> MemberMap; // the string is the member signature
typedef QPair<const QmlTypeNode*, MemberMap> ClassMap; // the node is the QML type
typedef QList<ClassMap*> ClassMapList;
typedef QPair<QStringList, NodeList> KeysAndNodes;
typedef QPair<const QmlTypeNode*, KeysAndNodes> ClassKeysNodes;
typedef QList<ClassKeysNodes*> ClassKeysNodesList;
struct Section
{
QString name;
QString divClass;
QString singularMember;
QString pluralMember;
QStringList keys;
NodeList members;
NodeList reimpMembers;
QList<QPair<Aggregate *, int> > 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<QString, Node *> memberMap;
QMultiMap<QString, Node *> reimpMemberMap;
ClassMapList classMapList_;
QList<QPair<Aggregate *, int> > 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<Section> sections(const Aggregate *inner,
SynopsisStyle style,
Status status) = 0;
virtual QList<Section> 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<Section>& sectionList, const FastSection& fastSection, bool includeKeys = false);
private:
QString macName(const Node *parent, const QString &name = QString());
static QString defaultLang;
static QList<CodeMarker *> markers;
};
QT_END_NAMESPACE
#endif

View File

@ -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 <qdebug.h>
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 *> 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<CodeParser *>::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<CodeParser *>::ConstIterator p = parsers.constBegin();
while (p != parsers.constEnd()) {
(*p)->terminateParser();
++p;
}
}
CodeParser *CodeParser::parserForLanguage(const QString& language)
{
QList<CodeParser *>::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<CodeParser *>::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<CodeParser *>::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<QString> commonMetaCommands_;
/*!
Returns the set of strings representing the common metacommands.
*/
const QSet<QString>& 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<const QmlPropertyGroupNode*>(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<ExampleNode*>(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

View File

@ -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 <qset.h>
#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<QString>& 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<CodeParser *> parsers;
static bool showInternal_;
static bool singleExec_;
};
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@ -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 <qmap.h>
#include <qset.h>
#include <qstringlist.h>
#include <qstack.h>
#include <qpair.h>
#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<QString, ConfigVar> 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<QString> getOutputFormats() const;
QString getString(const QString& var) const;
QSet<QString> 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<QRegExp> getRegExpList(const QString& var) const;
QSet<QString> subVars(const QString& var) const;
void subVarsAndValues(const QString& var, ConfigVarMultimap& t) const;
QStringList getAllFiles(const QString& filesVar,
const QString& dirsVar,
const QSet<QString> &excludedDirs = QSet<QString>(),
const QSet<QString> &excludedFiles = QSet<QString>());
QString getIncludeFilePath(const QString& fileName) const;
QStringList getExampleQdocFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
QStringList getExampleImageFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
static QStringList loadMaster(const QString& fileName);
static QStringList getFilesHere(const QString& dir,
const QString& nameFilter,
const Location &location = Location(),
const QSet<QString> &excludedDirs = QSet<QString>(),
const QSet<QString> &excludedFiles = QSet<QString>());
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<QString> overrideOutputFormats;
private:
static bool isMetaKeyChar(QChar ch);
void load(Location location, const QString& fileName);
QString prog;
Location loc;
Location lastLocation_;
ConfigVarMultimap configVars_;
static QMap<QString, QString> uncompressedFiles;
static QMap<QString, QString> extractedDirs;
static int numInstances;
static QStack<QString> workingDirs_;
static QMap<QString, QStringList> 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

File diff suppressed because it is too large Load Diff

View File

@ -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<Section> sections(const Aggregate *innerNode,
SynopsisStyle style,
Status status) Q_DECL_OVERRIDE;
virtual QList<Section> 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

File diff suppressed because it is too large Load Diff

View File

@ -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 <qregexp.h>
#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<Parameter>& pvect, bool& isQPrivateSignal);
protected:
const QSet<QString>& topicCommands();
const QSet<QString>& 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<Parameter>& 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 &macroDef);
void createExampleFileNodes(DocumentNode *dn);
int matchFunctionModifier();
protected:
QMap<QString, Node::NodeType> 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<QString, QString> sequentialIteratorClasses;
QMap<QString, QString> mutableSequentialIteratorClasses;
QMap<QString, QString> associativeIteratorClasses;
QMap<QString, QString> 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

File diff suppressed because it is too large Load Diff

View File

@ -1,196 +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$
**
****************************************************************************/
/*
doc.h
*/
#ifndef DOC_H
#define DOC_H
#include <qset.h>
#include <qstring.h>
#include <qmap.h>
#include "location.h"
QT_BEGIN_NAMESPACE
class Atom;
class CodeMarker;
class Config;
class DocPrivate;
class Quoter;
class Text;
class DitaRef;
typedef QPair<QString, Location> ArgLocPair;
typedef QList<ArgLocPair> ArgList;
typedef QMap<QString, QString> QStringMap;
typedef QMultiMap<QString, QString> QStringMultiMap;
struct Topic
{
QString topic;
QString args;
Topic() { }
Topic(QString& t, const QString &a) : topic(t), args(a) { }
bool isEmpty() const { return topic.isEmpty(); }
void clear() { topic.clear(); args.clear(); }
};
typedef QList<Topic> TopicList;
typedef QList<DitaRef*> DitaRefList;
class DitaRef
{
public:
DitaRef() { }
virtual ~DitaRef() { }
const QString& navtitle() const { return navtitle_; }
const QString& href() const { return href_; }
void setNavtitle(const QString& t) { navtitle_ = t; }
void setHref(const QString& t) { href_ = t; }
virtual bool isMapRef() const = 0;
virtual const DitaRefList* subrefs() const { return 0; }
virtual void appendSubref(DitaRef* ) { }
private:
QString navtitle_;
QString href_;
};
class TopicRef : public DitaRef
{
public:
TopicRef() { }
~TopicRef();
virtual bool isMapRef() const Q_DECL_OVERRIDE { return false; }
virtual const DitaRefList* subrefs() const Q_DECL_OVERRIDE { return &subrefs_; }
virtual void appendSubref(DitaRef* t) Q_DECL_OVERRIDE { subrefs_.append(t); }
private:
DitaRefList subrefs_;
};
class MapRef : public DitaRef
{
public:
MapRef() { }
~MapRef() { }
virtual bool isMapRef() const Q_DECL_OVERRIDE { return true; }
};
class Doc
{
Q_DECLARE_TR_FUNCTIONS(QDoc::Doc)
public:
// the order is important
enum Sections {
NoSection = -2,
Part = -1,
Chapter = 1,
Section1 = 1,
Section2 = 2,
Section3 = 3,
Section4 = 4
};
Doc() : priv(0) {}
Doc(const Location& start_loc,
const Location& end_loc,
const QString& source,
const QSet<QString>& metaCommandSet,
const QSet<QString>& topics);
Doc(const Doc &doc);
~Doc();
Doc& operator=( const Doc& doc );
void renameParameters(const QStringList &oldNames,
const QStringList &newNames);
void simplifyEnumDoc();
void setBody(const Text &body);
const DitaRefList& ditamap() const;
const Location &location() const;
const Location& startLocation() const;
const Location& endLocation() const;
bool isEmpty() const;
const QString& source() const;
const Text& body() const;
Text briefText(bool inclusive = false) const;
Text trimmedBriefText(const QString &className) const;
Text legaleseText() const;
Sections granularity() const;
const QSet<QString> &parameterNames() const;
const QStringList &enumItemNames() const;
const QStringList &omitEnumItemNames() const;
const QSet<QString> &metaCommandsUsed() const;
const TopicList& topicsUsed() const;
ArgList metaCommandArgs(const QString& metaCommand) const;
const QList<Text> &alsoList() const;
bool hasTableOfContents() const;
bool hasKeywords() const;
bool hasTargets() const;
const QList<Atom *> &tableOfContents() const;
const QVector<int> &tableOfContentsLevels() const;
const QList<Atom *> &keywords() const;
const QList<Atom *> &targets() const;
const QStringMultiMap &metaTagMap() const;
static void initialize( const Config &config );
static void terminate();
static QString alias( const QString &english );
static void trimCStyleComment( Location& location, QString& str );
static CodeMarker *quoteFromFile(const Location &location,
Quoter &quoter,
const QString &fileName);
static QString canonicalTitle(const QString &title);
static const Config* config() { return config_; }
private:
void detach();
DocPrivate *priv;
static const Config* config_;
};
Q_DECLARE_TYPEINFO(Doc, Q_MOVABLE_TYPE);
typedef QList<Doc> DocList;
QT_END_NAMESPACE
#endif

View File

@ -1,72 +0,0 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QDoc
description = QDoc Manual
version = $QT_VERSION
sourcedirs = ..
exampledirs = .. \
../examples
imagedirs = ../images \
../../../../widgets/doc/images
# ../../../doc/src/templates/images
tagfile = ../html/qdoc.tags
examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css *.qdoc *.qdocinc *.sample"
qhp.projects = QDoc
qhp.QDoc.file = qdoc.qhp
qhp.QDoc.namespace = org.qt-project.qdoc.$QT_VERSION_TAG
qhp.QDoc.virtualFolder = qdoc
qhp.QDoc.indexTitle = QDoc Manual
qhp.QDoc.indexRoot =
qhp.QDoc.filterAttributes = qdoc qtrefdoc
qhp.QDoc.customFilters.QDoc.name = QDoc
qhp.QDoc.customFilters.QDoc.filterAttributes = qdoc
qhp.QDoc.subprojects = overviews
qhp.QDoc.subprojects.overviews.title = Overviews
qhp.QDoc.subprojects.overviews.indexTitle = QDoc Manual
qhp.QDoc.subprojects.overviews.selectors = fake:page,group,module
depends += \
activeqt \
qtassistant \
qtbluetooth \
qtconcurrent \
qtcontacts \
qtcore \
qtdbus \
qtdesigner \
qtdoc \
qthelp \
qtimageformats \
qtgui \
qtlocation \
qtlinguist \
qtmultimedia \
qtnetwork \
qtopengl \
qtorganizer \
qtprintsupport \
qtqml \
qtquick \
qtscript \
qtscripttools \
qtsensors \
qtsql \
qtsvg \
qttestlib \
qtuitools \
qtversit \
qtwidgets \
qtwebkit \
qtwebkitexamples \
qtxml \
qtxmlpatterns
navigation.landingpage = "QDoc Manual"

View File

@ -1,35 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page corefeatures.html
\title Core Features
\input examples/signalandslots.qdocinc
\input examples/objectmodel.qdocinc
\input examples/layoutmanagement.qdocinc
*/

View File

@ -1,135 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 1.0
/*!
\qmltype ProgressBar
\inqmlmodule UIComponents
\brief A component that shows the progress of an event
A ProgressBar shows the linear progress of an event as its \l value.
The range is specified using the \l {minimum} and the \l{maximum} values.
The ProgressBar component is part of the \l {UI Components} module.
This documentation is part of the \l{componentset}{UIComponents} example.
*/
Item {
id: progressbar
/*!
The minimum value of the ProgressBar range.
The \l value must not be less than this value.
*/
property int minimum: 0
/*!
The maximum value of the ProgressBar range.
The \l value must not be more than this value.
*/
property int maximum: 100
/*!
The value of the progress.
*/
property int value: 0
/*!
\qmlproperty color ProgressBar::color
The color of the ProgressBar's gradient. Must bind to a color type.
\omit
The "\qmlproperty <type> <property name>" is needed because
property alias need to have their types manually entered.
QDoc will not publish the documentation within omit and endomit.
\endomit
\sa secondColor
*/
property alias color: gradient1.color
/*!
\qmlproperty color ProgressBar::secondColor
The second color of the ProgressBar's gradient.
Must bind to a color type.
\omit
The "\qmlproperty <type> <property name>" is needed because
property alias need to have their types manually entered.
QDoc will not publish the documentation within omit and endomit.
\endomit
\sa color
*/
property alias secondColor: gradient2.color
width: 250; height: 23
clip: true
Rectangle {
id: highlight
/*!
An internal documentation comment. The widthDest property is not
a public API and therefore will not be exposed.
*/
property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6)
width: highlight.widthDest
Behavior on width { SmoothedAnimation { velocity: 1200 } }
anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 }
radius: 1
gradient: Gradient {
GradientStop { id: gradient1; position: 0.0 }
GradientStop { id: gradient2; position: 1.0 }
}
}
Text {
anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter }
color: "white"
font.bold: true
text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%'
}
}

View File

@ -1,142 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 1.0
/*!
\qmltype ToggleSwitch
\inqmlmodule UIComponents
\brief A component that can be turned on or off
A toggle switch has two states: an \c on and an \c off state. The \c off
state is when the \l on property is set to \c false.
The ToggleSwitch component is part of the \l {UI Components} module.
This documentation is part of the \l{componentset}{UIComponents} example.
*/
Item {
id: toggleswitch
width: background.width; height: background.height
/*!
Indicates the state of the switch. If \c false, then the switch is in
the \c off state.
\omit
The \qmlproperty <type> <propertyname> is not necessary as QDoc
will associate this property to the ToggleSwitch
QDoc will not publish the documentation within omit and endomit.
\endomit
*/
property bool on: false
/*!
A method to toggle the switch. If the switch is \c on, the toggling it
will turn it \c off. Toggling a switch in the \c off position will
turn it \c on.
*/
function toggle() {
if (toggleswitch.state == "on")
toggleswitch.state = "off";
else
toggleswitch.state = "on";
}
/*!
\internal
An internal function to synchronize the switch's internals. This
function is not for public access. The \internal command will
prevent QDoc from publishing this comment in the public API.
*/
function releaseSwitch() {
if (knob.x == 1) {
if (toggleswitch.state == "off") return;
}
if (knob.x == 78) {
if (toggleswitch.state == "on") return;
}
toggle();
}
Rectangle {
id: background
width: 130; height: 48
radius: 48
color: "lightsteelblue"
MouseArea { anchors.fill: parent; onClicked: toggle() }
}
Rectangle {
id: knob
width: 48; height: 48
radius: width
color: "lightblue"
MouseArea {
anchors.fill: parent
drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78
onClicked: toggle()
onReleased: releaseSwitch()
}
}
states: [
State {
name: "on"
PropertyChanges { target: knob; x: 78 }
PropertyChanges { target: toggleswitch; on: true }
},
State {
name: "off"
PropertyChanges { target: knob; x: 1 }
PropertyChanges { target: toggleswitch; on: false }
}
]
transitions: Transition {
NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad; duration: 200 }
}
}

View File

@ -1,183 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 1.0
/*!
\qmltype TabWidget
\inqmlmodule UIComponents
\brief A widget that places its children as tabs
A TabWidget places its children as tabs in a view. Selecting
a tab involves selecting the tab at the top.
The TabWidget component is part of the \l {UI Components} module.
This documentation is part of the \l{componentset}{UIComponents} example.
\section1 Adding Tabs
To add a tab, declare the tab as a child of the TabWidget.
\code
TabWidget {
id: tabwidget
Rectangle {
id: tab1
color: "red"
//... omitted
}
Rectangle {
id: tab2
color: "blue"
//... omitted
}
}
\endcode
*/
Item {
id: tabWidget
/*!
\internal
Setting the default property to stack.children means any child items
of the TabWidget are actually added to the 'stack' item's children.
See the \l{"Property Binding in QML"}
documentation for details on default properties.
This is an implementation detail, not meant for public knowledge. Putting
the \internal command at the beginning will cause QDoc to not publish this
documentation in the public API page.
Normally, a property alias needs to have a
"\qmlproperty <type> <propertyname>" to assign the alias a type.
*/
default property alias content: stack.children
/*!
The currently active tab in the TabWidget.
*/
property int current: 0
/*!
A sample \c{read-only} property.
A contrived property to demonstrate QDoc's ability to detect
read-only properties.
The signature is:
\code
readonly property int sampleReadOnlyProperty: 0
\endcode
Note that the property must be initialized to a value.
*/
readonly property int sampleReadOnlyProperty: 0
/*!
\internal
This handler is an implementation
detail. The \c{\internal} command will prevent QDoc from publishing this
documentation on the public API.
*/
onCurrentChanged: setOpacities()
Component.onCompleted: setOpacities()
/*!
\internal
An internal function to set the opacity.
The \internal command will prevent QDoc from publishing this
documentation on the public API.
*/
function setOpacities() {
for (var i = 0; i < stack.children.length; ++i) {
stack.children[i].opacity = (i == current ? 1 : 0)
}
}
Row {
id: header
Repeater {
model: stack.children.length
delegate: Rectangle {
width: tabWidget.width / stack.children.length; height: 36
Rectangle {
width: parent.width; height: 1
anchors { bottom: parent.bottom; bottomMargin: 1 }
color: "#acb2c2"
}
BorderImage {
anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
border { left: 7; right: 7 }
source: "tab.png"
visible: tabWidget.current == index
}
Text {
horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
anchors.fill: parent
text: stack.children[index].title
elide: Text.ElideRight
font.bold: tabWidget.current == index
}
MouseArea {
anchors.fill: parent
onClicked: tabWidget.current = index
}
}
}
}
Item {
id: stack
width: tabWidget.width
anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
}
}

View File

@ -1,5 +0,0 @@
SOURCES = componentset.pro \
ProgressBar.qml \
Switch.qml \
TabWidget.qml \
uicomponents.qdoc

View File

@ -1,38 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\qmlmodule UIComponents 1.0
\title UI Components
\brief Basic set of UI components
This is a listing of a list of UI components implemented by QML types. These
files are available for general import and they are based off the \l{Qt
Quick Code Samples}.
This module is part of the \l{componentset}{UIComponents} example.
*/

View File

@ -1,126 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
//![class]
/*!
\class QCache
\brief The QCache class is a template class that provides a cache.
\ingroup tools
\ingroup shared
\reentrant
QCache\<Key, T\> defines a cache that stores objects of type T
associated with keys of type Key. For example, here's the
definition of a cache that stores objects of type Employee
associated with an integer key:
\snippet code/doc_src_qcache.cpp 0
Here's how to insert an object in the cache:
\snippet code/doc_src_qcache.cpp 1
... detailed description ommitted
\sa QPixmapCache, QHash, QMap
*/
//![class]
//![function]
/*!
\fn QString &QString::remove(int position, int n)
Removes \a n characters from the string, starting at the given \a
position index, and returns a reference to the string.
If the specified \a position index is within the string, but \a
position + \a n is beyond the end of the string, the string is
truncated at the specified \a position.
\snippet qstring/main.cpp 37
\sa insert(), replace()
*/
QString &QString::remove(int pos, int len)
//! [function]
//! [return]
/*!
Returns \c true if a QScroller object was already created for \a target; \c false otherwise.
\sa scroller()
*/
bool QScroller::hasScroller(QObject *target)
//! [return]
//! [property]
/*!
\property QVariantAnimation::duration
\brief the duration of the animation
This property describes the duration in milliseconds of the
animation. The default duration is 250 milliseconds.
\sa QAbstractAnimation::duration()
*/
int QVariantAnimation::duration() const
//! [property]
//! [signals]
/*!
\fn QAbstractTransition::triggered()
This signal is emitted when the transition has been triggered (after
onTransition() has been called).
*/
//! [signals]
//! [enums]
/*!
\enum QSql::TableType
This enum type describes types of SQL tables.
\value Tables All the tables visible to the user.
\value SystemTables Internal tables used by the database.
\value Views All the views visible to the user.
\value AllTables All of the above.
*/
//! [enums]
//! [overloaded notifier]
/*!
\property QSpinBox::value
\brief the value of the spin box
setValue() will emit valueChanged() if the new value is different
from the old one. The \l{QSpinBox::}{value} property has a second notifier
signal which includes the spin box's prefix and suffix.
*/
//! [overloaded notifier]

View File

@ -1,97 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example componentset
\title QML Documentation Example
This example demonstrates one of the ways to document QML types.
In particular, there are sample types that are documented with QDoc
commands comments. There are documentation comments for the QML types
and their public interfaces. The types are grouped into a module, the
\l{UI Components} module.
The \l{componentset/uicomponents.qdoc.sample}{uicomponents.qdoc} file generates
the overview page for the \l{UI Components} module page.
The generated documentation is available in the \l{UI Components} module.
\section1 QML Class
The QML types use the \l{qmltype-command}{\\qmltype} to document the
type. In addition, they have the \l{inmodule-command}{\\inmodule}
command in order for QDoc to associate them to the \c UIComponents module.
QDoc uses the \l{brief-command}{\\brief} command to place a basic
description when listing the types.
\section1 Properties, Signals, Handlers, and Methods
The types have their properties, signals, handlers, and methods
defined in their respective QML files. QDoc associates the properties and
methods to the types, therefore, you only need to place the
documentation above the property, method, or signal.
To document the type of a \e {property alias}, you must use the
\l{qmlproperty-command}{\\qmlproperty} command to specify the data type.
\code
\qmlproperty int anAliasedProperty
An aliased property of type int.
\endcode
\section2 Internal Documentation
You may declare that a documentation is for internal use by placing the
\l{internal-command}{\\internal} command after the beginning QDoc comment
\begincomment. QDoc will prevent the internal documentation from appearing
in the public API.
If you wish to omit certain parts of the documentation, you may use the
\l{omit-command}{\\omit} and \l{omit-command}{\\endomit} command.
\section1 QML Types with C++ Implementation
This example only demonstrates the documentation for types in QML
files, but the regular \l{qml-documentation}{QML commands} may be placed
inside C++ classes to define the public API of the QML type.
*/
/*!
\qmlmodule UIComponents 1.0
\title UI Components
\brief Basic set of UI components
This is a listing of a list of UI components implemented by QML types. These
files are available for general import and they are based on the
\l{Qt Quick Examples and Tutorials}{Qt Quick Code Samples}.
This module is part of the \l{componentset}{UIComponents} example.
*/

View File

@ -1,13 +0,0 @@
\section1 Layout Classes
The Qt layout system provides a simple and powerful way of specifying
the layout of child widgets.
By specifying the logical layout once, you get the following benefits:
\list
\li Positioning of child widgets.
\li Sensible default sizes for windows.
\li Sensible minimum sizes for windows.
\li ...
\endlist

View File

@ -1,46 +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 <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}

View File

@ -1,243 +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 <QtWidgets>
#include "mainwindow.h"
#include "scribblearea.h"
//! [0]
MainWindow::MainWindow()
{
scribbleArea = new ScribbleArea;
setCentralWidget(scribbleArea);
createActions();
createMenus();
setWindowTitle(tr("Scribble"));
resize(500, 500);
}
//! [0]
//! [1]
void MainWindow::closeEvent(QCloseEvent *event)
//! [1] //! [2]
{
if (maybeSave()) {
event->accept();
} else {
event->ignore();
}
}
//! [2]
//! [3]
void MainWindow::open()
//! [3] //! [4]
{
if (maybeSave()) {
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open File"), QDir::currentPath());
if (!fileName.isEmpty())
scribbleArea->openImage(fileName);
}
}
//! [4]
//! [5]
void MainWindow::save()
//! [5] //! [6]
{
QAction *action = qobject_cast<QAction *>(sender());
QByteArray fileFormat = action->data().toByteArray();
saveFile(fileFormat);
}
//! [6]
//! [7]
void MainWindow::penColor()
//! [7] //! [8]
{
QColor newColor = QColorDialog::getColor(scribbleArea->penColor());
if (newColor.isValid())
scribbleArea->setPenColor(newColor);
}
//! [8]
//! [9]
void MainWindow::penWidth()
//! [9] //! [10]
{
bool ok;
int newWidth = QInputDialog::getInteger(this, tr("Scribble"),
tr("Select pen width:"),
scribbleArea->penWidth(),
1, 50, 1, &ok);
if (ok)
scribbleArea->setPenWidth(newWidth);
}
//! [10]
//! [11]
void MainWindow::about()
//! [11] //! [12]
{
QMessageBox::about(this, tr("About Scribble"),
tr("<p>The <b>Scribble</b> example shows how to use QMainWindow as the "
"base widget for an application, and how to reimplement some of "
"QWidget's event handlers to receive the events generated for "
"the application's widgets:</p><p> We reimplement the mouse event "
"handlers to facilitate drawing, the paint event handler to "
"update the application and the resize event handler to optimize "
"the application's appearance. In addition we reimplement the "
"close event handler to intercept the close events before "
"terminating the application.</p><p> The example also demonstrates "
"how to use QPainter to draw an image in real time, as well as "
"to repaint widgets.</p>"));
}
//! [12]
//! [13]
void MainWindow::createActions()
//! [13] //! [14]
{
openAct = new QAction(tr("&Open..."), this);
openAct->setShortcuts(QKeySequence::Open);
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
foreach (const QByteArray &format, QImageWriter::supportedImageFormats()) {
QString text = tr("%1...").arg(QString(format).toUpper());
QAction *action = new QAction(text, this);
action->setData(format);
connect(action, SIGNAL(triggered()), this, SLOT(save()));
saveAsActs.append(action);
}
printAct = new QAction(tr("&Print..."), this);
connect(printAct, SIGNAL(triggered()), scribbleArea, SLOT(print()));
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
penColorAct = new QAction(tr("&Pen Color..."), this);
connect(penColorAct, SIGNAL(triggered()), this, SLOT(penColor()));
penWidthAct = new QAction(tr("Pen &Width..."), this);
connect(penWidthAct, SIGNAL(triggered()), this, SLOT(penWidth()));
clearScreenAct = new QAction(tr("&Clear Screen"), this);
clearScreenAct->setShortcut(tr("Ctrl+L"));
connect(clearScreenAct, SIGNAL(triggered()),
scribbleArea, SLOT(clearImage()));
aboutAct = new QAction(tr("&About"), this);
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
aboutQtAct = new QAction(tr("About &Qt"), this);
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
//! [14]
//! [15]
void MainWindow::createMenus()
//! [15] //! [16]
{
saveAsMenu = new QMenu(tr("&Save As"), this);
foreach (QAction *action, saveAsActs)
saveAsMenu->addAction(action);
fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(openAct);
fileMenu->addMenu(saveAsMenu);
fileMenu->addAction(printAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);
optionMenu = new QMenu(tr("&Options"), this);
optionMenu->addAction(penColorAct);
optionMenu->addAction(penWidthAct);
optionMenu->addSeparator();
optionMenu->addAction(clearScreenAct);
helpMenu = new QMenu(tr("&Help"), this);
helpMenu->addAction(aboutAct);
helpMenu->addAction(aboutQtAct);
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(optionMenu);
menuBar()->addMenu(helpMenu);
}
//! [16]
//! [17]
bool MainWindow::maybeSave()
//! [17] //! [18]
{
if (scribbleArea->isModified()) {
QMessageBox::StandardButton ret;
ret = QMessageBox::warning(this, tr("Scribble"),
tr("The image has been modified.\n"
"Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard
| QMessageBox::Cancel);
if (ret == QMessageBox::Save) {
return saveFile("png");
} else if (ret == QMessageBox::Cancel) {
return false;
}
}
return true;
}
//! [18]
//! [19]
bool MainWindow::saveFile(const QByteArray &fileFormat)
//! [19] //! [20]
{
QString initialPath = QDir::currentPath() + "/untitled." + fileFormat;
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
initialPath,
tr("%1 Files (*.%2);;All Files (*)")
.arg(QString(fileFormat.toUpper()))
.arg(QString(fileFormat)));
if (fileName.isEmpty()) {
return false;
} else {
return scribbleArea->saveImage(fileName, fileFormat);
}
}
//! [20]

View File

@ -1,38 +0,0 @@
# QDoc is a tool that constantly evolves to suit our needs,
# and there are some compatibility issues between old and new
# practices. For that reason, any QDoc configuration file needs to
# include compat.qdocconf.
#include(compat.qdocconf)
# The outputdir variable specifies the directory
# where QDoc will put the generated documentation.
outputdir = html
# The headerdirs variable specifies the directories
# containing the header files associated
# with the .cpp source files used in the documentation.
headerdirs = .
# The sourcedirs variable specifies the
# directories containing the .cpp or .qdoc
# files used in the documentation.
#sourcedirs = .
# The exampledirs variable specifies the directories containing
# the source code of the example files.
exampledirs = .
# The imagedirs variable specifies the
# directories containing the images used in the documentation.
imagedirs = ./images

View File

@ -1,11 +0,0 @@
\section1 Qt Object Model
The standard C++ object model provides very efficient runtime support
for the object paradigm. But its static nature is inflexibile in
certain problem domains. Graphical user interface programming is a
domain that requires both runtime efficiency and a high level of
flexibility. Qt provides this, by combining the speed of C++ with the
flexibility of the Qt Object Model.
...

View File

@ -1,116 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
//![qmltype]
\qmltype TextEdit
\instantiates QQuickTextEdit
\inqmlmodule QtQuick
\ingroup qtquick-visual
\ingroup qtquick-input
\inherits Item
\brief Displays multiple lines of editable formatted text
The TextEdit item displays a block of editable, formatted text.
It can display both plain and rich text. For example:
\qml
TextEdit {
width: 240
text: "<b>Hello</b> <i>World!</i>"
font.family: "Helvetica"
font.pointSize: 20
color: "blue"
focus: true
}
\endqml
\image declarative-textedit.gif
... omitted detailed description
\sa Text, TextInput, {examples/quick/text/textselection}{Text Selection example}
//![qmltype]
//![function]
/*
\qmlmethod QtQuick2::ListModel::remove(int index, int count = 1)
Deletes the content at \a index from the model.
\sa clear()
*/
void QQuickListModel::remove(QQmlV8Function *args)
//! [function]
//! [return]
/*
Returns \c true if a QScroller object was already created for \a target; \c false otherwise.
\sa scroller()
*/
bool QScroller::hasScroller(QObject *target)
//! [return]
//! [property]
/*
\property QVariantAnimation::duration
\brief the duration of the animation
This property describes the duration in milliseconds of the
animation. The default duration is 250 milliseconds.
\sa QAbstractAnimation::duration()
*/
int QVariantAnimation::duration() const
//! [property]
//! [signals]
/*
This signal is emitted when the user clicks the button. A click is defined
as a press followed by a release. The corresponding handler is
\c onClicked.
*/
signal clicked()
//! [signals]
//! [enums]
/*!
\qmlproperty enumeration QtQuick2::Text::font.weight
Sets the font's weight.
The weight can be one of:
\list
\li Font.Light
\li Font.Normal - the default
\li Font.DemiBold
\li Font.Bold
\li Font.Black
\endlist
*/
//! [enums]

View File

@ -1,109 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
//! [qvector3d-class]
/*!
\class QVector3D
\brief The QVector3D class represents a vector or vertex in 3D space.
\since 4.6
\ingroup painting-3D
Vectors are one of the main building blocks of 3D representation and
drawing. They consist of three coordinates, traditionally called
x, y, and z.
The QVector3D class can also be used to represent vertices in 3D space.
We therefore do not need to provide a separate vertex class.
\b{Note:} By design values in the QVector3D instance are stored as \c float.
This means that on platforms where the \c qreal arguments to QVector3D
functions are represented by \c double values, it is possible to
lose precision.
\sa QVector2D, QVector4D, QQuaternion
*/
//! [qvector3d-class]
//! [qvector3d-function]
/*!
\fn QVector3D::QVector3D(const QPoint& point)
Constructs a vector with x and y coordinates from a 2D \a point, and a
z coordinate of 0.
*/
//! [qvector3d-function]
//! [sample-page]
/*!
\page generic-guide.html
\title Generic QDoc Guide
\nextpage Creating QDoc Configuration Files
There are three essential materials for generating documentation with qdoc:
\list
\li \c qdoc binary
\li \c qdocconf configuration files
\li \c Documentation in \c C++, \c QML, and \c .qdoc files
\endlist
*/
//! [sample-page]
//! [sample-faq]
/*!
\page altruism-faq.html faq
\title Altruism Frequently Asked Questions
\brief All the questions about altruism, answered.
...
*/
//! [sample-faq]
//! [sample-example]
/*!
\title UI Components: Tab Widget Example
\example declarative/ui-components/tabwidget
This example shows how to create a tab widget. It also demonstrates how
\l {Property aliases}{property aliases} and
\l {Introduction to the QML Language#Default Properties}{default properties} can be used to collect and
assemble the child items declared within an \l Item.
\image qml-tabwidget-example.png
*/
//! [sample-example]
//! [sample-overview]
/*!
\page overview-qt-technology.html overview
\title Overview of a Qt Technology
\brief provides a technology never seen before.
*/
//! [sample-overview]

View File

@ -1,9 +0,0 @@
\section1 Signals and Slots
Signals and slots are used for communication between objects. The signals and
slots mechanism is a central feature of Qt and probably the part that differs
most from the features provided by other frameworks.
\section2 Introduction
In GUI programming, when we ...

View File

@ -1,67 +0,0 @@
/*!
\page basicqt.html
\contentspage {Basic Qt} {Contents}
\nextpage Getting Started
\indexpage Index
\startpage Basic Qt
\title Basic Qt
The Qt toolkit is a C++ class library and a set of tools for
building multiplatform GUI programs using a "write once,
compile anywhere approach".
Table of contents:
\list
\li \l {Getting Started}
\li \l {Creating Dialogs}
\li \l {Creating Main Windows}
\endlist
*/
/*!
\page gettingstarted.html
\previouspage Basic Qt
\contentspage {Basic Qt} {Contents}
\nextpage Creating Dialogs
\indexpage Index
\startpage Basic Qt
\title Getting Started
This chapter shows how to combine basic C++ with the
functionality provided by Qt to create a few small graphical
interface (GUI) applications.
*/
/ *!
\page creatingdialogs.html
\previouspage Getting Started
\contentspage {Basic Qt} {Contents}
\indexpage Index
\startpage Basic Qt
\title Creating Dialogs
This chapter will teach you how to create dialog boxes using Qt.
*/
/*!
\page index.html
\indexpage Index
\startpage Basic Qt
\title Index
\list
\li \l {Basic Qt}
\li \l {Creating Dialogs}
\li \l {Getting Started}
\endlist
*/

View File

@ -1,12 +0,0 @@
alias.include = input
macro.0 = "\\\\0"
macro.b = "\\\\b"
macro.n = "\\\\n"
macro.r = "\\\\r"
macro.img = "\\image"
macro.endquote = "\\endquotation"
macro.relatesto = "\\relates"
spurious = "Missing comma in .*" \
"Missing pattern .*"

View File

@ -1,49 +0,0 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtGui
description = Qt GUI Reference Documentation
version = $QT_VERSION
examplesinstallpath = qtbase/gui
qhp.projects = QtGui
qhp.QtGui.file = qtgui.qhp
qhp.QtGui.namespace = org.qt-project.qtgui.$QT_VERSION_TAG
qhp.QtGui.virtualFolder = qtgui
qhp.QtGui.indexTitle = Qt GUI
qhp.QtGui.indexRoot =
qhp.QtGui.filterAttributes = qtgui $QT_VERSION qtrefdoc
qhp.QtGui.customFilters.Qt.name = Qtgui $QT_VERSION
qhp.QtGui.customFilters.Qt.filterAttributes = qtgui $QT_VERSION
qhp.QtGui.subprojects = classes
qhp.QtGui.subprojects.classes.title = C++ Classes
qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes
qhp.QtGui.subprojects.classes.selectors = class fake:headerfile
qhp.QtGui.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtgui/qtgui.tags
depends += \
qtcore \
qtnetwork \
qtopengl \
qtsvg \
qtqml \
qtquick \
qtwidgets \
qtdoc
headerdirs += ..
sourcedirs += .. \
../../../examples/gui/doc/src
exampledirs += ../../../examples/gui \
snippets
imagedirs += images \
../../../examples/gui/doc/images \
../../../doc/src/images \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -1,109 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page 28-qdoc-qa-pages.html
\previouspage Generating DITA XML Output
\contentspage QDoc Manual
\nextpage QDoc Manual
\title QA Pages
qdoc can generate some extra HTML pages that can be useful for
debugging qdoc documentation. These \e QA pages make it easier for
those who write documentation to find links that either go to the
wrong targets or don't go anywhere at all.
\section2 Generating the QA Pages
Add \c {-write-qa-pages} to the command line to tell qdoc to
generate the QA pages. If this option is not provided, the QA
pages will not be generated, and previolusly generated QA pages
will be deleted.
\section2 Finding the Module's Main QA Page
The main QA page for a module is not linked into the module's
generated documentation, but it is located in the same output
directory. To find the top-level QA page for module \e {xxx}, set
your browser to the qdoc output directory for module \e {xxx}.
Several files whose names begin with \e {aaa} appear at the top of
the list. These are the QA pages for module \e{xxx}. The file
names begin with \e {aaa} to ensure that they are easy to find at
the top of the directory.
For module \e{xxx}, find the file \e{aaa-xxx-qa-page.html}. This
is the top-level QA page for module \e{xxx}. Load that file into
the browser. The top-level QA page shows a table that contains
links to several QA sub-pages.
For example, the main QA page for QtCore is \c{aaa-qtcore-qa-page.html}.
This was the table for QtCore at one point:
\image qa-table.png
Each table entry shows the number of links from QtCore to some
other module, except for the last entry, which shows the number of
broken links in QtCore. Click the \b qtquick entry to load the QA
subpage showing the links from QtCore to QtQuick.
\section2 Links To Links Page
Clicking the \b qtquick table entry on the main QA page for QtCore
loads the QA subpage showing a table containing all the links from
QtCore to QtQuick. The table contains all the links constructed
with the \l {l-command} {\\l command}, as well as the autolinks.
\image links-to-links.png
At the time this table was generated, there were six links from
QtCore to QtQuick. The first column of each table entry contains
a link to some link in QtCore. The link text as it appears in
QtCore is shown. The second and third columns contain the source
file name and line number for where qdoc saw the link in a qdoc
comment.
\note The line number will normally refer to the first line of the
comment where qdoc saw the link.
Clicking on a link in the table takes you to that link in the
documentation. There the link will be marked with three red
asterisks. For example, clicking on the link in the fifth table
entry takes you here:
\image link-to-qquickitem.png
The link is marked with three red asterisks. Now you can click on
the actual link to check that it goes to the correct place. In
this case, the link should go to the reference page for the
QQuickItem class. You can check each link in the table this
way. If you find a link that goes to the wrong place, use the
source file name and line number to find the link, and fix the
problem using the square bracket notation for the \l {l-command}
{\\l command}.
*/

View File

@ -1,632 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qdoc-guide.html
\title Getting Started with QDoc
\nextpage Creating QDoc Configuration Files
Qt uses QDoc to generate its documentation set into HTML and DITA XML
formats. QDoc uses a set of configuration files to generate documentation
from QDoc comments. The comments have types called
\l{writing-topic-commands}{topics} that determine whether a comment is a
class documentation or a property documentation. A comment may also have
\l{writing-markup}{mark up} to enhance the layout and formatting of the
final output.
There are three essential materials for generating documentation with qdoc:
\list
\li \c QDoc binary
\li \c qdocconf configuration files
\li \c Documentation in \c C++, \c QML, and \c .qdoc files
\endlist
This section intends to cover the basic necessities for creating a
documentation set. Additionally, the guide presents special considerations
and options to documenting non-C++ API documentation as well as QML
documentation. Finally, the guide will provide a sample project
documentation and an example of a QML type documentation.
For specific QDoc information, consult the
\l{QDoc Manual}.
\section1 Chapters
\list 1
\li \l{Creating QDoc Configuration Files}
\li \l{Writing Documentation}
\li \l{Categories of Documentation}
\list
\li \l{C++ Documentation Style}
\li \l{QML Documentation Style}
\endlist
\li \l{QML Documentation Example}
\endlist
*/
/*!
\page qdoc-guide-conf.html
\title Creating QDoc Configuration Files
\previouspage Getting Started with QDoc
\nextpage Writing Documentation
To generate documentation, QDoc uses configuration files, with the
\c qdocconf extension, to store configuration settings.
The \l{The QDoc Configuration File} article covers the various configuration
variables in greater detail.
\section1 QDoc Configuration Files
QDoc's configuration settings can reside in a single \e qdocconf file, but
can also be in other qdocconf files. The \c {include(<filepath>)} command
allows configuration files to include other configuration files.
QDoc has two outputs, HTML documentation and documentation in DITA XML
format. The main distinction between the two outputs is that HTML
documentation needs to have its HTML styling information in the
configuration files. DITA XML documentation does not, and a separate process
can style the documentation in DITA at a later time. DITA XML is therefore
more flexible in allowing different styles to apply to the same information.
To run qdoc, the project configuration file is supplied as an argument.
\code
qdoc project.qdocconf
\endcode
The project configuration contains information that qdoc uses to create the
documentation.
\section2 Project Information
QDoc uses the \c project information to generate the documentation.
\code
project = QDoc Project
description = Sample QDoc project
\endcode
\target qdoc-input-output-dir
\section2 Input and Output Directories
Specifying the path to the source directories allow QDoc to find sources and
generate documentation.
\badcode
sourcedirs = <path to source code>
exampledirs = <path to examples directory>
imagedirs = <path to image directory>
sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml"
examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng"
\endcode
QDoc will process headers and sources from the ones specified in the
\c fileextensions variable.
Likewise, QDoc needs the path to the output directory. The \c outputformats
variable determines the type of documentation. These variables should be
in separate configuration files to modularize the documentation build.
\badcode
outputdir = $SAMPLE_PROJECT/doc/html
outputformats = HTML
\endcode
QDoc can resolve the paths relative to the qdocconf file as well as
environment variables.
\note During each QDoc run, the output directory is deleted.
\section2 Extra Files
QDoc will output generated documentation into the directory specified in
the \l{Input and Output Directories}{output} directory. It is also possible
to specify extra files that QDoc should export.
\badcode
HTML.extraimages = extraImage.png \
extraImage2.png
\endcode
The \c extraImage.png and the \c extraImage2.png files will be copied to the
HTML output directory.
\section2 Qt Help Framework Configuration
QDoc will also export a \e {Qt Help Project} file, in a \c qhp file.
The qhp file is then used by the \c qhelpgenerator to package the
documentation into a \c qch file. Qt Creator and Qt Assistant reads the qch
file to display the documentation.
The \l {Creating Help Project Files} article covers the configuration
options.
\section2 HTML Configuration
QDoc has an HTML generator that will export a set of documentation into
HTML files using various configuration settings. QDoc will place the
generated documentation into the directory specified by the \c outputdir
variable.
\badcode
outputformats = HTML
outputdir = <path to output directory>
\endcode
QDoc needs to know where the styles and templates for generating HTML
are located. Typically, the templates directory contains a \c scripts,
\c images, and a \c style directory, containing scripts and CSS files.
\badcode
HTML.templatedir = <path to templates>
\endcode
The main configuration variables are:
\badcode
HTML.postheader
HTML.postpostheader
HTML.postheader
HTML.footer
HTML.headerstyles
HTML.stylesheets = style.css \
style1.css
HTML.scripts = script.js
\endcode
The \c{HTML.headerstyles} variable inserts the style information into the
HTML file and the \c{HTML.stylesheets} specifies which files QDoc should
copy into the output directory. As well, QDoc will embed the string
in the \c postheader, \c footer, and related variables into each HTML file.
The \l {HTML Specific Configuration Variables} article outlines the usage
of each variable.
\section2 DITA XML Configuration
DITA XML output is enabled using the \c outputformats variable. Unlike HTML
documentation, QDoc does not need HTML style templates for generating
documentation in DITA XML format.
\badcode
outputformats = DITAXML
outputdir
\endcode
\section2 Qt Index Reference
Documentation projects can link to Qt APIs and other articles by specifying
the path to the \c qt.index file. When qdoc generates the Qt Reference
Documentation, it will also generate an index file, containing the URLs to
the articles. Other projects can use the links in the index file so that
they can link to other articles and API documentation within Qt.
\badcode
indexes = $QT_INSTALL_DOCS/html/qt.index $OTHER_PROJECT/html/qt.index
\endcode
It is possible to specify multiple index files from several projects.
\section1 Macros and Other Configurations
Macros for substituting HTML characters exist and are helpful for generating
specific HTML-valid characters.
\badcode
macro.pi.HTML = "&Pi;"
\endcode
The snippet code will replace any instances of \c{\\pi} with \c &Pi; in the
HTML file, which will appear as the Greek \pi symbol when viewed in
browsers.
\section2 QML Additions
QDoc is able to parse QML files for QDoc comments. QDoc will parse files
with the QML extension, \c{.qml}, if the extension type is included in the
\l{Input and Output Directories}{fileextensions} variable.
Also, the generated HTML files can have a prefix and a suffix following the
QML module name, specified in the QDoc configuration file.
\badcode
outputprefixes = QML
outputprefixes.QML = uicomponents-
outputsuffixes = QML
outputsuffixes.QML = -tp
\endcode
\b {See also}: \l {outputprefixes-variable}{outputprefixes},
\l {outputsuffixes-variable}{outputsuffixes}.
*/
/*!
\page qdoc-guide-writing.html
\title Writing Documentation
\previouspage Creating QDoc Configuration Files
\nextpage Categories of Documentation
\section1 QDoc Comments
Documentation is contained within qdoc \e comments, delimited by
\beginqdoc and \endqdoc comments. Note that these are valid comments
in C++, QML, and JavaScript.
QDoc will parse C++ and QML files to look for qdoc comments. To explicitly
omit a certain file type, omit it from the
\l{Input and Output Directories}{configuration} file.
\section1 QDoc Commands
QDoc uses \e commands to retrieve information about the documentation. \c
Topic commands determine the type of documentation element, the \c context
commands provide hints and information about a topic, and \c markup commands
provide information on how QDoc should format a piece of documentation.
\target writing-topic-commands
\section2 QDoc Topics
Each qdoc comment must have a \e topic type. A topic distinguishes it from
other topics. To specify a topic type, use one of the several
\l{Topic Commands}{topic commands}.
QDoc will collect similar topics and create a page for each one. For
example, all the enumerations, properties, functions, and class description
of a particular C++ class will reside in one page. A generic page is
specified using the \l{page-command}{\\page} command and the filename is the
argument.
Example of topic commands:
\list
\li \l{enum-command}{\\enum} - for enumeration documentation
\li \l{class-command}{\\class} - for C++ class documentation
\li \l{qmltype-command}{\\qmltype} - for QML type documentation
\li \l{page-command}{\\page} - for creating a page.
\endlist
The \l{page-command}{\\page} command is for creating articles that are not
part of source documentation. The command can also accept two arguments: the
file name of the article and the documentation type. The possible types are:
\list
\li \c howto
\li \c overview
\li \c tutorial
\li \c faq
\li \c article - \e default when there is no type
\endlist
\snippet examples/samples.qdocinc sample-faq
The \l{Topic Commands} page has information on all of the available topic
commands.
\target writing-context
\section2 Topic Contexts
Context commands give QDoc a hint about the \e context of the topic. For
example, if a C++ function is obsolete, then it should be marked obsolete
with the \l{obsolete-command}{\\obsolete} command. Likewise,
\l{nextpage-command}{page navigation} and \l{title-command}{page title} 
give extra page information to QDoc.
QDoc will create additional links or pages for these contexts. For example,
a group is created using the \l{group-command}{\\group} command and the
members have the \l{ingroup-command}{\\ingroup} command. The group name is
supplied as an argument.
The \l{Context Commands} page has a listing of all the available context
commands.
\target writing-markup
\section2 Documentation Markup
QDoc can do \e markup of text similar to other markup or
documentation tools. QDoc can mark a section of text in \b{bold},
when the text is marked up with the \l{b-command}{\\b} command.
\code
\b{This} text will be in \b{bold}.
\endcode
The \l{Markup Commands} page has a full listing of the available markup
commands.
\section1 Anatomy of Documentation
Essentially, for QDoc to create a page, there must be some essential
ingredients present.
\list
\li Assign a topic to a QDoc comment - A comment could be a page, a
property documentation, a class documentation, or any of the available
\l{Topic Commands}{topic commands}.
\li Give the topic a context - QDoc can associate certain topics to other
pages such as associating obsolete functions when the documentation is
marked with \l{obsolete-command}{\\obsolete}.
\li Mark sections of the document with
\l{Markup Commands}{markup commands} - QDoc can create layouts and
format the documentation for the documentation.
\endlist
In Qt, the \l{QVector3D} class was documented with the following QDoc
comment:
\snippet examples/samples.qdocinc qvector3d-class
It has a constructor, \l{QVector3D::QVector3D()}, which was documented with
the following QDoc comment:
\snippet examples/samples.qdocinc qvector3d-function
The different comments may reside in different files and QDoc will collect
them depending on their topic and their context. The resulting documentation
from the snippets are generated into the \l{QVector3D} class documentation.
Note that if the documentation immediately precedes the function or class
in the source code, then it does not need to have a topic. QDoc will assume
that the documentation above the code is the documentation for that code.
An article is created using \l{page-command}{\\page} command. The first
argument is the HTML file that QDoc will create. The topic is supplemented
with context commands, the \l{title-command}{\\title} and
\l{nextpage-command}{\\nextpage} commands. There are several other
QDoc commands such as the \l{list-command}{\\list} command.
\snippet examples/samples.qdocinc sample-page
The section on \l{QDoc Topics}{topic commands} gives an overview on several
other topic types.
*/
/*!
\page qdoc-categories.html
\title Categories of Documentation
\previouspage Writing Documentation
\nextpage QML Documentation Example
\brief Describes the different types such as How-To's, Tutorials, Overviews,
Examples, and Class Documentation.
There are several types of predefined documentation \e categories or
\e types:
\list
\li How-To's
\li Tutorial
\li Overview
\li Article
\li FAQ (Frequently Asked Questions)
\li C++ API Documentation
\li QML Type Documentation
\li Code Example
\endlist
QDoc has the ability to format a page depending on the type. Further,
stylesheets can provide additional control on the display of each category.
\section1 API Documentation
QDoc excels in the creation of API documentation given a set of source code
and documentation in QDoc comments. Specifically, QDoc is aware of Qt's
architecture and can validate the existence of Qt C++ class, function, or
property documentation. QDoc gives warnings and errors if it cannot
associate a documentation with a code entity or if a code entity does not
have documentation.
In general, every Qt code entity such as properties, classes, methods,
signals, and enumerations have a corresponding
\l{qdoc-topics}{topic command}. QDoc will associate the documentation to the
source using C++ naming rules.
QDoc will parse the header files (typically \c .h files) to build a tree of
the class structures. Then QDoc will parse the source files and
documentation files to attach documentation to the class structure.
Afterwards, QDoc will generate a page for the class.
\note QDoc uses the header files to inform itself about the class and will
not properly process QDoc comments in header files.
\section2 Language Styles
To produce quality API documentation, the Qt API references follow a
particular language guidelines. While the contents of this page demonstrates
how to create API documentation, the style guidelines demonstrate how
the reference materials follow a consistent use of language.
\list
\li \l{C++ Documentation Style}
\li \l{QML Documentation Style}
\endlist
\keyword qml-documentation
\section2 Documenting QML Types
In the world of \l{Qt Quick}{QML}, there are additional entities we need to
document such as QML signals, attached properties, and QML methods.
Internally, they use Qt technologies, however, QML API documentation
requires different layout and naming conventions from the Qt C++ API
documentation.
A list of QML related QDoc commands:
\list
\li \l{qmlattachedproperty-command}{\\qmlattachedproperty}
\li \l{qmlattachedsignal-command}{\\qmlattachedsignal}
\li \l{qmlbasictype-command}{\\qmlbasictype}
\li \l{qmltype-command}{\\qmltype} - creates a QML type documentation
\li \l{qmlmethod-command}{\\qmlmethod}
\li \l{qmlproperty-command}{\\qmlproperty}
\li \l{qmlsignal-command}{\\qmlsignal}
\li \l{inherits-command}{\\inherits}
\li \l{qmlmodule-command}{\\qmlmodule}
\li \l{inqmlmodule-command}{\\inqmlmodule}
\li \l{instantiates-command}{\\instantiates}
\endlist
\note Remember to enable QML parsing by including the \c{*.qml} filetype in
the \l{qdoc-input-output-dir}{fileextension} variable.
To document a QML type, start by creating a QDoc comment that uses the
\l{qmltype-command} {\\qmltype} command as its topic command.
\section3 QML Parser
If your QML type is defined in a \e qml file, document it there.
If your QML type is represented by a C++ class, document it in the
\e cpp file for that C++ class and include an
\l{instantiates-command}{\\instantiates} command to specify the
name of the C++ class. Don't document a QML type in a \e{cpp} file
if the QML type is defined in a \e{qml} file.
When documenting a QML type in a \e{qml} file, place each QDoc
comment directly above the entity to which the comment applies.
For example, place the QDoc comment containing the \e{\\qmltype}
command (the topic comment) directly above the outer QML type in
the \e{qml} file. Place the comment for documenting a QML property
directly above the property declaration, and so on for QML signal
handlers and QML methods. Note that when documenting QML
properties in a \e{qml} file, you don't normally include the
\e{\\qmlproperty} command as a topic command (which you must do
when documenting QML types in \e{cpp} files), because the QML
parser automatically associates each QDoc comment with the next
QML declaration it parses. The same is true for QML signal handler
and QML method comments. But it is sometimes useful to include one
or more \e{\\qmlproperty} commands in the comment, e.g. when the
property type is another QML type and you want the user to only
use certain properties within that other QML type, but not all of
them. But when documenting a property that has an alias, place the
QDoc comment for it directly above the alias declaration. In these
cases, the QDoc comment \e must contain a \e{\\qmlproperty}
command, because that is the only way QDoc can know the type of
the aliased property.
When documenting a QML type in the \e cpp file of its
corresponding C++ class (if it has one), you normally place each
QDoc comment directly above the entity it documents. However, QDoc
does not use the QML parser to parse these files (the C++ parser
is used), so these QML QDoc comments can appear anywhere in the
\e{cpp} file. Note that QML QDoc comments in \e cpp files \e must
use the QML topic commands. i.e., the \l{qmltype-command}
{\\qmltype} command \e must appear in the QDoc comment for the
QML type, and a \l{qmlproperty-command} {\\qmlproperty} command \e
must appear in each QML property QDoc comment.
\section3 QML Modules
A QML type belongs to a \e module. The module
may include all the related types for a platform or contain a certain
version of \l{Qt Quick}. For example, the Qt Quick 2 QML types belong
to the Qt Quick 2 module while there is also a Qt Quick 1 module for the older
types introduced in Qt 4.
QML modules allow grouping QML types. The \l{qmltype-command}
{\\qmltype} topic command must have an \l{inqmlmodule-command}
{\\inqmlmodule} context command to relate the type to a QML
module. Similarly, a \l{qmlmodule-command}{\\qmlmodule} topic
command must exist in a separate \c{.qdoc} file to create the
overview page for the module. The overview page will list the
QML types of the QML module.
The links to the QML types must therefore also contain the module name.
For example, if a type called \c TabWidget is in the \c UIComponents
module, it must be linked as \c {UIComponents::TabWidget}.
The \l{componentset}{UIComponents} example demonstrates proper usage of
QDoc commands to document QML types and QML modules.
\section3 Read-only and Internal QML Properties
QDoc detects QML properties that are marked as \c readonly. Note that the
property must be initialized with a value.
\code
readonly property int sampleReadOnlyProperty: 0
\endcode
For example, the example \l{TabWidget} type has a fictitious read-only
property \c sampleReadOnlyProperty. Its declaration has the \c readonly
identifier and it has an initial value.
Properties and signals that are not meant for the public interface may
be marked with the \l{internal-command}{\\internal} command. QDoc will not
publish the documentation in the generated outputs.
\section1 Articles & Overviews
Articles and overviews are a style of writing best used for providing
summary detail on a topic or concept. It may introduce a technology or
discuss how a concept may be applied, but without discussing exact steps
in too much detail. However, this type of content could provide the entry
point for readers to find instructional and reference materials that do,
such as tutorials, examples and class documentation. An example of an
overview might be a product page, such as a top level discussion of
Qt Quick, individual modules, design principles, or tools.
To signify that a document is an article, you append the article keyword
to the \\page command:
\snippet examples/samples.qdocinc sample-overview
The \l{writing-topic-commands}{writing topic commands} section has a listing
of the available \\page command arguments.
\section1 Tutorials, How-To's, FAQ's
Tutorials, How-To's, and FAQ's are all instructional material, in that they
instruct or prescribe to the reader. Tutorials are content designed to guide
the reader along a progressive learning path for a concept or technology.
How-To's and FAQ's (\e{Frequently Asked Questions}) provide guidance by
presenting material in the form of answers to commonly asked topics.
How-To's and FAQ's are designed for easy reference and are not necessarily
presented in a linear progression.
To create these types, mark the pages by providing a \c type argument to the
\l{page-command}{\\page} command. The \c type argument is the second
argument, with the file name being the first.
\snippet examples/samples.qdocinc sample-faq
The \l{writing-topic-commands}{writing topic commands} section has a listing
of the available \\page command arguments.
\section1 Code Examples
Examples are an effective way to demonstrate practical usage of a given
technology or concept. When it comes to middleware this is usually in the
form of an application using simple code and clear explanations of what the
code is doing. Any module, API, project, pattern etc. should have at least
one good example.
An example may have an accompanying tutorial. The tutorial instructs and
describes the code, while the code example is the code content that users
may study. Code examples may have accompanying text that are not in the
tutorial.
QDoc will create a page containing the example code with a description
using the \l{example-command}{\\example} command.
\snippet examples/samples.qdocinc sample-example
QDoc will use the directory specified in the input
\l{Input and Output Directories}{exampledirs} variable to find the Qt
Project (\c .pro) file to generate the example files. The generated HTML
will have the filename, \c {declarative-ui-components-tabwidget.html}. QDoc
will also list all of the example code.
\note The example's project file must be the same as the
directory name.
*/

View File

@ -1,187 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qtwritingstyle-cpp.html
\title C++ Documentation Style
\brief Style guidelines for C++ documentation
To generate the documentation, QDoc goes through the source code and generates
documentation for C++ types such as classes. QDoc then associates member
functions, properties, and other types to the appropriate class.
Note that the documentation must be in the implementation files such as \c .cpp.
\section1 Class Documentation
Class documentation is generated using the \l{class-command}{\\class} command and
the name of the class as the first argument.
\snippet examples/cpp.qdoc.sample class
\l{Context commands} add information about the class, such as its module or
which version the class was added.
Some common context commands are:
\list
\li \l{brief-command}{\\brief} - the class' brief description \b (mandatory)
\li \l{since-command}{\\since} - the version to which the class was added \b (mandatory)
\li \l{internal-command}{\\internal} - marks the class as internal. Internal
classes do not appear in the public API documentation.
\endlist
\section2 The Brief and Detailed Description
The \e{brief description} is marked with the \l{brief-command}{\\brief} command
and it is for summarizing the purpose or functionality of the class. For C++
classes, QDoc will take the class and create annotated information for the
class. The annotated information appears in lists and tables which display the
class.
The C++ brief should start with:
\code
"The <C++ class name> class"
\endcode
The \e{detailed description} section starts after the brief description. It
provides more information about the class. The detailed description may contain
images, snippet code, or links to other relevant documents. There
must be an empty line which separates the brief and detailed description.
\section1 Member Functions
Typically, function documentation immediately precedes the implementation of the
function in the \c .cpp file. For function documentation that is not immediately
above the implementation, the \l{fn-command}{\\fn} is needed.
\snippet examples/cpp.qdoc.sample function
The function documentation starts with a verb, indicating the operation the
function performs. This also applies to constructors and destructors.
Some common verbs for function documentation:
\list
\li "Constructs..." - for constructors
\li "Destroys..." - for destructors
\li "Returns..." - for accessor functions
\endlist
The function documentation must document:
\list
\li the return type
\li the parameters
\li the actions of the functions
\endlist
The \l{a-command}{\\a} command marks the parameter in the documentation.
The return type documentation should link to the type documentation or be
marked with the \l{c-command}{\\c} command in the case of boolean values.
\snippet examples/cpp.qdoc.sample return
\section1 Properties
The property documentation resides immediately above the read function's
implementation. The \l{writing-topic-commands}{topic command} for properties is
\l{property-command}{\\property}.
\snippet examples/cpp.qdoc.sample property
Property documentation usually starts with "This property...", but these are
alternate expressions:
\list
\li "This property holds..."
\li "This property describes..."
\li "This property represents..."
\li "Returns \c true when... and \c false when..." - for properties that
are read.
\li "Sets the..." - for properties that configure a type.
\endlist
Property documentation must include:
\list
\li description and behavior of the property
\li accepted values for the property
\li the default value of the property
\endlist
Similar to \l{Member Functions}{functions}, the default type may be linked
or marked with the \c{\c} command.
An example of a value range style is:
\quotation
The values range from 0.0 (no blur) to maximumRadius (maximum blur). By default, the property is set to 0.0 (no blur).
\endquotation
\section1 Signals, Notifiers, and Slots
The \l{writing-topic-commands}{topic command} for signals, notifiers, and slots
is \l{fn-command}{\\fn}. Signal documentation state when they are triggered
or emitted.
\snippet examples/cpp.qdoc.sample signals
Signal documentation typically begin with "This signal is triggered when...".
Here are alternate styles:
\list
\li "This signal is triggered when..."
\li "Triggered when..."
\li "Emitted when..."
\endlist
For slots or notifiers, the condition when they are executed or triggered by
a signal should be documented.
\list
\li "Executed when..."
\li "This slot is executed when..."
\endlist
For properties that have overloaded signals, QDoc groups the overloaded
notifiers together. To refer to a specific version of a notifier or signal,
simply refer to the property and mention that there are different versions of
the notifier.
\snippet examples/cpp.qdoc.sample overloaded notifier
\section1 Enums, Namespaces, and Other Types
Enums, namespaces, and macros have a \l{writing-topic-commands}{topic command} for their documentation:
\list
\li \l{enum-command}{\\enum}
\li \l{typedef-command}{\\typedef}
\li \l{macro-command}{\\macro}
\endlist
The language style for these types mention that they are an enum or a macro and
continues with the type description.
For enumerations, the \l{value-command}{\\value} command is for listing the
values. QDoc creates a table of values for the enum.
\snippet examples/cpp.qdoc.sample enums
*/

View File

@ -1,164 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qtwritingstyle-qml.html
\title QML Documentation Style
\brief Style guidelines for QML documentation
QDoc can process QML types defined as C++ classes and QML types defined in
\c .qml files. For C++ classes documented as QML types, the QDoc comments are
in the \c .cpp file while QML types defined in QML are in the \c .qml
file. The C++ classes must also be documented
documented with the QML \l{topic-commands}{topic commands}:
\list
\li \l{qmlattachedproperty-command}{\\qmlattachedproperty}
\li \l{qmlattachedsignal-command}{\\qmlattachedsignal}
\li \l{qmlbasictype-command}{\\qmlbasictype}
\li \l{qmltype-command}{\\qmltype}
\li \l{qmlmethod-command}{\\qmlmethod}
\li \l{qmlproperty-command}{\\qmlproperty}
\li \l{qmlsignal-command}{\\qmlsignal}
\li \l{qmlmodule-command}{\\qmlmodule}
\li \l{inqmlmodule-command}{\\inqmlmodule}
\li \l{instantiates-command}{\\instantiates}
\endlist
For QML types defined in \c .qml files, QDoc will parse the QML and determine
the properties, signals, and the type within the QML definition. The QDoc
block then needs to be immediately above the declaration. For QML types
implemented in C++, QDoc will output warnings if the C++ class documentation
does not exist. The class documentation may be marked as
\l{internal-command}{internal} if it is not a public API.
\section1 QML Types
The \l{qmltype-command}{\\qmltype} command is for QML type documentation.
\snippet examples/qml.qdoc.sample qmltype
The \l{instantiates-command}{\\instantiates} accepts the C++ class which
implements the QML type as the argument. For types implemented in QML, this
is not needed.
The \e{brief description} provides a summary for the QML type. The brief does
not need to be a complete sentence and may start with a verb. QDoc will append
the brief description onto the QML type in tables and generated lists.
\code
\qmltype ColorAnimation
\brief Animates changes in color values
\endcode
Here are some alternate verbs for the brief statement:
\list
\li "Provides..."
\li "Specifies..."
\li "Describes..."
\endlist
The \e{detailed description} follows the brief and may contain images, snippet,
and link to other documentation.
\section1 Properties
The property description focuses on what the property \e does and may use the
following style:
Property documentation usually starts with "This property..." but for certain
properties, these are the common expressions:
\list
\li "This property holds..."
\li "This property describes..."
\li "This property represents..."
\li "Returns \c true when... and \c false when..." - for properties that
are marked \c{read-only}.
\li "Sets the..." - for properties that configure a type.
\endlist
\section1 Signals and Handlers Documentation
QML signals are documented either in the QML file or in the C++ implementation
with the \l{qmlsignal-command}{\\qmlsignal} command. Signal documentation
must include the condition for emitting the signal, mention the corresponding
signal handler, and document whether the signal accepts a parameter.
\snippet examples/qml.qdoc.sample signals
These are the possible documentation styles for signals:
\list
\li "This signal is triggered when..."
\li "Triggered when..."
\li "Emitted when..."
\endlist
\section1 Methods and JavaScript Functions
Typically, function documentation immediately precedes the implementation of the
function in the \c .cpp file. The \l{topic-commands}{topic command} for
functions is \l{fn-command}{\\fn}. For functions in QML or JavaScript, the
documentation must reside immediately above the function declaration.
The function documentation starts with a verb, indicating the operation the
function performs.
\snippet examples/qml.qdoc.sample function
Some common verbs for function documentation:
\list
\li "Copies..." - for constructors
\li "Destroys..." - for destructors
\li "Returns..." - for accessor functions
\endlist
The function documentation must document:
\list
\li the return type
\li the parameters
\li the actions of the functions
\endlist
The \l{a-command}{\\a} command marks the parameter in the documentation.
The return type documentation should link to the type documentation or be
marked with the \l{c-command}{\\c} command in the case of boolean values.
\section1 Enumerations
QML enumerations are documented as QML properties with the
\l{qmlproperty-command}{\\qmlproperty} command. The type of the property
is \c enumeration.
\snippet examples/qml.qdoc.sample enums
The QDoc comment lists the values of the enumeration. If the enumeration is
implemented in C++, the documentation may link to the corresponding C++
enumeration. However, the QDoc comment should advise that the enumeration
is a C++ enumeration.
*/

View File

@ -1,164 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page 21-0-qdoc-creating-dita-maps.html
\previouspage Miscellaneous
\contentspage QDoc Manual
\nextpage The QDoc Configuration File
\title Creating DITA Maps
You can create DITA map files using three new qdoc commands, the \l{ditamap-command}
{ditamap} command, the \l{topicref-command} {topicref} command, and the \l{mapref-command}
{mapref} command. How these DITA maps will be used automatically or manually by the
documentation build process is still under consideration. This section will be updated
as the decisions are made.
\section1 What is a DITA Map?
A complete description of DITA can be found at the
\l{http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=dita}
{OASIS Darwin Information Typing Architecture} site.
An explanation of the DITA map is found at that site
\l{http://docs.oasis-open.org/dita/v1.2/os/spec/langref/map.html}{here}.
\target ditamap-command
\section1 \\ditamap
The \\ditamap command is for creating a DITA map using qdoc commands.
The \\ditamap command is a kind of \\page command that produces a
\e{.ditamap} instead of a \e{.html} or \e{.xml} file. The file that
is created actually contains XML text, but the \e{.ditamap} suffix is
used to identify the file as containing a DITA MAP.
The argument is the name of the file to be created. In the following
example, the file \e{creator.ditamap} is output:
\code
\ditamap creator.ditamap
\endcode
\target topicref-command
\section1 \\topicref \\endtopicref
The \\topicref \\endtopicref commands are for creating a topicref
in the ditamap. The \\endtopicref command is required because
\\topicref commands can be nested.
\\topicref has two arguments. The first argument becomes the value
of the \e navtitle attribute. Normally, you use the title of the
topic being referenced. This title is often what will appear in a
table of contents constructed from the ditamap.
The second argument is the name of the page being referenced. The
second argument is actually optional, for example if you are using
a topicref as a container for other topicrefs and maprefs. It is
also optional if you want qdoc to find the page name for you by
looking up the title in its internal data structure. It is recommended
that you provide the second parameter if you know the page name.
\code
\topicref {QML Module QtQuick 2} {qtquick-2.xml}
\mapref {Creator Manual} {creator-manual.ditamap} \endmapref
\topicref {QML Mouse Events} {qtquick2-mouseevents.xml} \endtopicref
\topicref {Property Binding} {qtquick2-propertybinding.xml} \endtopicref
\endtopicref
\endcode
\target mapref-command
\section1 \\mapref
The \\mapref command is for creating a mapref in the ditamap. A
mapref refers to another ditamap, which you want to include in
your ditamap. Like the \\topicref command, the \\mapref command
has two arguments, but for the \\mapref command, both arguments
are required. The arguments are essentially the same as described
for \\topicref, but for \\mapref, the second command must be the
name of another ditamap, i.e. it must have the \e{.ditamap}
suffix. You must provide the file name. qdoc can't look up the
file name for you.
\code
\mapref {Creator Manual} {creator-manual.ditamap} \endmapref
\endcode
\section1 An Example Ditamap Page
The following example uses the three qdoc ditamap commands described above.
\code
\ditamap creator.ditamap
\title The DITA Map for Creator
\topicref {QML Module QtQuick 1}
\topicref {QML Mouse Events} \endtopicref
\topicref {Property Binding} \endtopicref
\endtopicref
\topicref {QML Module QtQuick 2} {qtquick-2.xml}
\mapref {Creator Manual} {creator-manual.ditamap} \endmapref
\topicref {QML Mouse Events} {qtquick2-mouseevents.xml} \endtopicref
\topicref {Property Binding} {qtquick2-propertybinding.xml} \endtopicref
\endtopicref
\topicref {QML Module QtQuick.Particles 2} {qtquick-particles-2.xml}
\topicref {Age} {qml-qtquick-particles2-age.xml} \endtopicref
\endtopicref
\endcode
\section1 The Resulting Ditamap File
This is the \e{.ditamap} file you get when you input the qdoc
ditamap page shown above. Note that you can write ditamap files
directly in XML just as easily as you can write them using the
qdoc commands. The choice is yours.
\code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<topicmeta>
<shortdesc>The DITA Map for Creator</shortdesc>
</topicmeta>
<topicref navtitle="QML Module QtQuick 1" href="qtquick-1.xml">
<topicref navtitle="QML Mouse Events" href="qtquick2-mouseevents.xml"/>
<topicref navtitle="Property Binding" href="qtquick2-propertybinding.xml"/>
</topicref>
<topicref navtitle="QML Module QtQuick 2" href="qtquick-2.xml">
<mapref navtitle="Creator Manual" href="creator-manual.ditamap"/>
<topicref navtitle="QML Mouse Events" href="qtquick2-mouseevents.xml"/>
<topicref navtitle="Property Binding" href="qtquick2-propertybinding.xml"/>
</topicref>
<topicref navtitle="QML Module QtQuick.Particles 2" href="qtquick-particles-2.xml">
<topicref navtitle="Age" href="qml-qtquick-particles2-age.xml"/>
</topicref>
</map>
\endcode
*/

View File

@ -1,156 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page 27-qdoc-commands-alphabetical.html
\previouspage Introduction to QDoc
\contentspage QDoc Manual
\nextpage Topic Commands
\title Command Index
This is a complete, alphabetized list of the QDoc commands.
\list
\li \l {a-command} {\\a}
\li \l {abstract-command} {\\abstract}
\li \l {annotatedlist-command} {\\annotatedlist}
\li \l {b-command} {\\b}
\li \l {b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)}
\li \l {brief-command} {\\brief}
\li \l {c-command} {\\c}
\li \l {caption-command} {\\caption}
\li \l {chapter-command} {\\chapter}
\li \l {class-command} {\\class}
\li \l {code-command} {\\code}
\li \l {codeline-command} {\\codeline},
\li \l {compat-command} {\\compat}
\li \l {contentspage-command} {\\contentspage}
\li \l {default-command} {\\default}
\li \l {div-command} {\\div}
\li \l {dots-command} {\\dots}
\li \l {e-command} {\\e}
\li \l {else-command} {\\else}
\li \l {endif-command} {\\endif}
\li \l {enum-command} {\\enum}
\li \l {example-command} {\\example}
\li \l {externalpage-command} {\\externalpage}
\li \l {fn-command} {\\fn}
\li \l {footnote-command} {\\footnote}
\li \l {generatelist-command} {\\generatelist}
\li \l {group-command} {\\group}
\li \l {header-command} {\\header}
\li \l {headerfile-command} {\\headerfile}
\li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
\li \l {if-command} {\\if}
\li \l {image-command} {\\image}
\li \l {include-command} {\\include}
\li \l {indexpage-command} {\\indexpage}
\li \l {ingroup-command} {\\ingroup}
\li \l {inherits-command}{\\inherits}
\li \l {inlineimage-command} {\\inlineimage}
\li \l {inmodule-command} {\\inmodule}
\li \l {inqmlmodule-command} {\\inqmlmodule}
\li \l {instantiates-command} {\\instantiates}
\li \l {internal-command} {\\internal}
\li \l {keyword-command} {\\keyword}
\li \l {l-command} {\\l}
\li \l {legalese-command} {\\legalese}
\li \l {li-command} {\\li}
\li \l {list-command} {\\list}
\li \l {macro-command} {\\macro}
\li \l {meta-command} {\\meta}
\li \l {module-command} {\\module}
\li \l {namespace-command} {\\namespace}
\li \l {nextpage-command} {\\nextpage}
\li \l {newcode-command} {\\newcode}
\li \l {noautolist-command} {\\noautolist}
\li \l {nonreentrant-command} {\\nonreentrant}
\li \l {note-command} {\\note}
\li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
\li \l {obsolete-command} {\\obsolete}
\li \l {oldcode-command} {\\oldcode}
\li \l {omit-command} {\\omit}
\li \l {omitvalue-command} {\\omitvalue}
\li \l {overload-command} {\\overload}
\li \l {page-command} {\\page}
\li \l {part-command} {\\part}
\li \l {preliminary-command} {\\preliminary}
\li \l {previouspage-command} {\\previouspage}
\li \l {printline-command} {\\printline}
\li \l {printto-command} {\\printto}
\li \l {printuntil-command} {\\printuntil}
\li \l {property-command} {\\property}
\li \l {qmlabstract-command} {\\qmlabstract}
\li \l {qmlattachedproperty-command} {\\qmlattachedproperty}
\li \l {qmlattachedsignal-command} {\\qmlattachedsignal}
\li \l {qmlbasictype-command} {\\qmlbasictype}
\li \l {qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)}
\li \l {qmltype-command} {\\qmltype}
\li \l {qmlmethod-command} {\\qmlmethod}
\li \l {qmlproperty-command} {\\qmlproperty}
\li \l {qmlsignal-command} {\\qmlsignal}
\li \l {qmlmodule-command} {\\qmlmodule}
\li \l {quotation-command} {\\quotation}
\li \l {quotefile-command} {\\quotefile}
\li \l {quotefromfile-command} {\\quotefromfile}
\li \l {raw-command} {\\raw}
\li \l {reentrant-command} {\\reentrant}
\li \l {reimp-command} {\\reimp}
\li \l {relates-command} {\\relates}
\li \l {row-command} {\\row}
\li \l {sa-command} {\\sa}
\li \l {sectionOne-command} {\\section1}
\li \l {sectionTwo-command} {\\section2}
\li \l {sectionThree-command} {\\section3}
\li \l {sectionFour-command} {\\section4}
\li \l {since-command} {\\since}
\li \l {skipline-command} {\\skipline}
\li \l {skipto-command} {\\skipto}
\li \l {skipuntil-command} {\\skipuntil}
\li \l {snippet-command} {\\snippet},
\li \l {span-command} {\\span}
\li \l {startpage-command} {\\startpage}
\li \l {sub-command} {\\sub}
\li \l {subtitle-command} {\\subtitle}
\li \l {sup-command} {\\sup}
\li \l {table-command} {\\table}
\li \l {tableofcontents-command} {\\tableofcontents}
\li \l {target-command} {\\target}
\li \l {threadsafe-command} {\\threadsafe}
\li \l {title-command} {\\title}
\li \l {tt-command} {\\tt}
\li \l {typedef-command} {\\typedef}
\li \l {uicontrol-command} {\\uicontrol}
\li \l {underline-command} {\\underline}
\li \l {variable-command} {\\variable}
\li \l {value-command} {\\value}
\li \l {warning-command} {\\warning}
\endlist
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,325 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page 01-qdoc-manual.html
\contentspage QDoc Manual
\previouspage QDoc Manual
\nextpage Command Index
\title Introduction to QDoc
QDoc is a tool used by Qt Developers to generate documentation for
software projects. It works by extracting \e {QDoc comments} from
project source files and then formatting these comments as HTML
pages or DITA XML documents. QDoc finds QDoc comments in \c
{.cpp} files and in \c {.qdoc} files. QDoc does not look for QDoc
comments in \c {.h} files. A QDoc comment always begins with an
exclamation mark (\b{!})). For example:
\code
/ *!
\class QObject
\brief The QObject class is the base class of all Qt objects.
\ingroup objectmodel
\reentrant
QObject is the heart of the Qt \l{Object Model}. The
central feature in this model is a very powerful mechanism
for seamless object communication called \l{signals and
slots}. You can connect a signal to a slot with connect()
and destroy the connection with disconnect(). To avoid
never ending notification loops you can temporarily block
signals with blockSignals(). The protected functions
connectNotify() and disconnectNotify() make it possible to
track connections.
QObjects organize themselves in \l {Object Trees &
Ownership} {object trees}. When you create a QObject with
another object as parent, the object will automatically
add itself to the parent's \c children() list. The parent
takes ownership of the object. It will automatically
delete its children in its destructor. You can look for an
object by name and optionally type using findChild() or
findChildren().
Every object has an objectName() and its class name can be
found via the corresponding metaObject() (see
QMetaObject::className()). You can determine whether the
object's class inherits another class in the QObject
inheritance hierarchy by using the \c inherits() function.
....
* /
\endcode
From the QDoc comment above, QDoc generates the HTML \l {QObject}
{QObject class reference} page.
This manual explains how to use the QDoc commands in QDoc comments
to embed good documentation in your source files. It also explains
how to make a \l {The QDoc Configuration File} {QDoc configuration
file}, which you will pass to QDoc on the command line.
\section1 Running QDoc
The name of the QDoc program is \c {qdoc}. To run qdoc from the
command line, give it the name of a configuration file:
\quotation
\c {$ ../../bin/qdoc ./config.qdocconf}
\endquotation
QDoc recognizes the \c {.qdocconf} suffix as a \l{The QDoc
Configuration File} {QDoc configuration file}. The configuration
file is where you tell QDoc where to find the project source
files, header files, and \c {.qdoc} files. It is also where you
tell QDoc what kind of output to generate (HTML, DITA XML,...),
and where to put the generated documentation. The configuration
file also contains other information for QDoc.
See \l{The QDoc Configuration File} for instructions on how to
set up a QDoc configuration file.
\section2 Running QDoc in Single Execution Mode
Beginning with Qt 5.5, a new way to run QDoc is available that
reduces the time it takes to generate the Qt5 documentation by as
much as 90%. The new way to run QDoc is \e{single execution} mode.
Single execution mode is not currently available in the Qt5 build
system, which still uses the \e {standard} mode. Single execution
mode is only available when you run QDoc yourself, which you will
want to do often as you document your module and integrate your
documentation with the other Qt modules.
To run QDoc in single execution mode, add \c {-single-exec} to the
command line and pass QDoc a master \c qdocconf file that is
simply a list of file paths for qdocconf files of all the Qt5
modules. For example:
\code
/Users/me/qt5/qtbase/bin/qdoc -outputdir /Users/me/qt5/qtbase/doc -installdir /Users/me/qt5/qtbase/doc /Users/me/qt5/master.qdocconf -single-exec
\endcode
The qdocconf file, \c {master.qdocconf}, just lists the qdocconf files for all the Qt5 modules to be processed:
\badcode
/Users/me/qt5/qtbase/src/corelib/doc/qtcore.qdocconf
/Users/me/qt5/qtbase/src/network/doc/qtnetwork.qdocconf
/Users/me/qt5/qtbase/src/sql/doc/qtsql.qdocconf
/Users/me/qt5/qtbase/src/xml/doc/qtxml.qdocconf
/Users/me/qt5/qtbase/src/testlib/doc/qttestlib.qdocconf
/Users/me/qt5/qtbase/src/concurrent/doc/qtconcurrent.qdocconf
/Users/me/qt5/qtbase/src/gui/doc/qtgui.qdocconf
/Users/me/qt5/qtbase/src/platformheaders/doc/qtplatformheaders.qdocconf
/Users/me/qt5/qtbase/src/widgets/doc/qtwidgets.qdocconf
/Users/me/qt5/qtbase/src/opengl/doc/qtopengl.qdocconf
/Users/me/qt5/qtbase/src/printsupport/doc/qtprintsupport.qdocconf
/Users/me/qt5/qtbase/src/tools/qdoc/doc/config/qdoc.qdocconf
/Users/me/qt5/qtbase/qmake/doc/qmake.qdocconf
/Users/me/qt5/qtsvg/src/svg/doc/qtsvg.qdocconf
/Users/me/qt5/qtxmlpatterns/src/xmlpatterns/doc/qtxmlpatterns.qdocconf
/Users/me/qt5/qtdeclarative/src/qml/doc/qtqml.qdocconf
/Users/me/qt5/qtdeclarative/src/quick/doc/qtquick.qdocconf
/Users/me/qt5/qtquickcontrols/src/controls/doc/qtquickcontrols.qdocconf
/Users/me/qt5/qtquickcontrols/src/layouts/doc/qtquicklayouts.qdocconf
/Users/me/qt5/qtquickcontrols/src/dialogs/doc/qtquickdialogs.qdocconf
/Users/me/qt5/qtmultimedia/src/multimedia/doc/qtmultimedia.qdocconf
/Users/me/qt5/qtmultimedia/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf
/Users/me/qt5/qtactiveqt/src/activeqt/doc/activeqt.qdocconf
/Users/me/qt5/qtsensors/src/sensors/doc/qtsensors.qdocconf
/Users/me/qt5/qtwebkit/Source/qtwebkit.qdocconf
/Users/me/qt5/qttools/src/assistant/help/doc/qthelp.qdocconf
/Users/me/qt5/qttools/src/assistant/assistant/doc/qtassistant.qdocconf
/Users/me/qt5/qttools/src/designer/src/uitools/doc/qtuitools.qdocconf
/Users/me/qt5/qttools/src/designer/src/designer/doc/qtdesigner.qdocconf
/Users/me/qt5/qttools/src/linguist/linguist/doc/qtlinguist.qdocconf
/Users/me/qt5/qtwebkit-examples/doc/qtwebkitexamples.qdocconf
/Users/me/qt5/qtimageformats/src/imageformats/doc/qtimageformats.qdocconf
/Users/me/qt5/qtgraphicaleffects/src/effects/doc/qtgraphicaleffects.qdocconf
/Users/me/qt5/qtscript/src/script/doc/qtscript.qdocconf
/Users/me/qt5/qtscript/src/scripttools/doc/qtscripttools.qdocconf
/Users/me/qt5/qtserialport/src/serialport/doc/qtserialport.qdocconf
/Users/me/qt5/qtdoc/doc/config/qtdoc.qdocconf
\endcode
\section3 Why Standard Mode Is Slow
Currently, the Qt5 build system does not use QDoc's \e {single
execution} mode for generating the Qt5 documentation. It runs QDoc
in the \e {standard} mode. The standard mode was came about
because it was the easiest way to get convert the Qt4 QDoc to
handle the modularization of Qt in Qt5. In Qt4, QDoc ran once over
all the Qt4 sources to generate the HTML documentation for Qt.
While generating the Qt documentation, Qt4 QDoc also generated an
\e {index file} for Qt. That index file was meant to be used as
input to subsequent QDoc runs for generating HTML documentation
for other software libraries/products that were based on Qt. The
Qt index file allowed QDoc to link documentation written for those
other libraries/products to the Qt4 documentation.
When Qt5 came along, Qt was divided into modules. Since then,
many new modules have been added to Qt. As of version 5.5, there
are over 40 separate modules in Qt5, each with its own
documentation that links to (depends on) the documentation of
other Qt modules.
In \e {standard mode}, QDoc runs twice for each module. The first
QDoc run for a particular Qt module, parses all the module's
source files and then uses the information to generate the
module's index file. It is called the \e{prepare phase} because
it \e prepares the module's index file. The second QDoc run for
the module also parses all the module's source files and then
generates the module's documentation pages. This is called the \e
{generate phase} because it generates the module's documentation.
The module's documentation will likely contain HTML links to the
documentation of one or more of the other Qt modules. For example,
most Qt5 modules contain links to documentation in QtCore. When a
Qt module contains links into the documentation of other Qt
module's, that module is said to depend on those other Qt modules.
Hence when QDoc runs the \e {generate phase} for that module, it
must also load the index files for those modules so it can create
those thinks.
Hence, when the Qt build system generates the Qt documentation, it
first runs QDoc once for each module to perform the \e {prepare
phase} to generate all the index files. Then it runs QDoc once for
each module to perform the \e {generate phase}, where it uses the
dependent index files to generate the module's documentation,
including any cross-module links it finds. Each execution of
QDoc, both \e {prepare phase} and \e {generate phase}, parses
all the source files that are included in the module, and in the
\e {generate phase} also parses the index files for the dependent
modules. Nothing is retained or retainable between QDoc runs.
\section3 Why Single Execution Mode Is Much Faster
As the name implies, single execution mode uses a single QDoc
process to generate all the Qt5 documentation. The single QDoc
process still performs a \e{prepare phase} for each module and
then a \e{generate phase} for each module, but there are a few
differences. It begins by reading the master qdocconf file. Then
it reads each qdocconf file in the master list and performs the
\e{prepare phase} for each module. During the \e{prepare phase},
all the source files for the module are parsed to build a syntax
tree for the module. The module's index file is then generated,
although QDoc will not re-read the index files in the \e{generate
phase}. The important difference here is that the module's syntax
tree is retained after the index file is generated, so that after
the \e{prepare phase} has been run for all the modules, QDoc still
has all the syntax trees it built.
QDoc then processes each module again for the \e{generate phase}.
But now QDoc doesn't need to re-parse each module's source files,
because the module's syntax tree is still in memory. Nor does QDoc
need to re-read the index files for the dependent modules, again
because it still has the syntax trees for those modules in memry.
It remains only to traverse each module's syntax tree to generate
the documentation pages.
Hence, QDoc parses each source file once and only once and doesn't
need to read index files. This is what makes single execution mode
much faster than the standard mode. It is anticipated that the Qt
build system will eventually run QDoc in single execution mode.
However, changes to the master qdocconf file might be required, so
the method described above for running QDoc in single execution
mode might have to change, watch this space for updates.
\section1 How QDoc Works
QDoc begins by reading the configuration file you specified on the
command line. It stores all the variables from the configuration
file for later use. One of the first variables it uses is \c
{outputformats}. This variable tells QDoc which output generators
it will run. The default value is \e {HTML}, so if you don't set
\c {outputformats} in your configuration file, QDoc will generate
HTML output. That's usually what you will want anyway, but you can
also specify \e {DITAXML} to get DITA XML output instead.
Next, QDoc uses the values of the
\l {headerdirs-variable}
{headerdirs} variable and/or the \l
{22-qdoc-configuration-generalvariables.html#headers-variable}
{headers} variable to find and parse all the header files for your
project. QDoc does \e not scan header files for QDoc comments. It
parses the header files to build a master tree of all the items
that should be documented, in other words, the items that QDoc should find
QDoc comments for.
After parsing all the header files and building the master tree of
items to be documented, QDoc uses the value of the \l
{22-qdoc-configuration-generalvariables.html#sourcedirs-variable}
{sourcedirs} variable and/or the value of the \l
{22-qdoc-configuration-generalvariables.html#sources-variable}
{sources} variable to find and parse all the \c {.cpp} and \c
{.qdoc} files for your project. These are the files QDoc scans for
\e {QDoc comments}. Remember that a QDoc comment begins with
an exclamation mark: \b {/*!} .
For each QDoc comment it finds, it searches the master tree for
the item where the documentation belongs. Then it interprets the
qdoc commands in the comment and stores the interpreted commands
and the comment text in the tree node for the item.
Finally, QDoc traverses the master tree. For each node, if the
node has stored documentation, QDoc calls the output generator
specified by the \c {outputformats} variable to format and write
the documentation in the directory specified in the configuration
file in the \l
{22-qdoc-configuration-generalvariables.html#outputdir-variable}
{outputdir} variable.
\section1 Command Types
QDoc interprets three types of commands:
\list
\li \l {Topic Commands}
\li \l {Context Commands}
\li \l {Markup Commands}
\endlist
Topic commands identify the element you are documenting, for example
a C++ class, function, type, or an extra page of text
that doesn't map to an underlying C++ element.
Context commands tell QDoc how the element being documented
relates to other documented elements, for example, next and previous page
links, inclusion in page groups, or library modules. Context
commands can also provide information about the documented element
that QDoc can't get from the source files, for example, whether the
element is thread-safe, whether it is an overloaded or reimplemented function,
or whether it has been deprecated.
Markup commands tell QDoc how text and image elements in the
document should be rendered, or about the document's outline
structure.
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,78 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qdoc-index.html
\nextpage Introduction to QDoc
\title QDoc Manual
\list
\li \l {Introduction to QDoc}
\li \l {Getting Started with QDoc}
\li \l {Command Index}
\li \l {Topic Commands}
\li \l {Context Commands}
\list
\li \l {Document Navigation}
\li \l {Status}
\li \l {Thread Support}
\li \l {Relating Things}
\li \l {Grouping Things}
\li \l {Naming Things}
\endlist
\li \l{Markup Commands}
\list
\li \l {Text Markup}
\li \l {Document Structure}
\li \l {Including Code Inline}
\li \l {Including External Code}
\li \l {Creating Links}
\li \l {Including Images}
\li \l {Tables and Lists}
\li \l {Special Content}
\li \l {Miscellaneous}
\endlist
\li \l{Creating DITA Maps}
\li \l {The QDoc Configuration File}
\list
\li \l {Generic Configuration Variables}
\li \l {Creating Help Project Files}
\li \l {C++ Specific Configuration Variables}
\li \l {HTML Specific Configuration Variables}
\li \l {Supporting Derived Projects}
\li \l {Example Manifest Files}
\li \l {qtgui.qdocconf}
\li \l {minimum.qdocconf}
\li \l {Generating DITA XML Output}
\endlist
\li \l {QA Pages}
\endlist
*/

View File

@ -1,89 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qdoc-minimum-qdocconf.html
\keyword minimal-qdocconf
\title A Minimal qdocconf File
\brief Describes a minimal .qdocconf file
Below you will find the full contents of qtgui.qdocconf. The subsequent section
will discuss every statement in the qdocconf file.
Each line from the qdocconf file is first quoted. Below each statement you will
find the meaning.
\badcode
include(compat.qdocconf)
outputdir = html
headerdirs = .
sourcedirs = .
exampledirs = .
imagedirs = ./images
\endcode
\b Notes:
\badcode
include(compat.qdocconf)
\endcode
For compatibility with older versions of Qt, it is recommended
to include compat.qdocconf.
\code
outputdir = html
\endcode
QDoc will put the documentation generated in the html directory.
\badcode
headerdirs = .
\endcode
The header file associated with the \e .cpp source files can be found in the
current directory.
\badcode
sourcedirs = .
\endcode
The current directory is the directory containing the source files: the \e .cpp
and \e .qdoc files used in the documentation.
\badcode
exampledirs = .
\endcode
The source code of the example files can be found in the current directory.
\badcode
imagedirs = ./images
\endcode
The image files can be found in the underlying directory \c images.
*/

View File

@ -1,299 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qtgui-qdocconf.html
\title qtgui.qdocconf with Comments
\brief A walkthrough of a typical qdocconf file.
This document goes through a typical Qt 5 qdocconf file. The contents is taken from
Qt GUI's \e qtgui.qdocconf file.
Below you will find the full contents of \c qtgui.qdocconf. The subsequent section will discuss
every statement in the qdocconf file.
\badcode
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtGui
description = Qt GUI Reference Documentation
url = http://doc.qt.io/qt-5
version = $QT_VERSION
examplesinstallpath = gui
qhp.projects = QtGui
qhp.QtGui.file = qtgui.qhp
qhp.QtGui.namespace = org.qt-project.qtgui.$QT_VERSION_TAG
qhp.QtGui.virtualFolder = qtgui
qhp.QtGui.indexTitle = Qt GUI
qhp.QtGui.indexRoot =
qhp.QtGui.filterAttributes = qtgui $QT_VERSION qtrefdoc
qhp.QtGui.customFilters.Qt.name = Qtgui $QT_VERSION
qhp.QtGui.customFilters.Qt.filterAttributes = qtgui $QT_VERSION
qhp.QtGui.subprojects = classes
qhp.QtGui.subprojects.classes.title = C++ Classes
qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes
qhp.QtGui.subprojects.classes.selectors = class fake:headerfile
qhp.QtGui.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtgui/qtgui.tags
depends += \
qtcore \
qtnetwork \
qtopengl \
qtsvg \
qtqml \
qtquick \
qtwidgets \
qtdoc
headerdirs += ..
sourcedirs += .. \
../../../examples/gui/doc/src
excludedirs = ../../../examples/gui/doc/src/tmp
exampledirs += ../../../examples/gui \
snippets
imagedirs += images \
../../../examples/gui/doc/images \
../../../doc/src/images \
\endcode
\title Qtgui.qdocconf with notes
\badcode
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
\endcode
QDoc inherits the default templates, macros, and settings from the directory
specified from the \c $QT_INSTALL_DOCS variable. \c qmake prints the value of
the variable.
\badcode
qmake -query
\endcode
\b {See also}: \l {include}.
\badcode
project = QtGui
\endcode
The \c project variable sets the name of the QDoc build. This name is also
used to form the index file, which, in this case, will be \e qtgui.index. The
name of the index file doesn't adopt the uppercase letters of the project name.
\b {See also}: \l {project}.
\badcode
description = Qt GUI Reference Documentation
\endcode
A short description of the project concerned.
\badcode
url = http://doc.qt.io/qt-5
\endcode
The \c url variable holds the base url of the project.
The URL is stored in the generated index file for the project.
QDoc will use this as the base URL when constructing external links
to content listed in the index.
\note QDoc omits this value when the -installdir argument
is specified when running QDoc.
\keyword examplesinstallpath
\badcode
examplesinstallpath = gui
\endcode
This \c examplesinstallpath variable indicates that the examples will be
installed in the \e gui directory under the parent examples directory
(for Qt, this is $QT_INSTALL_EXAMPLES).
\note The examplepath variable has to match the example directory specified in
\c exampledirs.
\b {See also}: \l {exampledirs}.
\badcode
qhp.projects = QtGui
qhp.QtGui.file = qtgui.qhp
\endcode
The following parameters are for creating a QHP file (\e .qhp). The
\e qhelpgenerator program can convert the QHP file into a QCH file (\e .qch),
which can be opened in Qt Assistant or Qt Creator.
\badcode
qhp.QtGui.namespace = org.qt-project.qtgui.$QT_VERSION_TAG
\endcode
A unique identifier which enables QHelpEngine to retrieve the helpfile
from a given link. This namespace is also used as a base url for links
to the helpfile.
\badcode
qhp.QtGui.virtualFolder = qtgui
\endcode
Virtual folders group documentation together into a single location. A
virtual folder will become the root directory of all files referenced in
a compressed help file.
When two manuals are located in the same virtual folder, it is possible to
refer to sections of the other manual using relative paths. The virtual
folder tag is mandatory and the folder must not contain any '/'.
\badcode
qhp.QtGui.indexTitle = Qt GUI
\endcode
This is the title of the page that has the contents.
\badcode
qhp.QtGui.indexRoot =
\endcode
Specifies the title of the root (namespace) page to generate the documentation for.
Typically defined as an empty string.
\badcode
qhp.QtGui.filterAttributes = qtgui $QT_VERSION qtrefdoc
qhp.QtGui.customFilters.Qt.name = QtGui $QT_VERSION
qhp.QtGui.customFilters.Qt.filterAttributes = qtgui $QT_VERSION
\endcode
The documentation set (one per QDoc project) can have any number of filter
attributes assigned to it. A filter attribute is an ordinary string which
can be freely chosen. Additionally, custom filters that reference above
attributes can be defined. Qt Assistant will display the name of the custom
filter in its \gui{Filtered by} drop-down list. Only the documentation sets
that have their filter attributes match the attributes of the selected
custom filter will be shown.
\badcode
qhp.QtGui.subprojects = classes
qhp.QtGui.subprojects.classes.title = C++ Classes
qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes
\endcode
The subprojects specify the sections that are displayed in the table of contents
for this project. In this example, the subproject, which is displayed in
the Assistant's sidebar, is named "C++ Classes" and its index is the page
titled "QT GUI C++ Classes".
\badcode
qhp.QtGui.subprojects.classes.selectors = class fake:headerfile
\endcode
Lists all C++ classes and header files.
See \l {Creating Help Project Files} for more information.
\badcode
tagfile = ../../../doc/qtgui/qtgui.tags
\endcode
This specifies the Doxygen tag file that needs to be written when the html is generated
by QDoc.
\badcode
depends += \
qtcore \
qtnetwork \
qtopengl \
qtsvg \
qtqml \
qtquick \
qtwidgets \
qtdoc
\endcode
Specifies the modules QDoc needs to load for generating output for Qt GUI.
QDoc loads the index files for all modules listed in the depends statement in
order to enable linking to pages in these modules.
\badcode
headerdirs += ..
\endcode
Add the parent directory to the list of directories containing the header files
associated with the \e .cpp source files.
\badcode
sourcedirs += .. \
../../../examples/gui/doc/src
\endcode
Add the specified directories to the list of directories containing the \e .cpp and
\e .qdoc files used in the documentation.
\badcode
excludedirs = ../../../examples/gui/doc/src/tmp
\endcode
The \c excludedirs variable is for listing directories that should not be processed
by qdoc, even if the same directories are included by the \c sourcedirs or \c headerdirs
variables.
When executed, QDoc will ignore the directories listed.
\b {See also}: \l {excludefiles}.
\badcode
exampledirs += ../../../examples/gui \
snippets
\endcode
\b {See also}: \l {examples-variable}{examples}, \l {examplesinstallpath}.
Add the two directories specified to the list of directories containing the source
code of the example files.
If QDoc encounters both \c exampledirs and \c examples, it will look first in the
\c examples directory. QDoc will accept the first matching file it finds. QDoc will
search in the directories specified, not in their subdirectories.
\badcode
imagedirs += images \
../../../examples/gui/doc/images \
../../../doc/src/images \
\endcode
Add the directories specified above to the list of directories where the images
can be found.
*/

View File

@ -1,106 +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$
**
****************************************************************************/
/*
editdistance.cpp
*/
#include "editdistance.h"
QT_BEGIN_NAMESPACE
int editDistance( const QString& s, const QString& t )
{
#define D( i, j ) d[(i) * n + (j)]
int i;
int j;
int m = s.length() + 1;
int n = t.length() + 1;
int *d = new int[m * n];
int result;
for ( i = 0; i < m; i++ )
D( i, 0 ) = i;
for ( j = 0; j < n; j++ )
D( 0, j ) = j;
for ( i = 1; i < m; i++ ) {
for ( j = 1; j < n; j++ ) {
if ( s[i - 1] == t[j - 1] ) {
D( i, j ) = D( i - 1, j - 1 );
} else {
int x = D( i - 1, j );
int y = D( i - 1, j - 1 );
int z = D( i, j - 1 );
D( i, j ) = 1 + qMin( qMin(x, y), z );
}
}
}
result = D( m - 1, n - 1 );
delete[] d;
return result;
#undef D
}
QString nearestName( const QString& actual, const QSet<QString>& candidates )
{
if (actual.isEmpty())
return QString();
int deltaBest = 10000;
int numBest = 0;
QString best;
QSet<QString>::ConstIterator c = candidates.constBegin();
while ( c != candidates.constEnd() ) {
if ( (*c)[0] == actual[0] ) {
int delta = editDistance( actual, *c );
if ( delta < deltaBest ) {
deltaBest = delta;
numBest = 1;
best = *c;
} else if ( delta == deltaBest ) {
numBest++;
}
}
++c;
}
if ( numBest == 1 && deltaBest <= 2 &&
actual.length() + best.length() >= 5 ) {
return best;
} else {
return QString();
}
}
QT_END_NAMESPACE

View File

@ -1,51 +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$
**
****************************************************************************/
/*
editdistance.h
*/
#ifndef EDITDISTANCE_H
#define EDITDISTANCE_H
#include <qset.h>
#include <qstring.h>
QT_BEGIN_NAMESPACE
int editDistance( const QString& s, const QString& t );
QString nearestName( const QString& actual, const QSet<QString>& candidates );
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,260 +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 GENERATOR_H
#define GENERATOR_H
#include <qfile.h>
#include <qfileinfo.h>
#include <qlist.h>
#include <qmap.h>
#include <qregexp.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qtextstream.h>
#include "config.h"
#include "node.h"
#include "text.h"
QT_BEGIN_NAMESPACE
typedef QMultiMap<QString, Node*> NodeMultiMap;
typedef QMap<Node*, NodeMultiMap> ParentMaps;
class Config;
class CodeMarker;
class Location;
class QDocDatabase;
class Generator
{
Q_DECLARE_TR_FUNCTIONS(QDoc::Generator)
public:
enum QDocPass { Neither, Prepare, Generate };
enum ListType { Generic, Obsolete };
Generator();
virtual ~Generator();
virtual bool canHandleFormat(const QString &format) { return format == this->format(); }
virtual QString format() = 0;
virtual void generateDocs();
virtual void initializeGenerator(const Config &config);
virtual void terminateGenerator();
QString fullDocumentLocation(const Node *node, bool useSubdir = false);
const Config* config() { return config_; }
static Generator *currentGenerator() { return currentGenerator_; }
static Generator *generatorForFormat(const QString& format);
static void initialize(const Config& config);
static const QString& outputDir() { return outDir_; }
static const QString& outputSubdir() { return outSubdir_; }
static void terminate();
static const QStringList& outputFileNames() { return outFileNames_; }
static void writeOutFileNames();
static void augmentImageDirs(QSet<QString>& moreImageDirs);
static void debug(const QString& message);
static void startDebugging(const QString& message);
static void stopDebugging(const QString& message);
static bool debugging() { return debugging_; }
static bool noLinkErrors() { return noLinkErrors_; }
static bool autolinkErrors() { return autolinkErrors_; }
static void setQDocPass(QDocPass t) { qdocPass_ = t; }
static bool preparing() { return (qdocPass_ == Prepare); }
static bool generating() { return (qdocPass_ == Generate); }
static bool singleExec() { return qdocSingleExec_; }
static bool writeQaPages() { return qdocWriteQaPages_; }
static void setSingleExec() { qdocSingleExec_ = true; }
static void setWriteQaPages() { qdocWriteQaPages_ = true; }
static QString defaultModuleName() { return project_; }
static void resetUseOutputSubdirs() { useOutputSubdirs_ = false; }
static bool useOutputSubdirs() { return useOutputSubdirs_; }
static void setQmlTypeContext(QmlTypeNode* t) { qmlTypeContext_ = t; }
static QmlTypeNode* qmlTypeContext() { return qmlTypeContext_; }
static QString cleanRef(const QString& ref);
protected:
virtual void beginSubPage(const Aggregate* node, const QString& fileName);
virtual void endSubPage();
virtual QString fileBase(const Node* node) const;
virtual QString fileExtension() const = 0;
virtual void generateQAPage() { }
virtual void generateAlsoList(const Node *node, CodeMarker *marker);
virtual int generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker);
virtual void generateBody(const Node *node, CodeMarker *marker);
virtual void generateClassLikeNode(Aggregate* inner, CodeMarker* marker);
virtual void generateQmlTypePage(QmlTypeNode* , CodeMarker* ) { }
virtual void generateQmlBasicTypePage(QmlBasicTypeNode* , CodeMarker* ) { }
virtual void generateDocumentNode(DocumentNode* dn, CodeMarker* marker);
virtual void generateCollectionNode(CollectionNode* cn, CodeMarker* marker);
virtual void generateInheritedBy(const ClassNode *classe, CodeMarker *marker);
virtual void generateInherits(const ClassNode *classe, CodeMarker *marker);
virtual void generateAggregate(Aggregate* node);
virtual void generateMaintainerList(const Aggregate* node, CodeMarker* marker);
virtual void generateQmlInheritedBy(const QmlTypeNode* qcn, CodeMarker* marker);
virtual void generateQmlInherits(QmlTypeNode* qcn, CodeMarker* marker);
virtual bool generateQmlText(const Text& text,
const Node *relative,
CodeMarker *marker,
const QString& qmlName);
virtual bool generateText(const Text& text, const Node *relative, CodeMarker *marker);
virtual QString imageFileName(const Node *relative, const QString& fileBase);
virtual int skipAtoms(const Atom *atom, Atom::AtomType type) const;
virtual QString typeString(const Node *node);
static bool matchAhead(const Atom *atom, Atom::AtomType expectedAtomType);
static QString outputPrefix(const Node* node);
static QString outputSuffix(const Node* node);
static void singularPlural(Text& text, const NodeList& nodes);
static void supplementAlsoList(const Node *node, QList<Text> &alsoList);
static QString trimmedTrailing(const QString &string,
const QString &prefix,
const QString &suffix);
static QString sinceTitles[];
void initializeTextOutput();
QString fileName(const Node* node) const;
QMap<QString, QString> &formattingLeftMap();
QMap<QString, QString> &formattingRightMap();
const Atom* generateAtomList(const Atom *atom,
const Node *relative,
CodeMarker *marker,
bool generate,
int& numGeneratedAtoms);
void generateExampleFiles(const DocumentNode *dn, CodeMarker *marker);
void generateFileList(const DocumentNode* dn,
CodeMarker* marker,
Node::DocSubtype subtype,
const QString& tag);
void generateSince(const Node *node, CodeMarker *marker);
void generateStatus(const Node *node, CodeMarker *marker);
void generatePrivateSignalNote(const Node* node, CodeMarker* marker);
void generateThreadSafeness(const Node *node, CodeMarker *marker);
QString getMetadataElement(const Aggregate* inner, const QString& t);
QStringList getMetadataElements(const Aggregate* inner, const QString& t);
void generateOverloadedSignal(const Node *node, CodeMarker *marker);
QString indent(int level, const QString& markedCode);
QTextStream& out();
QString outFileName();
bool parseArg(const QString& src,
const QString& tag,
int* pos,
int n,
QStringRef* contents,
QStringRef* par1 = 0,
bool debug = false);
QString plainCode(const QString& markedCode);
void setImageFileExtensions(const QStringList& extensions);
void unknownAtom(const Atom *atom);
void appendSortedQmlNames(Text& text, const Node* base, const NodeList& subs);
QMap<QString, QStringList> editionGroupMap;
QMap<QString, QStringList> editionModuleMap;
QString naturalLanguage;
#ifndef QT_NO_TEXTCODEC
QTextCodec* outputCodec;
QString outputEncoding;
#endif
QString tagFile_;
QStack<QTextStream*> outStreamStack;
void appendFullName(Text& text,
const Node *apparentNode,
const Node *relative,
const Node *actualNode = 0);
void appendFullName(Text& text,
const Node *apparentNode,
const QString& fullName,
const Node *actualNode);
void appendFullNames(Text& text, const NodeList& nodes, const Node* relative);
void appendSortedNames(Text& text, const ClassNode *classe, const QList<RelatedClass> &classes);
private:
static Generator* currentGenerator_;
static QStringList exampleDirs;
static QStringList exampleImgExts;
static QMap<QString, QMap<QString, QString> > fmtLeftMaps;
static QMap<QString, QMap<QString, QString> > fmtRightMaps;
static QList<Generator *> generators;
static QStringList imageDirs;
static QStringList imageFiles;
static QMap<QString, QStringList> imgFileExts;
static QString project_;
static QString outDir_;
static QString outSubdir_;
static QStringList outFileNames_;
static QSet<QString> outputFormats;
static QHash<QString, QString> outputPrefixes;
static QHash<QString, QString> outputSuffixes;
static QStringList scriptDirs;
static QStringList scriptFiles;
static QStringList styleDirs;
static QStringList styleFiles;
static bool debugging_;
static bool noLinkErrors_;
static bool autolinkErrors_;
static bool redirectDocumentationToDevNull_;
static QDocPass qdocPass_;
static bool qdocSingleExec_;
static bool qdocWriteQaPages_;
static bool useOutputSubdirs_;
static QmlTypeNode* qmlTypeContext_;
void generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker);
QString amp;
QString gt;
QString lt;
QString quot;
QRegExp tag;
protected:
const Config* config_;
QDocDatabase* qdb_;
bool inLink_;
bool inContents_;
bool inSectionHeading_;
bool inTableHeader_;
bool threeColumnEnumValueTable_;
bool showInternal_;
bool singleExec_;
int numTableRows_;
QString link_;
QString sectionNumber_;
};
QT_END_NAMESPACE
#endif

View File

@ -1,858 +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 <qcryptographichash.h>
#include <qdebug.h>
#include <qhash.h>
#include <qmap.h>
#include "atom.h"
#include "helpprojectwriter.h"
#include "htmlgenerator.h"
#include "config.h"
#include "node.h"
#include "qdocdatabase.h"
#include <qdebug.h>
QT_BEGIN_NAMESPACE
HelpProjectWriter::HelpProjectWriter(const Config &config,
const QString &defaultFileName,
Generator* g)
{
reset(config, defaultFileName, g);
}
void HelpProjectWriter::reset(const Config &config,
const QString &defaultFileName,
Generator* g)
{
projects.clear();
gen_ = g;
/*
Get the pointer to the singleton for the qdoc database and
store it locally. This replaces all the local accesses to
the node tree, which are now private.
*/
qdb_ = QDocDatabase::qdocDB();
// The output directory should already have been checked by the calling
// generator.
outputDir = config.getOutputDir();
QStringList names = config.getStringList(CONFIG_QHP + Config::dot + "projects");
foreach (const QString &projectName, names) {
HelpProject project;
project.name = projectName;
QString prefix = CONFIG_QHP + Config::dot + projectName + Config::dot;
project.helpNamespace = config.getString(prefix + "namespace");
project.virtualFolder = config.getString(prefix + "virtualFolder");
project.fileName = config.getString(prefix + "file");
if (project.fileName.isEmpty())
project.fileName = defaultFileName;
project.extraFiles = config.getStringSet(prefix + "extraFiles");
project.extraFiles += config.getStringSet(CONFIG_QHP + Config::dot + "extraFiles");
project.indexTitle = config.getString(prefix + "indexTitle");
project.indexRoot = config.getString(prefix + "indexRoot");
project.filterAttributes = config.getStringList(prefix + "filterAttributes").toSet();
project.includeIndexNodes = config.getBool(prefix + "includeIndexNodes");
QSet<QString> customFilterNames = config.subVars(prefix + "customFilters");
foreach (const QString &filterName, customFilterNames) {
QString name = config.getString(prefix + "customFilters" + Config::dot + filterName + Config::dot + "name");
QSet<QString> filters = config.getStringList(prefix + "customFilters" + Config::dot + filterName + Config::dot + "filterAttributes").toSet();
project.customFilters[name] = filters;
}
//customFilters = config.defs.
foreach (QString name, config.getStringSet(prefix + "excluded"))
project.excluded.insert(name.replace(QLatin1Char('\\'), QLatin1Char('/')));
foreach (const QString &name, config.getStringList(prefix + "subprojects")) {
SubProject subproject;
QString subprefix = prefix + "subprojects" + Config::dot + name + Config::dot;
subproject.title = config.getString(subprefix + "title");
subproject.indexTitle = config.getString(subprefix + "indexTitle");
subproject.sortPages = config.getBool(subprefix + "sortPages");
subproject.type = config.getString(subprefix + "type");
readSelectors(subproject, config.getStringList(subprefix + "selectors"));
project.subprojects.append(subproject);
}
if (project.subprojects.isEmpty()) {
SubProject subproject;
readSelectors(subproject, config.getStringList(prefix + "selectors"));
project.subprojects.insert(0, subproject);
}
projects.append(project);
}
}
void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList &selectors)
{
QHash<QString, Node::NodeType> typeHash;
typeHash["namespace"] = Node::Namespace;
typeHash["class"] = Node::Class;
typeHash["doc"] = Node::Document;
typeHash["fake"] = Node::Document; // Legacy alias for 'doc'
typeHash["enum"] = Node::Enum;
typeHash["typedef"] = Node::Typedef;
typeHash["function"] = Node::Function;
typeHash["property"] = Node::Property;
typeHash["variable"] = Node::Variable;
typeHash["group"] = Node::Group;
typeHash["module"] = Node::Module;
typeHash["qmlmodule"] = Node::QmlModule;
typeHash["qmlproperty"] = Node::QmlProperty;
typeHash["qmlsignal"] = Node::QmlSignal;
typeHash["qmlsignalhandler"] = Node::QmlSignalHandler;
typeHash["qmlmethod"] = Node::QmlMethod;
typeHash["qmlpropertygroup"] = Node::QmlPropertyGroup;
typeHash["qmlclass"] = Node::QmlType; // Legacy alias for 'qmltype'
typeHash["qmltype"] = Node::QmlType;
typeHash["qmlbasictype"] = Node::QmlBasicType;
QHash<QString, Node::DocSubtype> docSubtypeHash;
docSubtypeHash["example"] = Node::Example;
docSubtypeHash["headerfile"] = Node::HeaderFile;
docSubtypeHash["file"] = Node::File;
docSubtypeHash["page"] = Node::Page;
docSubtypeHash["externalpage"] = Node::ExternalPage;
QSet<Node::DocSubtype> allSubTypes = QSet<Node::DocSubtype>::fromList(docSubtypeHash.values());
foreach (const QString &selector, selectors) {
QStringList pieces = selector.split(QLatin1Char(':'));
if (pieces.size() == 1) {
QString lower = selector.toLower();
if (typeHash.contains(lower))
subproject.selectors[typeHash[lower]] = allSubTypes;
} else if (pieces.size() >= 2) {
QString docType = pieces[0].toLower();
pieces = pieces[1].split(QLatin1Char(','));
if (typeHash.contains(docType)) {
QSet<Node::DocSubtype> docSubtypes;
for (int i = 0; i < pieces.size(); ++i) {
QString piece = pieces[i].toLower();
if (typeHash[docType] == Node::Group) {
subproject.groups << piece;
continue;
}
if (docSubtypeHash.contains(piece))
docSubtypes.insert(docSubtypeHash[piece]);
}
subproject.selectors[typeHash[docType]] = docSubtypes;
}
}
}
}
void HelpProjectWriter::addExtraFile(const QString &file)
{
for (int i = 0; i < projects.size(); ++i)
projects[i].extraFiles.insert(file);
}
void HelpProjectWriter::addExtraFiles(const QSet<QString> &files)
{
for (int i = 0; i < projects.size(); ++i)
projects[i].extraFiles.unite(files);
}
/*
Returns a list of strings describing the keyword details for a given node.
The first string is the human-readable name to be shown in Assistant.
The second string is a unique identifier.
The third string is the location of the documentation for the keyword.
*/
QStringList HelpProjectWriter::keywordDetails(const Node *node) const
{
QStringList details;
if (node->parent() && !node->parent()->name().isEmpty()) {
// "name"
if (node->type() == Node::Enum || node->type() == Node::Typedef)
details << node->parent()->name()+"::"+node->name();
else
details << node->name();
// "id"
details << node->parent()->name()+"::"+node->name();
}
else if (node->isQmlType() || node->isQmlBasicType()) {
details << node->name();
details << "QML." + node->name();
}
else if (node->isJsType() || node->isJsBasicType()) {
details << node->name();
details << "JS." + node->name();
}
else if (node->isDocumentNode()) {
const DocumentNode *fake = static_cast<const DocumentNode *>(node);
details << fake->fullTitle();
details << fake->fullTitle();
}
else {
details << node->name();
details << node->name();
}
details << gen_->fullDocumentLocation(node, false);
return details;
}
bool HelpProjectWriter::generateSection(HelpProject &project,
QXmlStreamWriter & /* writer */,
const Node *node)
{
if (!node->url().isEmpty() && !(project.includeIndexNodes && !node->url().startsWith("http")))
return false;
if (node->access() == Node::Private || node->status() == Node::Internal)
return false;
if (node->name().isEmpty())
return true;
QString docPath = node->doc().location().filePath();
if (!docPath.isEmpty() && project.excluded.contains(docPath))
return false;
QString objName = node->isDocumentNode() ? node->fullTitle() : node->fullDocumentName();
// Only add nodes to the set for each subproject if they match a selector.
// Those that match will be listed in the table of contents.
for (int i = 0; i < project.subprojects.length(); i++) {
SubProject subproject = project.subprojects[i];
// No selectors: accept all nodes.
if (subproject.selectors.isEmpty()) {
project.subprojects[i].nodes[objName] = node;
}
else if (subproject.selectors.contains(node->type())) {
// Add all group members for 'group:name' selector
if (node->isGroup()) {
if (project.subprojects[i].groups.contains(node->name())) {
const CollectionNode* cn = static_cast<const CollectionNode*>(node);
foreach (const Node* m, cn->members()) {
QString memberName = m->isDocumentNode()
? m->fullTitle() : m->fullDocumentName();
project.subprojects[i].nodes[memberName] = m;
}
}
}
// Accept only the node types in the selectors hash.
else if (node->type() != Node::Document)
project.subprojects[i].nodes[objName] = node;
else {
// Accept only doc nodes with subtypes contained in the selector's
// mask.
const DocumentNode *docNode = static_cast<const DocumentNode *>(node);
if (subproject.selectors[node->type()].contains(docNode->docSubtype()) &&
docNode->docSubtype() != Node::ExternalPage &&
!docNode->fullTitle().isEmpty()) {
project.subprojects[i].nodes[objName] = node;
}
}
}
}
switch (node->type()) {
case Node::Class:
project.keywords.append(keywordDetails(node));
break;
case Node::QmlType:
case Node::QmlBasicType:
if (node->doc().hasKeywords()) {
foreach (const Atom* keyword, node->doc().keywords()) {
if (!keyword->string().isEmpty()) {
QStringList details;
details << keyword->string()
<< keyword->string()
<< gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
}
else
node->doc().location().warning(tr("Bad keyword in %1").arg(gen_->fullDocumentLocation(node, false)));
}
}
project.keywords.append(keywordDetails(node));
break;
case Node::Namespace:
project.keywords.append(keywordDetails(node));
break;
case Node::Enum:
project.keywords.append(keywordDetails(node));
{
const EnumNode *enumNode = static_cast<const EnumNode*>(node);
foreach (const EnumItem &item, enumNode->items()) {
QStringList details;
if (enumNode->itemAccess(item.name()) == Node::Private)
continue;
if (!node->parent()->name().isEmpty()) {
details << node->parent()->name()+"::"+item.name(); // "name"
details << node->parent()->name()+"::"+item.name(); // "id"
} else {
details << item.name(); // "name"
details << item.name(); // "id"
}
details << gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
}
}
break;
case Node::Group:
case Node::Module:
case Node::QmlModule:
{
const CollectionNode* cn = static_cast<const CollectionNode*>(node);
if (!cn->fullTitle().isEmpty()) {
if (cn->doc().hasKeywords()) {
foreach (const Atom* keyword, cn->doc().keywords()) {
if (!keyword->string().isEmpty()) {
QStringList details;
details << keyword->string()
<< keyword->string()
<< gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
}
else
cn->doc().location().warning(
tr("Bad keyword in %1").arg(gen_->fullDocumentLocation(node, false))
);
}
}
project.keywords.append(keywordDetails(node));
}
}
break;
case Node::Property:
case Node::QmlProperty:
case Node::QmlSignal:
case Node::QmlSignalHandler:
case Node::QmlMethod:
project.keywords.append(keywordDetails(node));
break;
case Node::Function:
{
const FunctionNode *funcNode = static_cast<const FunctionNode *>(node);
// Only insert keywords for non-constructors. Constructors are covered
// by the classes themselves.
if (funcNode->metaness() != FunctionNode::Ctor)
project.keywords.append(keywordDetails(node));
// Insert member status flags into the entries for the parent
// node of the function, or the node it is related to.
// Since parent nodes should have already been inserted into
// the set of files, we only need to ensure that related nodes
// are inserted.
if (node->relates()) {
project.memberStatus[node->relates()].insert(node->status());
} else if (node->parent())
project.memberStatus[node->parent()].insert(node->status());
}
break;
case Node::Typedef:
{
const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
QStringList typedefDetails = keywordDetails(node);
const EnumNode *enumNode = typedefNode->associatedEnum();
// Use the location of any associated enum node in preference
// to that of the typedef.
if (enumNode)
typedefDetails[2] = gen_->fullDocumentLocation(enumNode, false);
project.keywords.append(typedefDetails);
}
break;
case Node::Variable:
{
project.keywords.append(keywordDetails(node));
}
break;
// Document nodes (such as manual pages) contain subtypes, titles and other
// attributes.
case Node::Document: {
const DocumentNode *docNode = static_cast<const DocumentNode*>(node);
if (docNode->docSubtype() != Node::ExternalPage &&
docNode->docSubtype() != Node::Image &&
!docNode->fullTitle().isEmpty()) {
if (docNode->docSubtype() != Node::File) {
if (docNode->doc().hasKeywords()) {
foreach (const Atom *keyword, docNode->doc().keywords()) {
if (!keyword->string().isEmpty()) {
QStringList details;
details << keyword->string()
<< keyword->string()
<< gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
} else
docNode->doc().location().warning(
tr("Bad keyword in %1").arg(gen_->fullDocumentLocation(node, false))
);
}
}
project.keywords.append(keywordDetails(node));
}
}
break;
}
default:
;
}
// Add all images referenced in the page to the set of files to include.
const Atom *atom = node->doc().body().firstAtom();
while (atom) {
if (atom->type() == Atom::Image || atom->type() == Atom::InlineImage) {
// Images are all placed within a single directory regardless of
// whether the source images are in a nested directory structure.
QStringList pieces = atom->string().split(QLatin1Char('/'));
project.files.insert("images/" + pieces.last());
}
atom = atom->next();
}
return true;
}
void HelpProjectWriter::generateSections(HelpProject &project,
QXmlStreamWriter &writer, const Node *node)
{
/*
Don't include index nodes in the help file. Or DITA map nodes.
*/
if (node->isIndexNode() || node->docSubtype() == Node::DitaMap)
return;
if (!generateSection(project, writer, node))
return;
if (node->isAggregate()) {
const Aggregate *inner = static_cast<const Aggregate *>(node);
// Ensure that we don't visit nodes more than once.
QMap<QString, const Node*> childMap;
foreach (const Node *childNode, inner->childNodes()) {
if (childNode->isIndexNode())
continue;
if (childNode->access() == Node::Private)
continue;
if (childNode->type() == Node::Document) {
childMap[static_cast<const DocumentNode *>(childNode)->fullTitle()] = childNode;
}
else if (childNode->isQmlPropertyGroup() || childNode->isJsPropertyGroup()) {
/*
Don't visit QML/JS property group nodes,
but visit their children, which are all
QML/JS property nodes.
This is probably not correct anymore,
because The Qml/Js Property Group is
an actual documented thing.
*/
const Aggregate* inner = static_cast<const Aggregate*>(childNode);
foreach (const Node* n, inner->childNodes()) {
if (n->access() == Node::Private)
continue;
childMap[n->fullDocumentName()] = n;
}
}
else {
// Store member status of children
project.memberStatus[node].insert(childNode->status());
if (childNode->relates()) {
project.memberStatus[childNode->relates()].insert(childNode->status());
}
if (childNode->type() == Node::Function) {
const FunctionNode *funcNode = static_cast<const FunctionNode *>(childNode);
if (funcNode->isOverload())
continue;
}
childMap[childNode->fullDocumentName()] = childNode;
}
}
foreach (const Node *child, childMap)
generateSections(project, writer, child);
}
}
void HelpProjectWriter::generate()
{
for (int i = 0; i < projects.size(); ++i)
generateProject(projects[i]);
}
void HelpProjectWriter::writeHashFile(QFile &file)
{
QCryptographicHash hash(QCryptographicHash::Sha1);
hash.addData(&file);
QFile hashFile(file.fileName() + ".sha1");
if (!hashFile.open(QFile::WriteOnly | QFile::Text))
return;
hashFile.write(hash.result().toHex());
hashFile.close();
}
void HelpProjectWriter::writeSection(QXmlStreamWriter &writer, const QString &path,
const QString &value)
{
writer.writeStartElement(QStringLiteral("section"));
writer.writeAttribute(QStringLiteral("ref"), path);
writer.writeAttribute(QStringLiteral("title"), value);
writer.writeEndElement(); // section
}
/*
Write subsections for all members, compatibility members and obsolete members.
*/
void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &writer,
const Node *node)
{
QString href = gen_->fullDocumentLocation(node, false);
href = href.left(href.size()-5);
if (href.isEmpty())
return;
bool derivedClass = false;
if (node->type() == Node::Class)
derivedClass = !(static_cast<const ClassNode *>(node)->baseClasses().isEmpty());
// Do not generate a 'List of all members' for namespaces or header files,
// but always generate it for derived classes and QML classes
if (!node->isNamespace() && !node->isHeaderFile() &&
(derivedClass || node->isQmlType() || node->isJsType() ||
!project.memberStatus[node].isEmpty())) {
QString membersPath = href + QStringLiteral("-members.html");
writeSection(writer, membersPath, tr("List of all members"));
}
if (project.memberStatus[node].contains(Node::Compat)) {
QString compatPath = href + QStringLiteral("-compat.html");
writeSection(writer, compatPath, tr("Compatibility members"));
}
if (project.memberStatus[node].contains(Node::Obsolete)) {
QString obsoletePath = href + QStringLiteral("-obsolete.html");
writeSection(writer, obsoletePath, tr("Obsolete members"));
}
}
void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer,
const Node *node)
{
QString href = gen_->fullDocumentLocation(node, false);
QString objName = node->name();
switch (node->type()) {
case Node::Class:
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
if (node->parent() && !node->parent()->name().isEmpty())
writer.writeAttribute("title", tr("%1::%2 Class Reference").arg(node->parent()->name()).arg(objName));
else
writer.writeAttribute("title", tr("%1 Class Reference").arg(objName));
addMembers(project, writer, node);
writer.writeEndElement(); // section
break;
case Node::Namespace:
writeSection(writer, href, objName);
break;
case Node::QmlType:
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
writer.writeAttribute("title", tr("%1 Type Reference").arg(node->fullTitle()));
addMembers(project, writer, node);
writer.writeEndElement(); // section
break;
case Node::Document: {
// Document nodes (such as manual pages) contain subtypes, titles and other
// attributes.
const DocumentNode *docNode = static_cast<const DocumentNode*>(node);
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
writer.writeAttribute("title", docNode->fullTitle());
if (docNode->docSubtype() == Node::HeaderFile)
addMembers(project, writer, node);
writer.writeEndElement(); // section
}
break;
case Node::Group:
case Node::Module:
case Node::QmlModule:
{
const CollectionNode* cn = static_cast<const CollectionNode*>(node);
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
writer.writeAttribute("title", cn->fullTitle());
writer.writeEndElement(); // section
}
break;
default:
;
}
}
void HelpProjectWriter::generateProject(HelpProject &project)
{
const Node *rootNode;
// Restrict searching only to the local (primary) tree
QVector<Tree*> searchOrder = qdb_->searchOrder();
qdb_->setLocalSearch();
if (!project.indexRoot.isEmpty())
rootNode = qdb_->findDocumentNodeByTitle(project.indexRoot);
else
rootNode = qdb_->primaryTreeRoot();
if (!rootNode)
return;
project.files.clear();
project.keywords.clear();
QFile file(outputDir + QDir::separator() + project.fileName);
if (!file.open(QFile::WriteOnly | QFile::Text))
return;
QXmlStreamWriter writer(&file);
writer.setAutoFormatting(true);
writer.writeStartDocument();
writer.writeStartElement("QtHelpProject");
writer.writeAttribute("version", "1.0");
// Write metaData, virtualFolder and namespace elements.
writer.writeTextElement("namespace", project.helpNamespace);
writer.writeTextElement("virtualFolder", project.virtualFolder);
// Write customFilter elements.
QHash<QString, QSet<QString> >::ConstIterator it;
for (it = project.customFilters.constBegin(); it != project.customFilters.constEnd(); ++it) {
writer.writeStartElement("customFilter");
writer.writeAttribute("name", it.key());
foreach (const QString &filter, it.value())
writer.writeTextElement("filterAttribute", filter);
writer.writeEndElement(); // customFilter
}
// Start the filterSection.
writer.writeStartElement("filterSection");
// Write filterAttribute elements.
foreach (const QString &filterName, project.filterAttributes)
writer.writeTextElement("filterAttribute", filterName);
writer.writeStartElement("toc");
writer.writeStartElement("section");
const Node* node = qdb_->findDocumentNodeByTitle(project.indexTitle);
if (node == 0)
node = qdb_->findNodeByNameAndType(QStringList("index.html"), Node::Document);
QString indexPath;
if (node)
indexPath = gen_->fullDocumentLocation(node, false);
else
indexPath = "index.html";
writer.writeAttribute("ref", indexPath);
writer.writeAttribute("title", project.indexTitle);
generateSections(project, writer, rootNode);
for (int i = 0; i < project.subprojects.length(); i++) {
SubProject subproject = project.subprojects[i];
if (subproject.type == QLatin1String("manual")) {
const Node *indexPage = qdb_->findNodeForTarget(subproject.indexTitle, 0);
if (indexPage) {
Text indexBody = indexPage->doc().body();
const Atom *atom = indexBody.firstAtom();
QStack<int> sectionStack;
bool inItem = false;
while (atom) {
switch (atom->type()) {
case Atom::ListLeft:
sectionStack.push(0);
break;
case Atom::ListRight:
if (sectionStack.pop() > 0)
writer.writeEndElement(); // section
break;
case Atom::ListItemLeft:
inItem = true;
break;
case Atom::ListItemRight:
inItem = false;
break;
case Atom::Link:
if (inItem) {
if (sectionStack.top() > 0)
writer.writeEndElement(); // section
const Node *page = qdb_->findNodeForTarget(atom->string(), 0);
writer.writeStartElement("section");
QString indexPath = gen_->fullDocumentLocation(page, false);
writer.writeAttribute("ref", indexPath);
writer.writeAttribute("title", atom->string());
sectionStack.top() += 1;
}
break;
default:
;
}
if (atom == indexBody.lastAtom())
break;
atom = atom->next();
}
} else
rootNode->doc().location().warning(
tr("Failed to find index: %1").arg(subproject.indexTitle)
);
} else {
writer.writeStartElement("section");
QString indexPath = gen_->fullDocumentLocation(qdb_->findNodeForTarget(subproject.indexTitle, 0),
false);
writer.writeAttribute("ref", indexPath);
writer.writeAttribute("title", subproject.title);
if (subproject.sortPages) {
QStringList titles = subproject.nodes.keys();
titles.sort();
foreach (const QString &title, titles) {
writeNode(project, writer, subproject.nodes[title]);
}
} else {
// Find a contents node and navigate from there, using the NextLink values.
QSet<QString> visited;
bool contentsFound = false;
foreach (const Node *node, subproject.nodes) {
QString nextTitle = node->links().value(Node::NextLink).first;
if (!nextTitle.isEmpty() &&
node->links().value(Node::ContentsLink).first.isEmpty()) {
const Node *nextPage = qdb_->findNodeForTarget(nextTitle, 0);
// Write the contents node.
writeNode(project, writer, node);
contentsFound = true;
while (nextPage) {
writeNode(project, writer, nextPage);
nextTitle = nextPage->links().value(Node::NextLink).first;
if (nextTitle.isEmpty() || visited.contains(nextTitle))
break;
nextPage = qdb_->findNodeForTarget(nextTitle, 0);
visited.insert(nextTitle);
}
break;
}
}
// No contents/nextpage links found, write all nodes unsorted
if (!contentsFound) {
foreach (const Node *node, subproject.nodes)
writeNode(project, writer, node);
}
}
writer.writeEndElement(); // section
}
}
// Restore original search order
qdb_->setSearchOrder(searchOrder);
writer.writeEndElement(); // section
writer.writeEndElement(); // toc
writer.writeStartElement("keywords");
foreach (const QStringList &details, project.keywords) {
writer.writeStartElement("keyword");
writer.writeAttribute("name", details[0]);
writer.writeAttribute("id", details[1]);
writer.writeAttribute("ref", details[2]);
writer.writeEndElement(); //keyword
}
writer.writeEndElement(); // keywords
writer.writeStartElement("files");
// The list of files to write is the union of generated files and
// other files (images and extras) included in the project
QSet<QString> files = QSet<QString>::fromList(gen_->outputFileNames());
files.unite(project.files);
files.unite(project.extraFiles);
foreach (const QString &usedFile, files) {
if (!usedFile.isEmpty())
writer.writeTextElement("file", usedFile);
}
writer.writeEndElement(); // files
writer.writeEndElement(); // filterSection
writer.writeEndElement(); // QtHelpProject
writer.writeEndDocument();
writeHashFile(file);
file.close();
}
QT_END_NAMESPACE

View File

@ -1,118 +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 HELPPROJECTWRITER_H
#define HELPPROJECTWRITER_H
#include <qstring.h>
#include <qxmlstream.h>
#include "config.h"
#include "node.h"
QT_BEGIN_NAMESPACE
class QDocDatabase;
class Generator;
typedef QPair<QString, const Node*> QStringNodePair;
struct SubProject
{
QString title;
QString indexTitle;
QHash<Node::NodeType, QSet<DocumentNode::DocSubtype> > selectors;
bool sortPages;
QString type;
QHash<QString, const Node *> nodes;
QStringList groups;
};
struct HelpProject
{
QString name;
QString helpNamespace;
QString virtualFolder;
QString fileName;
QString indexRoot;
QString indexTitle;
QList<QStringList> keywords;
QSet<QString> files;
QSet<QString> extraFiles;
QSet<QString> filterAttributes;
QHash<QString, QSet<QString> > customFilters;
QSet<QString> excluded;
QList<SubProject> subprojects;
QHash<const Node *, QSet<Node::Status> > memberStatus;
bool includeIndexNodes;
};
class HelpProjectWriter
{
Q_DECLARE_TR_FUNCTIONS(QDoc::HelpProjectWriter)
public:
HelpProjectWriter(const Config &config,
const QString &defaultFileName,
Generator* g);
void reset(const Config &config,
const QString &defaultFileName,
Generator* g);
void addExtraFile(const QString &file);
void addExtraFiles(const QSet<QString> &files);
void generate();
private:
void generateProject(HelpProject &project);
void generateSections(HelpProject &project, QXmlStreamWriter &writer,
const Node *node);
bool generateSection(HelpProject &project, QXmlStreamWriter &writer,
const Node *node);
QStringList keywordDetails(const Node *node) const;
void writeHashFile(QFile &file);
void writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
void readSelectors(SubProject &subproject, const QStringList &selectors);
void addMembers(HelpProject &project, QXmlStreamWriter &writer,
const Node *node);
void writeSection(QXmlStreamWriter &writer, const QString &path,
const QString &value);
QDocDatabase* qdb_;
Generator* gen_;
QString outputDir;
QList<HelpProject> projects;
};
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,292 +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$
**
****************************************************************************/
/*
htmlgenerator.h
*/
#ifndef HTMLGENERATOR_H
#define HTMLGENERATOR_H
#include <qhash.h>
#include <qregexp.h>
#include <qxmlstream.h>
#include "codemarker.h"
#include "config.h"
#include "generator.h"
QT_BEGIN_NAMESPACE
class HelpProjectWriter;
class HtmlGenerator : public Generator
{
Q_DECLARE_TR_FUNCTIONS(QDoc::HtmlGenerator)
public:
enum SinceType {
Namespace,
Class,
MemberFunction,
NamespaceFunction,
GlobalFunction,
Macro,
Enum,
Typedef,
Property,
Variable,
QmlClass,
QmlProperty,
QmlSignal,
QmlSignalHandler,
QmlMethod,
LastSinceType
};
public:
HtmlGenerator();
~HtmlGenerator();
virtual void initializeGenerator(const Config& config) Q_DECL_OVERRIDE;
virtual void terminateGenerator() Q_DECL_OVERRIDE;
virtual QString format() Q_DECL_OVERRIDE;
virtual void generateDocs() Q_DECL_OVERRIDE;
void generateManifestFiles();
QString protectEnc(const QString &string);
static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
static QString sinceTitle(int i) { return sinceTitles[i]; }
protected:
virtual void generateQAPage() Q_DECL_OVERRIDE;
QString generateLinksToLinksPage(const QString& module, CodeMarker* marker);
QString generateLinksToBrokenLinksPage(CodeMarker* marker, int& count);
virtual int generateAtom(const Atom *atom,
const Node *relative,
CodeMarker *marker) Q_DECL_OVERRIDE;
virtual void generateClassLikeNode(Aggregate* inner, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual void generateQmlTypePage(QmlTypeNode* qcn, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual void generateQmlBasicTypePage(QmlBasicTypeNode* qbtn, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual void generateDocumentNode(DocumentNode* dn, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual void generateCollectionNode(CollectionNode* cn, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual QString fileExtension() const Q_DECL_OVERRIDE;
virtual QString refForNode(const Node *node);
virtual QString linkForNode(const Node *node, const Node *relative);
void generateManifestFile(const QString &manifest, const QString &element);
void readManifestMetaContent(const Config &config);
void generateKeywordAnchors(const Node* node);
void generateAssociatedPropertyNotes(const FunctionNode* fn);
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
enum ExtractionMarkType {
BriefMark,
DetailedDescriptionMark,
MemberMark,
EndMark
};
struct ManifestMetaFilter
{
QSet<QString> names;
QSet<QString> attributes;
QSet<QString> tags;
};
const QPair<QString,QString> anchorForNode(const Node *node);
void generateNavigationBar(const QString &title,
const Node *node,
CodeMarker *marker,
const QString &buildversion,
bool tableItems = false);
void generateHeader(const QString& title,
const Node *node = 0,
CodeMarker *marker = 0);
void generateTitle(const QString& title,
const Text &subTitle,
SubTitleSize subTitleSize,
const Node *relative,
CodeMarker *marker);
void generateFooter(const Node *node = 0);
void generateRequisites(Aggregate *inner,
CodeMarker *marker);
void generateQmlRequisites(QmlTypeNode *qcn,
CodeMarker *marker);
void generateBrief(const Node *node,
CodeMarker *marker,
const Node *relative = 0);
void generateIncludes(const Aggregate *inner, CodeMarker *marker);
void generateTableOfContents(const Node *node,
CodeMarker *marker,
QList<Section>* sections = 0);
void generateSidebar();
QString generateListOfAllMemberFile(const Aggregate *inner,
CodeMarker *marker);
QString generateAllQmlMembersFile(QmlTypeNode* qml_cn, CodeMarker* marker);
QString generateLowStatusMemberFile(Aggregate *inner,
CodeMarker *marker,
CodeMarker::Status status);
QString generateQmlMemberFile(QmlTypeNode* qcn,
CodeMarker *marker,
CodeMarker::Status status);
void generateClassHierarchy(const Node *relative, NodeMap &classMap);
void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMultiMap& nodeMap);
void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeList& nodes);
void generateCompactList(ListType listType,
const Node *relative,
const NodeMultiMap &classMap,
bool includeAlphabet,
QString commonPrefix);
void generateFunctionIndex(const Node *relative);
void generateLegaleseList(const Node *relative, CodeMarker *marker);
void generateList(const Node* relative, CodeMarker* marker, const QString& selector);
void generateSectionList(const Section& section,
const Node *relative,
CodeMarker *marker,
CodeMarker::SynopsisStyle style);
void generateQmlSummary(const Section& section,
const Node *relative,
CodeMarker *marker);
void generateQmlItem(const Node *node,
const Node *relative,
CodeMarker *marker,
bool summary);
void generateDetailedQmlMember(Node *node,
const Aggregate *relative,
CodeMarker *marker);
void generateQmlInherits(QmlTypeNode* qcn, CodeMarker* marker) Q_DECL_OVERRIDE;
void generateQmlInstantiates(QmlTypeNode* qcn, CodeMarker* marker);
void generateInstantiatedBy(ClassNode* cn, CodeMarker* marker);
void generateSection(const NodeList& nl,
const Node *relative,
CodeMarker *marker,
CodeMarker::SynopsisStyle style);
void generateSynopsis(const Node *node,
const Node *relative,
CodeMarker *marker,
CodeMarker::SynopsisStyle style,
bool alignNames = false,
const QString* prefix = 0);
void generateSectionInheritedList(const Section& section, const Node *relative);
QString highlightedCode(const QString& markedCode,
const Node* relative,
bool alignNames = false);
void generateFullName(const Node *apparentNode, const Node *relative, const Node *actualNode = 0);
void generateDetailedMember(const Node *node,
const Aggregate *relative,
CodeMarker *marker);
void generateLink(const Atom *atom, CodeMarker *marker);
void generateStatus(const Node *node, CodeMarker *marker);
QString getLink(const Atom *atom, const Node *relative, const Node** node);
QString getAutoLink(const Atom *atom, const Node *relative, const Node** node);
QString registerRef(const QString& ref);
virtual QString fileBase(const Node *node) const Q_DECL_OVERRIDE;
QString fileName(const Node *node);
static int hOffset(const Node *node);
static bool isThreeColumnEnumValueTable(const Atom *atom);
#ifdef GENERATE_MAC_REFS
void generateMacRef(const Node *node, CodeMarker *marker);
#endif
void beginLink(const QString &link, const Node *node, const Node *relative);
void endLink();
void generateExtractionMark(const Node *node, ExtractionMarkType markType);
void reportOrphans(const Aggregate* parent);
void beginDitamapPage(const Aggregate* node, const QString& fileName);
void endDitamapPage();
void writeDitaMap(const DitaMapNode* node);
void writeDitaRefs(const DitaRefList& ditarefs);
QXmlStreamWriter& xmlWriter();
QHash<QString, QString> refMap;
int codeIndent;
QString codePrefix;
QString codeSuffix;
HelpProjectWriter *helpProjectWriter;
bool inObsoleteLink;
QRegExp funcLeftParen;
QString style;
QString headerScripts;
QString headerStyles;
QString endHeader;
QString postHeader;
QString postPostHeader;
QString prologue;
QString footer;
QString address;
bool pleaseGenerateMacRef;
bool noNavigationBar;
QString project;
QString projectDescription;
QString projectUrl;
QString navigationLinks;
QString manifestDir;
QString examplesPath;
QStringList stylesheets;
QStringList customHeadElements;
bool obsoleteLinks;
QStack<QXmlStreamWriter*> xmlWriterStack;
static int id;
QList<ManifestMetaFilter> manifestMetaContent;
QString homepage;
QString landingpage;
QString cppclassespage;
QString qmltypespage;
QString buildversion;
QString qflagsHref_;
int tocDepth;
public:
static bool debugging_on;
static QString divNavTop;
};
#define HTMLGENERATOR_ADDRESS "address"
#define HTMLGENERATOR_FOOTER "footer"
#define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me
#define HTMLGENERATOR_POSTHEADER "postheader"
#define HTMLGENERATOR_POSTPOSTHEADER "postpostheader"
#define HTMLGENERATOR_PROLOGUE "prologue"
#define HTMLGENERATOR_NONAVIGATIONBAR "nonavigationbar"
#define HTMLGENERATOR_NOSUBDIRS "nosubdirs"
#define HTMLGENERATOR_TOCDEPTH "tocdepth"
QT_END_NAMESPACE
#endif

View File

@ -1,141 +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$
**
****************************************************************************/
/*
jscodemarker.cpp
*/
#include "qqmljsast_p.h"
#include "qqmljsengine_p.h"
#include "qqmljslexer_p.h"
#include "qqmljsparser_p.h"
#include "atom.h"
#include "node.h"
#include "jscodemarker.h"
#include "qmlmarkupvisitor.h"
#include "text.h"
#include "tree.h"
#include "generator.h"
QT_BEGIN_NAMESPACE
JsCodeMarker::JsCodeMarker()
{
}
JsCodeMarker::~JsCodeMarker()
{
}
/*!
Returns \c true if the \a code is recognized by the parser.
*/
bool JsCodeMarker::recognizeCode(const QString &code)
{
QQmlJS::Engine engine;
QQmlJS::Lexer lexer(&engine);
QQmlJS::Parser parser(&engine);
QString newCode = code;
QVector<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
lexer.setCode(newCode, 1);
return parser.parseProgram();
}
/*!
Returns \c true if \a ext is any of a list of file extensions
for the QML language.
*/
bool JsCodeMarker::recognizeExtension(const QString &ext)
{
return ext == "js" || ext == "json";
}
/*!
Returns \c true if the \a language is recognized. We recognize JavaScript,
ECMAScript and JSON.
*/
bool JsCodeMarker::recognizeLanguage(const QString &language)
{
return language == "JavaScript" || language == "ECMAScript" || language == "JSON";
}
/*!
Returns the type of atom used to represent JavaScript code in the documentation.
*/
Atom::AtomType JsCodeMarker::atomType() const
{
return Atom::JavaScript;
}
QString JsCodeMarker::markedUpCode(const QString &code,
const Node *relative,
const Location &location)
{
return addMarkUp(code, relative, location);
}
QString JsCodeMarker::addMarkUp(const QString &code,
const Node * /* relative */,
const Location &location)
{
QQmlJS::Engine engine;
QQmlJS::Lexer lexer(&engine);
QString newCode = code;
QVector<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
lexer.setCode(newCode, 1);
QQmlJS::Parser parser(&engine);
QString output;
if (parser.parseProgram()) {
QQmlJS::AST::Node *ast = parser.rootNode();
// Pass the unmodified code to the visitor so that pragmas and other
// unhandled source text can be output.
QmlMarkupVisitor visitor(code, pragmas, &engine);
QQmlJS::AST::Node::accept(ast, &visitor);
output = visitor.markedUpCode();
} else {
location.warning(location.fileName() +
tr("Unable to parse JavaScript: \"%1\" at line %2, column %3").arg(
parser.errorMessage()).arg(parser.errorLineNumber()).arg(
parser.errorColumnNumber()));
output = protect(code);
}
return output;
}
QT_END_NAMESPACE

View File

@ -1,69 +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$
**
****************************************************************************/
/*
jscodemarker.h
*/
#ifndef JSCODEMARKER_H
#define JSCODEMARKER_H
#include "qmlcodemarker.h"
QT_BEGIN_NAMESPACE
class JsCodeMarker : public QmlCodeMarker
{
Q_DECLARE_TR_FUNCTIONS(QDoc::JsCodeMarker)
public:
JsCodeMarker();
~JsCodeMarker();
virtual bool recognizeCode(const QString &code) Q_DECL_OVERRIDE;
virtual bool recognizeExtension(const QString &ext) Q_DECL_OVERRIDE;
virtual bool recognizeLanguage(const QString &language) 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;
private:
QString addMarkUp(const QString &code, const Node *relative,
const Location &location);
};
QT_END_NAMESPACE
#endif

View File

@ -1,448 +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 <qdebug.h>
#include "config.h"
#include "location.h"
#include "generator.h"
#include <qdir.h>
#include <qregexp.h>
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
QT_BEGIN_NAMESPACE
const Location Location::null;
int Location::tabSize;
QString Location::programName;
QRegExp *Location::spuriousRegExp = 0;
bool Location::logProgress_ = false;
/*!
\class Location
\brief The Location class provides a way to mark a location in a file.
It maintains a stack of file positions. A file position
consists of the file path, line number, and column number.
The location is used for printing error messages that are
tied to a location in a file.
*/
/*!
Constructs an empty location.
*/
Location::Location()
: stk(0), stkTop(&stkBottom), stkDepth(0), etcetera(false)
{
// nothing.
}
/*!
Constructs a location with (fileName, 1, 1) on its file
position stack.
*/
Location::Location(const QString& fileName)
: stk(0), stkTop(&stkBottom), stkDepth(0), etcetera(false)
{
push(fileName);
}
/*!
The copy constructor copies the contents of \a other into
this Location using the assignment operator.
*/
Location::Location(const Location& other)
: stk(0), stkTop(&stkBottom), stkDepth(0), etcetera(false)
{
*this = other;
}
/*!
The assignment operator does a deep copy of the entire
state of \a other into this Location.
*/
Location& Location::operator=(const Location& other)
{
QStack<StackEntry> *oldStk = stk;
stkBottom = other.stkBottom;
if (other.stk == 0) {
stk = 0;
stkTop = &stkBottom;
}
else {
stk = new QStack<StackEntry>(*other.stk);
stkTop = &stk->top();
}
stkDepth = other.stkDepth;
etcetera = other.etcetera;
delete oldStk;
return *this;
}
/*!
If the file position on top of the stack has a line number
less than 1, set its line number to 1 and its column number
to 1. Otherwise, do nothing.
*/
void Location::start()
{
if (stkTop->lineNo < 1) {
stkTop->lineNo = 1;
stkTop->columnNo = 1;
}
}
/*!
Advance the current file position, using \a ch to decide how to do
that. If \a ch is a \c{'\\n'}, increment the current line number and
set the column number to 1. If \ch is a \c{'\\t'}, increment to the
next tab column. Otherwise, increment the column number by 1.
The current file position is the one on top of the position stack.
*/
void Location::advance(QChar ch)
{
if (ch == QLatin1Char('\n')) {
stkTop->lineNo++;
stkTop->columnNo = 1;
}
else if (ch == QLatin1Char('\t')) {
stkTop->columnNo =
1 + tabSize * (stkTop->columnNo + tabSize-1) / tabSize;
}
else {
stkTop->columnNo++;
}
}
/*!
Pushes \a filePath onto the file position stack. The current
file position becomes (\a filePath, 1, 1).
\sa pop()
*/
void Location::push(const QString& filePath)
{
if (stkDepth++ >= 1) {
if (stk == 0)
stk = new QStack<StackEntry>;
stk->push(StackEntry());
stkTop = &stk->top();
}
stkTop->filePath = filePath;
stkTop->lineNo = INT_MIN;
stkTop->columnNo = 1;
}
/*!
Pops the top of the internal stack. The current file position
becomes the next one in the new top of stack.
\sa push()
*/
void Location::pop()
{
if (--stkDepth == 0) {
stkBottom = StackEntry();
}
else {
stk->pop();
if (stk->isEmpty()) {
delete stk;
stk = 0;
stkTop = &stkBottom;
}
else {
stkTop = &stk->top();
}
}
}
/*! \fn bool Location::isEmpty() const
Returns \c true if there is no file name set yet; returns \c false
otherwise. The functions filePath(), lineNo() and columnNo()
must not be called on an empty Location object.
*/
/*! \fn const QString& Location::filePath() const
Returns the current path and file name. If the Location is
empty, the returned string is null.
\sa lineNo(), columnNo()
*/
/*!
Returns the file name part of the file path, ie the current
file. Returns an empty string if the file path is empty.
*/
QString Location::fileName() const
{
QString fp = filePath();
return (fp.isEmpty() ? fp : fp.mid(fp.lastIndexOf('/') + 1));
}
/*!
Returns the suffix of the file name. Returns an empty string
if the file path is empty.
*/
QString Location::fileSuffix() const
{
QString fp = filePath();
return (fp.isEmpty() ? fp : fp.mid(fp.lastIndexOf('.') + 1));
}
/*!
\brief Returns \a path which is canonicalized and relative to the config file.
QDir::relativeFilePath does not canonicalize the paths, so
if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf
and it has a reference to any ancestor folder (e.g. ".." or even "../doc")
*/
QString Location::canonicalRelativePath(const QString &path)
{
QDir configFileDir(QDir::current());
QDir dir(path);
const QString canon = dir.canonicalPath();
return configFileDir.relativeFilePath(canon);
}
/*! \fn int Location::lineNo() const
Returns the current line number.
Must not be called on an empty Location object.
\sa filePath(), columnNo()
*/
/*! \fn int Location::columnNo() const
Returns the current column number.
Must not be called on an empty Location object.
\sa filePath(), lineNo()
*/
/*!
Writes \a message and \a detals to stderr as a formatted
warning message. Does not write the message if qdoc is in
the Prepare phase.
*/
void Location::warning(const QString& message, const QString& details) const
{
if (!Generator::preparing() || Generator::singleExec())
emitMessage(Warning, message, details);
}
/*!
Writes \a message and \a detals to stderr as a formatted
error message. Does not write the message if qdoc is in
the Prepare phase.
*/
void Location::error(const QString& message, const QString& details) const
{
if (!Generator::preparing() || Generator::singleExec())
emitMessage(Error, message, details);
}
/*!
Writes \a message and \a detals to stderr as a formatted
error message and then exits the program. qdoc prints fatal
errors in either phase (Prepare or Generate).
*/
void Location::fatal(const QString& message, const QString& details) const
{
emitMessage(Error, message, details);
information(message);
information(details);
information("Aborting");
exit(EXIT_FAILURE);
}
/*!
Writes \a message and \a detals to stderr as a formatted
report message.
*/
void Location::report(const QString& message, const QString& details) const
{
emitMessage(Report, message, details);
}
/*!
Gets several parameters from the \a config, including
tab size, program name, and a regular expression that
appears to be used for matching certain error messages
so that emitMessage() can avoid printing them.
*/
void Location::initialize(const Config& config)
{
tabSize = config.getInt(CONFIG_TABSIZE);
programName = config.programName();
QRegExp regExp = config.getRegExp(CONFIG_SPURIOUS);
if (regExp.isValid()) {
spuriousRegExp = new QRegExp(regExp);
}
else {
config.lastLocation().warning(tr("Invalid regular expression '%1'")
.arg(regExp.pattern()));
}
}
/*!
Apparently, all this does is delete the regular expression
used for intercepting certain error messages that should
not be emitted by emitMessage().
*/
void Location::terminate()
{
delete spuriousRegExp;
spuriousRegExp = 0;
}
/*!
Prints \a message to \c stdout followed by a \c{'\n'}.
*/
void Location::information(const QString& message)
{
printf("%s\n", message.toLatin1().data());
fflush(stdout);
}
/*!
Prints \a message to \c stderr followed by a \c{'\n'},
but only if the -log-progress option is set.
*/
void Location::logToStdErr(const QString& message)
{
if (logProgress_) {
fprintf(stderr, "LOG: %s\n", message.toLatin1().data());
fflush(stderr);
}
}
/*!
Report a program bug, including the \a hint.
*/
void Location::internalError(const QString& hint)
{
Location::null.fatal(tr("Internal error (%1)").arg(hint),
tr("There is a bug in %1. Seek advice from your local"
" %2 guru.")
.arg(programName).arg(programName));
}
/*!
Formats \a message and \a details into a single string
and outputs that string to \c stderr. \a type specifies
whether the \a message is an error or a warning.
*/
void Location::emitMessage(MessageType type,
const QString& message,
const QString& details) const
{
if (type == Warning &&
spuriousRegExp != 0 &&
spuriousRegExp->exactMatch(message))
return;
QString result = message;
if (!details.isEmpty())
result += "\n[" + details + QLatin1Char(']');
result.replace("\n", "\n ");
if (type == Error)
result.prepend(tr(": error: "));
else if (type == Warning)
result.prepend(tr(": warning: "));
if (type != Report)
result.prepend(toString());
fprintf(stderr, "%s\n", result.toLatin1().data());
fflush(stderr);
}
/*!
Converts the location to a string to be prepended to error
messages.
*/
QString Location::toString() const
{
QString str;
if (isEmpty()) {
str = programName;
} else {
Location loc2 = *this;
loc2.setEtc(false);
loc2.pop();
if (!loc2.isEmpty()) {
QString blah = tr("In file included from ");
for (;;) {
str += blah;
str += loc2.top();
loc2.pop();
if (loc2.isEmpty())
break;
str += tr(",");
str += QLatin1Char('\n');
blah.fill(' ');
}
str += tr(":");
str += QLatin1Char('\n');
}
str += top();
}
return str;
}
QString Location::top() const
{
QString str = filePath();
if (!QDir::isAbsolutePath(str)) {
QDir path(str);
str = path.absolutePath();
}
if (lineNo() >= 1) {
str += QLatin1Char(':');
str += QString::number(lineNo());
}
if (etc())
str += QLatin1String(" (etc.)");
return str;
}
QT_END_NAMESPACE

View File

@ -1,133 +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$
**
****************************************************************************/
/*
location.h
*/
#ifndef LOCATION_H
#define LOCATION_H
#include <qstack.h>
#include <qcoreapplication.h>
QT_BEGIN_NAMESPACE
class Config;
class QRegExp;
class Location
{
Q_DECLARE_TR_FUNCTIONS(QDoc::Location)
public:
Location();
Location(const QString& filePath);
Location(const Location& other);
~Location() { delete stk; }
Location& operator=(const Location& other);
void start();
void advance(QChar ch);
void advanceLines(int n) { stkTop->lineNo += n; stkTop->columnNo = 1; }
void push(const QString& filePath);
void pop();
void setEtc(bool etc) { etcetera = etc; }
void setLineNo(int no) { stkTop->lineNo = no; }
void setColumnNo(int no) { stkTop->columnNo = no; }
bool isEmpty() const { return stkDepth == 0; }
int depth() const { return stkDepth; }
const QString& filePath() const { return stkTop->filePath; }
QString fileName() const;
QString fileSuffix() const;
int lineNo() const { return stkTop->lineNo; }
int columnNo() const { return stkTop->columnNo; }
bool etc() const { return etcetera; }
void warning(const QString& message,
const QString& details = QString()) const;
void error(const QString& message,
const QString& details = QString()) const;
void fatal(const QString& message,
const QString& details = QString()) const;
void report(const QString& message,
const QString& details = QString()) const;
static const Location null;
static void initialize(const Config& config);
static void terminate();
static void information(const QString& message);
static void internalError(const QString& hint);
static void logToStdErr(const QString& message);
static void startLoggingProgress() { logProgress_ = true; }
static void stopLoggingProgress() { logProgress_ = false; }
static QString canonicalRelativePath(const QString &path);
private:
enum MessageType { Warning, Error, Report };
struct StackEntry
{
QString filePath;
int lineNo;
int columnNo;
};
friend class QTypeInfo<StackEntry>;
void emitMessage(MessageType type,
const QString& message,
const QString& details) const;
QString toString() const;
QString top() const;
private:
StackEntry stkBottom;
QStack<StackEntry> *stk;
StackEntry *stkTop;
int stkDepth;
bool etcetera;
static int tabSize;
static QString programName;
static QRegExp *spuriousRegExp;
static bool logProgress_;
};
Q_DECLARE_TYPEINFO(Location::StackEntry, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(Location, Q_COMPLEX_TYPE); // stkTop = &stkBottom
QT_END_NAMESPACE
#endif

View File

@ -1,794 +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 <qglobal.h>
#include <stdlib.h>
#include "codemarker.h"
#include "codeparser.h"
#include "config.h"
#include "cppcodemarker.h"
#include "cppcodeparser.h"
#include "doc.h"
#include "htmlgenerator.h"
#include "location.h"
#include "plaincodemarker.h"
#include "puredocparser.h"
#include "tokenizer.h"
#include "tree.h"
#include "qdocdatabase.h"
#include "jscodemarker.h"
#include "qmlcodemarker.h"
#include "qmlcodeparser.h"
#include <qdatetime.h>
#include <qdebug.h>
#include "qtranslator.h"
#ifndef QT_BOOTSTRAPPED
# include "qcoreapplication.h"
#endif
#include "qcommandlineoption.h"
#include "qcommandlineparser.h"
#include <algorithm>
QT_BEGIN_NAMESPACE
bool creationTimeBefore(const QFileInfo &fi1, const QFileInfo &fi2)
{
return fi1.lastModified() < fi2.lastModified();
}
static bool highlighting = false;
static bool showInternal = false;
static bool singleExec = false;
static bool writeQaPages = false;
static bool redirectDocumentationToDevNull = false;
static bool noLinkErrors = false;
static bool autolinkErrors = false;
static bool obsoleteLinks = false;
static QStringList defines;
static QStringList dependModules;
static QStringList indexDirs;
static QString currentDir;
static QString prevCurrentDir;
static QHash<QString,QString> defaults;
#ifndef QT_NO_TRANSLATION
typedef QPair<QString, QTranslator*> Translator;
static QList<Translator> translators;
#endif
/*!
Read some XML indexes containing definitions from other
documentation sets. \a config contains a variable that
lists directories where index files can bge found. It also
contains the \c depends variable, which lists the modules
that the current module depends on.
*/
static void loadIndexFiles(Config& config)
{
QDocDatabase* qdb = QDocDatabase::qdocDB();
QStringList indexFiles;
QStringList configIndexes = config.getStringList(CONFIG_INDEXES);
foreach (const QString &index, configIndexes) {
QFileInfo fi(index);
if (fi.exists() && fi.isFile())
indexFiles << index;
else
Location::null.warning(QString("Index file not found: %1").arg(index));
}
dependModules += config.getStringList(CONFIG_DEPENDS);
dependModules.removeDuplicates();
bool noOutputSubdirs = false;
QString singleOutputSubdir;
if (config.getBool(QString("HTML.nosubdirs"))) {
noOutputSubdirs = true;
singleOutputSubdir = config.getString("HTML.outputsubdir");
if (singleOutputSubdir.isEmpty())
singleOutputSubdir = "html";
}
if (dependModules.size() > 0) {
if (indexDirs.size() > 0) {
for (int i = 0; i < indexDirs.size(); i++) {
if (indexDirs[i].startsWith("..")) {
const QString prefix(QDir(currentDir).relativeFilePath(prevCurrentDir));
if (!prefix.isEmpty())
indexDirs[i].prepend(prefix + QLatin1Char('/'));
}
}
/*
Add all subdirectories of the indexdirs as dependModules,
when an asterisk is used in the 'depends' list.
*/
if (dependModules.contains("*")) {
dependModules.removeOne("*");
for (int i = 0; i < indexDirs.size(); i++) {
QDir scanDir = QDir(indexDirs[i]);
scanDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList dirList = scanDir.entryInfoList();
for (int j = 0; j < dirList.size(); j++) {
if (dirList[j].fileName().toLower() != config.getString(CONFIG_PROJECT).toLower())
dependModules.append(dirList[j].fileName());
}
}
}
for (int i = 0; i < dependModules.size(); i++) {
QString indexToAdd;
QList<QFileInfo> foundIndices;
for (int j = 0; j < indexDirs.size(); j++) {
QString fileToLookFor = indexDirs[j] + QLatin1Char('/');
if (noOutputSubdirs)
fileToLookFor += singleOutputSubdir + QLatin1Char('/');
else
fileToLookFor += dependModules[i] + QLatin1Char('/');
fileToLookFor += dependModules[i] + QLatin1String(".index");
if (QFile::exists(fileToLookFor)) {
QFileInfo tempFileInfo(fileToLookFor);
if (!foundIndices.contains(tempFileInfo))
foundIndices.append(tempFileInfo);
}
}
std::sort(foundIndices.begin(), foundIndices.end(), creationTimeBefore);
if (foundIndices.size() > 1) {
/*
QDoc should always use the last entry in the multimap when there are
multiple index files for a module, since the last modified file has the
highest UNIX timestamp.
*/
QStringList indexPaths;
for (int k = 0; k < foundIndices.size(); k++)
indexPaths << foundIndices[k].absoluteFilePath();
Location::null.warning(QString("Multiple index files found for dependency \"%1\":\n%2").arg(
dependModules[i], indexPaths.join('\n')));
Location::null.warning(QString("Using %1 as index file for dependency \"%2\"").arg(
foundIndices[foundIndices.size() - 1].absoluteFilePath(),
dependModules[i]));
indexToAdd = foundIndices[foundIndices.size() - 1].absoluteFilePath();
}
else if (foundIndices.size() == 1) {
indexToAdd = foundIndices[0].absoluteFilePath();
}
if (!indexToAdd.isEmpty()) {
if (!indexFiles.contains(indexToAdd))
indexFiles << indexToAdd;
}
else {
Location::null.warning(QString("\"%1\" Cannot locate index file for dependency \"%2\"").arg(
config.getString(CONFIG_PROJECT), dependModules[i]));
}
}
}
else {
Location::null.warning(QLatin1String("Dependent modules specified, but no index directories were set. There will probably be errors for missing links."));
}
}
qdb->readIndexes(indexFiles);
}
/*!
Processes the qdoc config file \a fileName. This is the
controller for all of qdoc.
*/
static void processQdocconfFile(const QString &fileName)
{
/*
The Config instance represents the configuration data for qdoc.
All the other classes are initialized with the config. Below, we
initialize the configuration with some default values.
I don't think the call to translate() does anything here. For one
thing, the translators haven't been installed at this point. And
I doubt any translator would translate QDoc anyway. But I left it
here because it does no harm.
*/
Config config(QCoreApplication::translate("QDoc", "qdoc"));
QHash<QString,QString>::iterator iter;
for (iter = defaults.begin(); iter != defaults.end(); ++iter)
config.setStringList(iter.key(), QStringList() << iter.value());
config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(highlighting ? "true" : "false"));
config.setStringList(CONFIG_SHOWINTERNAL, QStringList(showInternal ? "true" : "false"));
config.setStringList(CONFIG_SINGLEEXEC, QStringList(singleExec ? "true" : "false"));
config.setStringList(CONFIG_WRITEQAPAGES, QStringList(writeQaPages ? "true" : "false"));
config.setStringList(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL, QStringList(redirectDocumentationToDevNull ? "true" : "false"));
config.setStringList(CONFIG_NOLINKERRORS, QStringList(noLinkErrors ? "true" : "false"));
config.setStringList(CONFIG_AUTOLINKERRORS, QStringList(autolinkErrors ? "true" : "false"));
config.setStringList(CONFIG_OBSOLETELINKS, QStringList(obsoleteLinks ? "true" : "false"));
prevCurrentDir = QDir::currentPath();
/*
With the default configuration values in place, load
the qdoc configuration file. Note that the configuration
file may include other configuration files.
The Location class keeps track of the current location
in the file being processed, mainly for error reporting
purposes.
*/
Location::initialize(config);
config.load(fileName);
QString project = config.getString(CONFIG_PROJECT);
//qDebug() << "Start project:" << project;
/*
Add the defines to the configuration variables.
*/
QStringList defs = defines + config.getStringList(CONFIG_DEFINES);
config.setStringList(CONFIG_DEFINES,defs);
Location::terminate();
currentDir = QFileInfo(fileName).path();
if (!currentDir.isEmpty())
QDir::setCurrent(currentDir);
QString phase = " in -";
if (Generator::singleExec())
phase += "single exec mode, ";
else
phase += "separate exec mode, ";
if (Generator::preparing())
phase += "prepare phase ";
else if (Generator::generating())
phase += "generate phase ";
QString msg = "Running qdoc for " + config.getString(CONFIG_PROJECT) + phase;
Location::logToStdErr(msg);
/*
Initialize all the classes and data structures with the
qdoc configuration. This is safe to do for each qdocconf
file processed, because all the data structures created
are either cleared after they have been used, or they
are cleared in the terminate() functions below.
*/
Location::initialize(config);
Tokenizer::initialize(config);
Doc::initialize(config);
CodeMarker::initialize(config);
CodeParser::initialize(config);
Generator::initialize(config);
#ifndef QT_NO_TRANSLATION
/*
Load the language translators, if the configuration specifies any,
but only if they haven't already been loaded. This works in both
-prepare/-generate mode and -singleexec mode.
*/
QStringList fileNames = config.getStringList(CONFIG_TRANSLATORS);
QStringList::ConstIterator fn = fileNames.constBegin();
while (fn != fileNames.constEnd()) {
bool found = false;
if (!translators.isEmpty()) {
for (int i=0; i<translators.size(); ++i) {
if (translators.at(i).first == *fn) {
found = true;
break;
}
}
}
if (!found) {
QTranslator *translator = new QTranslator(0);
if (!translator->load(*fn)) {
config.lastLocation().error(QCoreApplication::translate("QDoc", "Cannot load translator '%1'").arg(*fn));
}
else {
QCoreApplication::instance()->installTranslator(translator);
translators.append(Translator(*fn, translator));
}
}
++fn;
}
#endif
//QSet<QString> outputLanguages = config.getStringSet(CONFIG_OUTPUTLANGUAGES);
/*
Get the source language (Cpp) from the configuration
and the location in the configuration file where the
source language was set.
*/
QString lang = config.getString(CONFIG_LANGUAGE);
Location langLocation = config.lastLocation();
/*
Initialize the qdoc database, where all the parsed source files
will be stored. The database includes a tree of nodes, which gets
built as the source files are parsed. The documentation output is
generated by traversing that tree.
Note: qdocDB() allocates a new instance only if no instance exists.
So it is safe to call qdocDB() any time.
*/
QDocDatabase* qdb = QDocDatabase::qdocDB();
qdb->setVersion(config.getString(CONFIG_VERSION));
qdb->setShowInternal(config.getBool(CONFIG_SHOWINTERNAL));
qdb->setSingleExec(config.getBool(CONFIG_SINGLEEXEC));
/*
By default, the only output format is HTML.
*/
QSet<QString> outputFormats = config.getOutputFormats();
Location outputFormatsLocation = config.lastLocation();
qdb->clearSearchOrder();
if (!Generator::singleExec()) {
if (!Generator::preparing()) {
Generator::debug(" loading index files");
loadIndexFiles(config);
Generator::debug(" done loading index files");
}
qdb->newPrimaryTree(project);
}
else if (Generator::preparing())
qdb->newPrimaryTree(project);
else
qdb->setPrimaryTree(project);
dependModules = config.getStringList(CONFIG_DEPENDS);
dependModules.removeDuplicates();
qdb->setSearchOrder(dependModules);
QSet<QString> excludedDirs;
QSet<QString> excludedFiles;
QStringList excludedDirsList;
QStringList excludedFilesList;
if (!Generator::singleExec() || !Generator::generating()) {
QStringList headerList;
QStringList sourceList;
Generator::debug("Reading excludedirs");
excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
foreach (const QString &excludeDir, excludedDirsList) {
QString p = QDir::fromNativeSeparators(excludeDir);
QDir tmp(p);
if (tmp.exists())
excludedDirs.insert(p);
}
Generator::debug("Reading excludefiles");
excludedFilesList = config.getCanonicalPathList(CONFIG_EXCLUDEFILES);
foreach (const QString& excludeFile, excludedFilesList) {
QString p = QDir::fromNativeSeparators(excludeFile);
excludedFiles.insert(p);
}
Generator::debug("Reading headerdirs");
headerList = config.getAllFiles(CONFIG_HEADERS,CONFIG_HEADERDIRS,excludedDirs,excludedFiles);
QMap<QString,QString> headers;
QMultiMap<QString,QString> headerFileNames;
for (int i=0; i<headerList.size(); ++i) {
if (headerList[i].contains(QString("doc/snippets")))
continue;
if (headers.contains(headerList[i]))
continue;
headers.insert(headerList[i],headerList[i]);
QString t = headerList[i].mid(headerList[i].lastIndexOf('/')+1);
headerFileNames.insert(t,t);
}
Generator::debug("Reading sourcedirs");
sourceList = config.getAllFiles(CONFIG_SOURCES,CONFIG_SOURCEDIRS,excludedDirs,excludedFiles);
QMap<QString,QString> sources;
QMultiMap<QString,QString> sourceFileNames;
for (int i=0; i<sourceList.size(); ++i) {
if (sourceList[i].contains(QString("doc/snippets")))
continue;
if (sources.contains(sourceList[i]))
continue;
sources.insert(sourceList[i],sourceList[i]);
QString t = sourceList[i].mid(sourceList[i].lastIndexOf('/')+1);
sourceFileNames.insert(t,t);
}
/*
Find all the qdoc files in the example dirs, and add
them to the source files to be parsed.
*/
Generator::debug("Reading exampledirs");
QStringList exampleQdocList = config.getExampleQdocFiles(excludedDirs, excludedFiles);
for (int i=0; i<exampleQdocList.size(); ++i) {
if (!sources.contains(exampleQdocList[i])) {
sources.insert(exampleQdocList[i],exampleQdocList[i]);
QString t = exampleQdocList[i].mid(exampleQdocList[i].lastIndexOf('/')+1);
sourceFileNames.insert(t,t);
}
}
Generator::debug("Adding doc/image dirs found in exampledirs to imagedirs");
QSet<QString> exampleImageDirs;
QStringList exampleImageList = config.getExampleImageFiles(excludedDirs, excludedFiles);
for (int i=0; i<exampleImageList.size(); ++i) {
if (exampleImageList[i].contains("doc/images")) {
QString t = exampleImageList[i].left(exampleImageList[i].lastIndexOf("doc/images")+10);
if (!exampleImageDirs.contains(t)) {
exampleImageDirs.insert(t);
}
}
}
Generator::augmentImageDirs(exampleImageDirs);
/*
Parse each header file in the set using the appropriate parser and add it
to the big tree.
*/
QSet<CodeParser *> usedParsers;
Generator::debug("Parsing header files");
int parsed = 0;
QMap<QString,QString>::ConstIterator h = headers.constBegin();
while (h != headers.constEnd()) {
CodeParser *codeParser = CodeParser::parserForHeaderFile(h.key());
if (codeParser) {
++parsed;
Generator::debug(QString("Parsing " + h.key()));
codeParser->parseHeaderFile(config.location(), h.key());
usedParsers.insert(codeParser);
}
++h;
}
foreach (CodeParser *codeParser, usedParsers)
codeParser->doneParsingHeaderFiles();
usedParsers.clear();
qdb->resolveInheritance();
/*
Parse each source text file in the set using the appropriate parser and
add it to the big tree.
*/
parsed = 0;
Generator::debug("Parsing source files");
QMap<QString,QString>::ConstIterator s = sources.constBegin();
while (s != sources.constEnd()) {
CodeParser *codeParser = CodeParser::parserForSourceFile(s.key());
if (codeParser) {
++parsed;
Generator::debug(QString("Parsing " + s.key()));
codeParser->parseSourceFile(config.location(), s.key());
usedParsers.insert(codeParser);
}
++s;
}
Generator::debug(QString("Parsing done."));
/*
Currently these doneParsingSourceFiles() calls do nothing.
*/
foreach (CodeParser *codeParser, usedParsers)
codeParser->doneParsingSourceFiles();
/*
Now the primary tree has been built from all the header and
source files. Resolve all the class names, function names,
targets, URLs, links, and other stuff that needs resolving.
*/
Generator::debug("Resolving stuff prior to generating docs");
qdb->resolveIssues();
}
else {
Generator::debug("Reading excludedirs");
excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
foreach (const QString &excludeDir, excludedDirsList) {
QString p = QDir::fromNativeSeparators(excludeDir);
QDir tmp(p);
if (tmp.exists())
excludedDirs.insert(p);
}
Generator::debug("Reading excludefiles");
excludedFilesList = config.getCanonicalPathList(CONFIG_EXCLUDEFILES);
foreach (const QString& excludeFile, excludedFilesList) {
QString p = QDir::fromNativeSeparators(excludeFile);
excludedFiles.insert(p);
}
Generator::debug("Adding doc/image dirs found in exampledirs to imagedirs");
QSet<QString> exampleImageDirs;
QStringList exampleImageList = config.getExampleImageFiles(excludedDirs, excludedFiles);
for (int i=0; i<exampleImageList.size(); ++i) {
if (exampleImageList[i].contains("doc/images")) {
QString t = exampleImageList[i].left(exampleImageList[i].lastIndexOf("doc/images")+10);
if (!exampleImageDirs.contains(t)) {
exampleImageDirs.insert(t);
}
}
}
Generator::augmentImageDirs(exampleImageDirs);
qdb->resolveStuff();
}
/*
The primary tree is built and all the stuff that needed
resolving has been resolved. Now traverse the tree and
generate the documentation output. More than one output
format can be requested. The tree is traversed for each
one.
*/
Generator::debug("Generating docs");
QSet<QString>::ConstIterator of = outputFormats.constBegin();
while (of != outputFormats.constEnd()) {
Generator* generator = Generator::generatorForFormat(*of);
if (generator == 0)
outputFormatsLocation.fatal(QCoreApplication::translate("QDoc",
"Unknown output format '%1'").arg(*of));
generator->generateDocs();
++of;
}
#if 0
if (Generator::generating() && Generator::writeQaPages())
qdb->printLinkCounts(project);
#endif
qdb->clearLinkCounts();
Generator::debug("Terminating qdoc classes");
if (Generator::debugging())
Generator::stopDebugging(project);
QDocDatabase::qdocDB()->setVersion(QString());
Generator::terminate();
CodeParser::terminate();
CodeMarker::terminate();
Doc::terminate();
Tokenizer::terminate();
Location::terminate();
QDir::setCurrent(prevCurrentDir);
Generator::debug("qdoc classes terminated");
}
extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
QT_END_NAMESPACE
int main(int argc, char **argv)
{
QT_USE_NAMESPACE
#ifndef QT_BOOTSTRAPPED
qt_qhash_seed.testAndSetRelaxed(-1, 0); // set the hash seed to 0 if it wasn't set yet
#endif
QCoreApplication app(argc, argv);
app.setApplicationVersion(QStringLiteral(QT_VERSION_STR));
/*
Create code parsers for the languages to be parsed,
and create a tree for C++.
*/
CppCodeParser cppParser;
QmlCodeParser qmlParser;
PureDocParser docParser;
/*
Create code markers for plain text, C++,
javascript, and QML.
*/
PlainCodeMarker plainMarker;
CppCodeMarker cppMarker;
JsCodeMarker jsMarker;
QmlCodeMarker qmlMarker;
HtmlGenerator htmlGenerator;
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::translate("qdoc", "Qt documentation generator"));
parser.addHelpOption();
parser.addVersionOption();
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
parser.addPositionalArgument("file1.qdocconf ...", QCoreApplication::translate("qdoc", "Input files"));
QCommandLineOption defineOption(QStringList() << QStringLiteral("D"));
defineOption.setDescription(QCoreApplication::translate("qdoc", "Define the argument as a macro while parsing sources"));
defineOption.setValueName(QStringLiteral("macro[=def]"));
parser.addOption(defineOption);
QCommandLineOption dependsOption(QStringList() << QStringLiteral("depends"));
dependsOption.setDescription(QCoreApplication::translate("qdoc", "Specify dependent modules"));
dependsOption.setValueName(QStringLiteral("module"));
parser.addOption(dependsOption);
QCommandLineOption highlightingOption(QStringList() << QStringLiteral("highlighting"));
highlightingOption.setDescription(QCoreApplication::translate("qdoc", "Turn on syntax highlighting (makes qdoc run slower)"));
parser.addOption(highlightingOption);
QCommandLineOption showInternalOption(QStringList() << QStringLiteral("showinternal"));
showInternalOption.setDescription(QCoreApplication::translate("qdoc", "Include content marked internal"));
parser.addOption(showInternalOption);
QCommandLineOption redirectDocumentationToDevNullOption(QStringList() << QStringLiteral("redirect-documentation-to-dev-null"));
redirectDocumentationToDevNullOption.setDescription(QCoreApplication::translate("qdoc", "Save all documentation content to /dev/null. Useful if someone is interested in qdoc errors only."));
parser.addOption(redirectDocumentationToDevNullOption);
QCommandLineOption noExamplesOption(QStringList() << QStringLiteral("no-examples"));
noExamplesOption.setDescription(QCoreApplication::translate("qdoc", "Do not generate documentation for examples"));
parser.addOption(noExamplesOption);
QCommandLineOption indexDirOption(QStringList() << QStringLiteral("indexdir"));
indexDirOption.setDescription(QCoreApplication::translate("qdoc", "Specify a directory where QDoc should search for index files to load"));
indexDirOption.setValueName(QStringLiteral("dir"));
parser.addOption(indexDirOption);
QCommandLineOption installDirOption(QStringList() << QStringLiteral("installdir"));
installDirOption.setDescription(QCoreApplication::translate("qdoc", "Specify the directory where the output will be after running \"make install\""));
installDirOption.setValueName(QStringLiteral("dir"));
parser.addOption(installDirOption);
QCommandLineOption obsoleteLinksOption(QStringList() << QStringLiteral("obsoletelinks"));
obsoleteLinksOption.setDescription(QCoreApplication::translate("qdoc", "Report links from obsolete items to non-obsolete items"));
parser.addOption(obsoleteLinksOption);
QCommandLineOption outputDirOption(QStringList() << QStringLiteral("outputdir"));
outputDirOption.setDescription(QCoreApplication::translate("qdoc", "Specify output directory, overrides setting in qdocconf file"));
outputDirOption.setValueName(QStringLiteral("dir"));
parser.addOption(outputDirOption);
QCommandLineOption outputFormatOption(QStringList() << QStringLiteral("outputformat"));
outputFormatOption.setDescription(QCoreApplication::translate("qdoc", "Specify output format, overrides setting in qdocconf file"));
outputFormatOption.setValueName(QStringLiteral("format"));
parser.addOption(outputFormatOption);
QCommandLineOption noLinkErrorsOption(QStringList() << QStringLiteral("no-link-errors"));
noLinkErrorsOption.setDescription(QCoreApplication::translate("qdoc", "Do not print link errors (i.e. missing targets)"));
parser.addOption(noLinkErrorsOption);
QCommandLineOption autoLinkErrorsOption(QStringList() << QStringLiteral("autolink-errors"));
autoLinkErrorsOption.setDescription(QCoreApplication::translate("qdoc", "Show errors when automatic linking fails"));
parser.addOption(autoLinkErrorsOption);
QCommandLineOption debugOption(QStringList() << QStringLiteral("debug"));
debugOption.setDescription(QCoreApplication::translate("qdoc", "Enable debug output"));
parser.addOption(debugOption);
QCommandLineOption prepareOption(QStringList() << QStringLiteral("prepare"));
prepareOption.setDescription(QCoreApplication::translate("qdoc", "Run qdoc only to generate an index file, not the docs"));
parser.addOption(prepareOption);
QCommandLineOption generateOption(QStringList() << QStringLiteral("generate"));
generateOption.setDescription(QCoreApplication::translate("qdoc", "Run qdoc to read the index files and generate the docs"));
parser.addOption(generateOption);
QCommandLineOption logProgressOption(QStringList() << QStringLiteral("log-progress"));
logProgressOption.setDescription(QCoreApplication::translate("qdoc", "Log progress on stderr."));
parser.addOption(logProgressOption);
QCommandLineOption singleExecOption(QStringList() << QStringLiteral("single-exec"));
singleExecOption.setDescription(QCoreApplication::translate("qdoc", "Run qdoc once over all the qdoc conf files."));
parser.addOption(singleExecOption);
QCommandLineOption writeQaPagesOption(QStringList() << QStringLiteral("write-qa-pages"));
writeQaPagesOption.setDescription(QCoreApplication::translate("qdoc", "Write QA pages."));
parser.addOption(writeQaPagesOption);
parser.process(app);
defines += parser.values(defineOption);
dependModules += parser.values(dependsOption);
highlighting = parser.isSet(highlightingOption);
showInternal = parser.isSet(showInternalOption);
singleExec = parser.isSet(singleExecOption);
writeQaPages = parser.isSet(writeQaPagesOption);
redirectDocumentationToDevNull = parser.isSet(redirectDocumentationToDevNullOption);
Config::generateExamples = !parser.isSet(noExamplesOption);
foreach (const QString &indexDir, parser.values(indexDirOption)) {
if (QFile::exists(indexDir))
indexDirs += indexDir;
else
qDebug() << "Cannot find index directory" << indexDir;
}
if (parser.isSet(installDirOption))
Config::installDir = parser.value(installDirOption);
obsoleteLinks = parser.isSet(obsoleteLinksOption);
if (parser.isSet(outputDirOption))
Config::overrideOutputDir = parser.value(outputDirOption);
foreach (const QString &format, parser.values(outputFormatOption))
Config::overrideOutputFormats.insert(format);
noLinkErrors = parser.isSet(noLinkErrorsOption);
autolinkErrors = parser.isSet(autoLinkErrorsOption);
if (parser.isSet(debugOption))
Generator::startDebugging(QString("command line"));
if (parser.isSet(prepareOption))
Generator::setQDocPass(Generator::Prepare);
if (parser.isSet(generateOption))
Generator::setQDocPass(Generator::Generate);
if (parser.isSet(singleExecOption))
Generator::setSingleExec();
if (parser.isSet(writeQaPagesOption))
Generator::setWriteQaPages();
if (parser.isSet(logProgressOption))
Location::startLoggingProgress();
/*
The default indent for code is 0.
The default value for false is 0.
The default supported file extensions are cpp, h, qdoc and qml.
The default language is c++.
The default output format is html.
The default tab size is 8.
And those are all the default values for configuration variables.
*/
if (defaults.isEmpty()) {
defaults.insert(CONFIG_CODEINDENT, QLatin1String("0"));
defaults.insert(CONFIG_FALSEHOODS, QLatin1String("0"));
defaults.insert(CONFIG_FILEEXTENSIONS, QLatin1String("*.cpp *.h *.qdoc *.qml"));
defaults.insert(CONFIG_LANGUAGE, QLatin1String("Cpp"));
defaults.insert(CONFIG_OUTPUTFORMATS, QLatin1String("HTML"));
defaults.insert(CONFIG_TABSIZE, QLatin1String("8"));
}
QStringList qdocFiles = parser.positionalArguments();
if (qdocFiles.isEmpty())
parser.showHelp();
if (singleExec)
qdocFiles = Config::loadMaster(qdocFiles.at(0));
/*
Main loop is now modified to handle single exec mode.
*/
if (Generator::singleExec())
Generator::setQDocPass(Generator::Prepare);
foreach (const QString &qf, qdocFiles) {
dependModules.clear();
processQdocconfFile(qf);
}
if (Generator::singleExec()) {
Generator::setQDocPass(Generator::Generate);
QDocDatabase* qdb = QDocDatabase::qdocDB();
qdb->processForest();
foreach (const QString &qf, qdocFiles) {
dependModules.clear();
processQdocconfFile(qf);
}
}
#ifndef QT_NO_TRANSLATION
if (!translators.isEmpty()) {
for (int i=0; i<translators.size(); ++i) {
delete translators.at(i).second;
}
}
translators.clear();
#endif
QmlTypeNode::terminate();
#ifdef DEBUG_SHUTDOWN_CRASH
qDebug() << "main(): Delete qdoc database";
#endif
QDocDatabase::destroyQdocDB();
#ifdef DEBUG_SHUTDOWN_CRASH
qDebug() << "main(): qdoc database deleted";
#endif
return EXIT_SUCCESS;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,220 +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$
**
****************************************************************************/
/*
openedlist.cpp
*/
#include <qregexp.h>
#include "atom.h"
#include "openedlist.h"
QT_BEGIN_NAMESPACE
static const char roman[] = "m\2d\5c\2l\5x\2v\5i";
OpenedList::OpenedList( Style style )
: sty( style ), ini( 1 ), nex( 0 )
{
}
OpenedList::OpenedList( const Location& location, const QString& hint )
: sty( Bullet ), ini( 1 )
{
QRegExp hintSyntax( "(\\W*)([0-9]+|[A-Z]+|[a-z]+)(\\W*)" );
if ( hintSyntax.exactMatch(hint) ) {
bool ok;
int asNumeric = hint.toInt( &ok );
int asRoman = fromRoman( hintSyntax.cap(2) );
int asAlpha = fromAlpha( hintSyntax.cap(2) );
if ( ok ) {
sty = Numeric;
ini = asNumeric;
} else if ( asRoman > 0 && asRoman != 100 && asRoman != 500 ) {
sty = ( hint == hint.toLower() ) ? LowerRoman : UpperRoman;
ini = asRoman;
} else {
sty = ( hint == hint.toLower() ) ? LowerAlpha : UpperAlpha;
ini = asAlpha;
}
pref = hintSyntax.cap( 1 );
suff = hintSyntax.cap( 3 );
} else if ( !hint.isEmpty() ) {
location.warning( tr("Unrecognized list style '%1'").arg(hint) );
}
nex = ini - 1;
}
QString OpenedList::styleString() const
{
switch ( style() ) {
case Bullet:
default:
return ATOM_LIST_BULLET;
case Tag:
return ATOM_LIST_TAG;
case Value:
return ATOM_LIST_VALUE;
case Numeric:
return ATOM_LIST_NUMERIC;
case UpperAlpha:
return ATOM_LIST_UPPERALPHA;
case LowerAlpha:
return ATOM_LIST_LOWERALPHA;
case UpperRoman:
return ATOM_LIST_UPPERROMAN;
case LowerRoman:
return ATOM_LIST_LOWERROMAN;
}
}
QString OpenedList::numberString() const
{
return QString::number( number() );
/*
switch ( style() ) {
case Numeric:
return QString::number( number() );
case UpperAlpha:
return toAlpha( number() ).toUpper();
case LowerAlpha:
return toAlpha( number() );
case UpperRoman:
return toRoman( number() ).toUpper();
case LowerRoman:
return toRoman( number() );
case Bullet:
default:
return "*";
}*/
}
QString OpenedList::toAlpha( int n )
{
QString str;
while ( n > 0 ) {
n--;
str.prepend( (n % 26) + 'a' );
n /= 26;
}
return str;
}
int OpenedList::fromAlpha( const QString& str )
{
int n = 0;
int u;
for ( int i = 0; i < (int) str.length(); i++ ) {
u = str[i].toLower().unicode();
if ( u >= 'a' && u <= 'z' ) {
n *= 26;
n += u - 'a' + 1;
} else {
return 0;
}
}
return n;
}
QString OpenedList::toRoman( int n )
{
/*
See p. 30 of Donald E. Knuth's "TeX: The Program".
*/
QString str;
int j = 0;
int k;
int u;
int v = 1000;
for ( ;; ) {
while ( n >= v ) {
str += roman[j];
n -= v;
}
if ( n <= 0 )
break;
k = j + 2;
u = v / roman[k - 1];
if ( roman[k - 1] == 2 ) {
k += 2;
u /= 5;
}
if ( n + u >= v ) {
str += roman[k];
n += u;
} else {
j += 2;
v /= roman[j - 1];
}
}
return str;
}
int OpenedList::fromRoman( const QString& str )
{
int n = 0;
int j;
int u;
int v = 0;
for ( int i = str.length() - 1; i >= 0; i-- ) {
j = 0;
u = 1000;
while ( roman[j] != 'i' && roman[j] != str[i].toLower() ) {
j += 2;
u /= roman[j - 1];
}
if ( u < v ) {
n -= u;
} else {
n += u;
}
v = u;
}
if ( str.toLower() == toRoman(n) ) {
return n;
} else {
return 0;
}
}
QT_END_NAMESPACE

View File

@ -1,86 +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$
**
****************************************************************************/
/*
openedlist.h
*/
#ifndef OPENEDLIST_H
#define OPENEDLIST_H
#include <qstring.h>
#include "location.h"
QT_BEGIN_NAMESPACE
class OpenedList
{
Q_DECLARE_TR_FUNCTIONS(QDoc::OpenedList)
public:
enum Style { Bullet, Tag, Value, Numeric, UpperAlpha, LowerAlpha,
UpperRoman, LowerRoman };
OpenedList()
: sty( Bullet ), ini( 1 ), nex( 0 ) { }
OpenedList( Style style );
OpenedList( const Location& location, const QString& hint );
void next() { nex++; }
bool isStarted() const { return nex >= ini; }
Style style() const { return sty; }
QString styleString() const;
int number() const { return nex; }
QString numberString() const;
QString prefix() const { return pref; }
QString suffix() const { return suff; }
private:
static QString toAlpha( int n );
static int fromAlpha( const QString& str );
static QString toRoman( int n );
static int fromRoman( const QString& str );
Style sty;
int ini;
int nex;
QString pref;
QString suff;
};
Q_DECLARE_TYPEINFO(OpenedList, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
#endif

View File

@ -1,119 +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 "plaincodemarker.h"
QT_BEGIN_NAMESPACE
PlainCodeMarker::PlainCodeMarker()
{
}
PlainCodeMarker::~PlainCodeMarker()
{
}
bool PlainCodeMarker::recognizeCode( const QString& /* code */ )
{
return true;
}
bool PlainCodeMarker::recognizeExtension( const QString& /* ext */ )
{
return true;
}
bool PlainCodeMarker::recognizeLanguage( const QString& /* lang */ )
{
return false;
}
Atom::AtomType PlainCodeMarker::atomType() const
{
return Atom::Code;
}
QString PlainCodeMarker::markedUpCode( const QString& code,
const Node * /* relative */,
const Location & /* location */ )
{
return protect( code );
}
QString PlainCodeMarker::markedUpSynopsis( const Node * /* node */,
const Node * /* relative */,
SynopsisStyle /* style */ )
{
return "foo";
}
QString PlainCodeMarker::markedUpName( const Node * /* node */ )
{
return QString();
}
QString PlainCodeMarker::markedUpFullName( const Node * /* node */,
const Node * /* relative */ )
{
return QString();
}
QString PlainCodeMarker::markedUpEnumValue(const QString & /* enumValue */,
const Node * /* relative */)
{
return QString();
}
QString PlainCodeMarker::markedUpIncludes( const QStringList& /* includes */ )
{
return QString();
}
QString PlainCodeMarker::functionBeginRegExp( const QString& /* funcName */ )
{
return QString();
}
QString PlainCodeMarker::functionEndRegExp( const QString& /* funcName */ )
{
return QString();
}
QList<Section> PlainCodeMarker::sections(const Aggregate * /* innerNode */,
SynopsisStyle /* style */,
Status /* status */)
{
return QList<Section>();
}
QT_END_NAMESPACE

View File

@ -1,69 +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$
**
****************************************************************************/
/*
plaincodemarker.h
*/
#ifndef PLAINCODEMARKER_H
#define PLAINCODEMARKER_H
#include "codemarker.h"
QT_BEGIN_NAMESPACE
class PlainCodeMarker : public CodeMarker
{
public:
PlainCodeMarker();
~PlainCodeMarker();
bool recognizeCode( const QString& code ) Q_DECL_OVERRIDE;
bool recognizeExtension( const QString& ext ) Q_DECL_OVERRIDE;
bool recognizeLanguage( const QString& lang ) Q_DECL_OVERRIDE;
Atom::AtomType atomType() const Q_DECL_OVERRIDE;
QString markedUpCode( const QString& code, const Node *relative, const Location &location ) Q_DECL_OVERRIDE;
QString markedUpSynopsis( const Node *node, const Node *relative,
SynopsisStyle style ) Q_DECL_OVERRIDE;
QString markedUpName( const Node *node ) Q_DECL_OVERRIDE;
QString markedUpFullName( const Node *node, const Node *relative ) Q_DECL_OVERRIDE;
QString markedUpEnumValue(const QString &enumValue, const Node *relative) Q_DECL_OVERRIDE;
QString markedUpIncludes( const QStringList& includes ) Q_DECL_OVERRIDE;
QString functionBeginRegExp( const QString& funcName ) Q_DECL_OVERRIDE;
QString functionEndRegExp( const QString& funcName ) Q_DECL_OVERRIDE;
QList<Section> sections(const Aggregate *innerNode, SynopsisStyle style, Status status) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
#endif

View File

@ -1,225 +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$
**
****************************************************************************/
/*
puredocparser.cpp
*/
#include <qfile.h>
#include <stdio.h>
#include <errno.h>
#include "codechunk.h"
#include "config.h"
#include "tokenizer.h"
#include <qdebug.h>
#include "qdocdatabase.h"
#include "puredocparser.h"
QT_BEGIN_NAMESPACE
/*!
Constructs the pure doc parser.
*/
PureDocParser::PureDocParser()
{
}
/*!
Destroys the pure doc parser.
*/
PureDocParser::~PureDocParser()
{
}
/*!
Returns a list of the kinds of files that the pure doc
parser is meant to parse. The elements of the list are
file suffixes.
*/
QStringList PureDocParser::sourceFileNameFilter()
{
return QStringList() << "*.qdoc" << "*.qtx" << "*.qtt" << "*.js";
}
/*!
Parses the source file identified by \a filePath and adds its
parsed contents to the database. The \a location is used for
reporting errors.
*/
void PureDocParser::parseSourceFile(const Location& location, const QString& filePath)
{
QFile in(filePath);
currentFile_ = filePath;
if (!in.open(QIODevice::ReadOnly)) {
location.error(tr("Can't open 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();
processQdocComments();
in.close();
currentFile_.clear();
}
/*!
This is called by parseSourceFile() to do the actual parsing
and tree building. It only processes qdoc comments. It skips
everything else.
*/
bool PureDocParser::processQdocComments()
{
const QSet<QString>& topicCommandsAllowed = topicCommands();
const QSet<QString>& otherMetacommandsAllowed = otherMetaCommands();
const QSet<QString>& 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()) {
doc.location().warning(tr("This qdoc comment contains no topic command "
"(e.g., '\\%1', '\\%2').")
.arg(COMMAND_MODULE).arg(COMMAND_PAGE));
}
else if (isQmlPropertyTopic || isJsPropertyTopic) {
Doc nodeDoc = doc;
processQmlProperties(nodeDoc, nodes, docs, isJsPropertyTopic);
}
else {
ArgList args;
QSet<QString> topicCommandsUsed = topicCommandsAllowed & doc.metaCommandsUsed();
if (topicCommandsUsed.count() > 0) {
topic = *topicCommandsUsed.begin();
args = doc.metaCommandArgs(topic);
}
if (topicCommandsUsed.count() > 1) {
QString topics;
QSet<QString>::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.cbegin();
while (a != args.cend()) {
Doc nodeDoc = doc;
Node* node = processTopicCommand(nodeDoc,topic,*a);
if (node != 0) {
nodes.append(node);
docs.append(nodeDoc);
}
++a;
}
}
Node* treeRoot = QDocDatabase::qdocDB()->primaryTreeRoot();
NodeList::Iterator n = nodes.begin();
QList<Doc>::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<Aggregate *>(*n);
while (m->parent() && m->parent() != treeRoot)
m = m->parent();
if (m == *n)
((Aggregate *)*n)->addInclude((*n)->name());
else
((Aggregate *)*n)->setIncludes(m->includes());
}
++d;
++n;
}
}
else {
readToken();
}
}
return true;
}
QT_END_NAMESPACE

View File

@ -1,69 +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$
**
****************************************************************************/
/*
puredocparser.h
*/
#ifndef PUREDOCPARSER_H
#define PUREDOCPARSER_H
#include <qset.h>
#include "cppcodeparser.h"
#include "location.h"
QT_BEGIN_NAMESPACE
class Config;
class Node;
class QString;
class PureDocParser : public CppCodeParser
{
Q_DECLARE_TR_FUNCTIONS(QDoc::PureDocParser)
public:
PureDocParser();
virtual ~PureDocParser();
virtual QStringList sourceFileNameFilter() Q_DECL_OVERRIDE;
virtual void parseSourceFile(const Location& location, const QString& filePath) Q_DECL_OVERRIDE;
private:
bool processQdocComments();
};
QT_END_NAMESPACE
#endif

View File

@ -1,99 +0,0 @@
!force_bootstrap {
load(qfeatures)
requires(!contains(QT_DISABLED_FEATURES, xmlstreamwriter))
}
option(host_build)
QT = core
DEFINES += \
QT_QMLDEVTOOLS_LIB \ # force static exports even if not bootstrapping
QDOC2_COMPAT
INCLUDEPATH += $$QT_SOURCE_TREE/src/tools/qdoc \
$$QT_SOURCE_TREE/src/tools/qdoc/qmlparser
# Increase the stack size on MSVC to 4M to avoid a stack overflow
win32-msvc*:{
QMAKE_LFLAGS += /STACK:4194304
}
HEADERS += atom.h \
codechunk.h \
codemarker.h \
codeparser.h \
config.h \
cppcodemarker.h \
cppcodeparser.h \
doc.h \
editdistance.h \
generator.h \
helpprojectwriter.h \
htmlgenerator.h \
location.h \
node.h \
openedlist.h \
plaincodemarker.h \
puredocparser.h \
qdocdatabase.h \
qdoctagfiles.h \
qdocindexfiles.h \
quoter.h \
separator.h \
text.h \
tokenizer.h \
tree.h
SOURCES += atom.cpp \
codechunk.cpp \
codemarker.cpp \
codeparser.cpp \
config.cpp \
cppcodemarker.cpp \
cppcodeparser.cpp \
doc.cpp \
editdistance.cpp \
generator.cpp \
helpprojectwriter.cpp \
htmlgenerator.cpp \
location.cpp \
main.cpp \
node.cpp \
openedlist.cpp \
plaincodemarker.cpp \
puredocparser.cpp \
qdocdatabase.cpp \
qdoctagfiles.cpp \
qdocindexfiles.cpp \
quoter.cpp \
separator.cpp \
text.cpp \
tokenizer.cpp \
tree.cpp \
yyindent.cpp
### QML/JS Parser ###
include(qmlparser/parser.pri)
HEADERS += jscodemarker.h \
qmlcodemarker.h \
qmlcodeparser.h \
qmlmarkupvisitor.h \
qmlvisitor.h
SOURCES += jscodemarker.cpp \
qmlcodemarker.cpp \
qmlcodeparser.cpp \
qmlmarkupvisitor.cpp \
qmlvisitor.cpp
### Documentation for qdoc ###
qtPrepareTool(QDOC, qdoc)
qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
QMAKE_DOCS = $$PWD/doc/config/qdoc.qdocconf
load(qt_tool)
TR_EXCLUDE += $$PWD/*

File diff suppressed because it is too large Load Diff

View File

@ -1,455 +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 QDOCDATABASE_H
#define QDOCDATABASE_H
#include <qstring.h>
#include <qmap.h>
#include "tree.h"
#include "config.h"
#include "text.h"
#include <qdebug.h>
QT_BEGIN_NAMESPACE
typedef QMap<QString, NodeMap> NodeMapMap;
typedef QMap<QString, NodeMultiMap> NodeMultiMapMap;
typedef QMultiMap<QString, Node*> QDocMultiMap;
typedef QMap<Text, const Node*> TextToNodeMap;
typedef QList<CollectionNode*> CollectionList;
class Atom;
class Generator;
class QDocDatabase;
enum FindFlag {
SearchBaseClasses = 0x1,
SearchEnumValues = 0x2,
NonFunction = 0x4
};
class QDocForest
{
public:
friend class QDocDatabase;
QDocForest(QDocDatabase* qdb)
: qdb_(qdb), primaryTree_(0), currentIndex_(0) { }
~QDocForest();
NamespaceNode* firstRoot();
NamespaceNode* nextRoot();
Tree* firstTree();
Tree* nextTree();
Tree* primaryTree() { return primaryTree_; }
Tree* findTree(const QString& t) { return forest_.value(t); }
QStringList keys() {
return forest_.keys();
}
NamespaceNode* primaryTreeRoot() { return (primaryTree_ ? primaryTree_->root() : 0); }
bool isEmpty() { return searchOrder().isEmpty(); }
bool done() { return (currentIndex_ >= searchOrder().size()); }
const QVector<Tree*>& searchOrder();
const QVector<Tree*>& indexSearchOrder();
void setSearchOrder(QStringList& t);
bool isLoaded(const QString& fn) {
foreach (Tree* t, searchOrder()) {
if (fn == t->indexFileName())
return true;
}
return false;
}
const Node* findNode(const QStringList& path,
const Node* relative,
int findFlags,
Node::Genus genus) {
foreach (Tree* t, searchOrder()) {
const Node* n = t->findNode(path, relative, findFlags, genus);
if (n)
return n;
relative = 0;
}
return 0;
}
Node* findNodeByNameAndType(const QStringList& path, Node::NodeType type) {
foreach (Tree* t, searchOrder()) {
Node* n = t->findNodeByNameAndType(path, type);
if (n)
return n;
}
return 0;
}
ClassNode* findClassNode(const QStringList& path) {
foreach (Tree* t, searchOrder()) {
ClassNode* n = t->findClassNode(path);
if (n)
return n;
}
return 0;
}
Node* findNodeForInclude(const QStringList& path) {
foreach (Tree* t, searchOrder()) {
Node* n = t->findNodeForInclude(path);
if (n)
return n;
}
return 0;
}
Aggregate* findRelatesNode(const QStringList& path) {
foreach (Tree* t, searchOrder()) {
Aggregate* n = t->findRelatesNode(path);
if (n)
return n;
}
return 0;
}
const Node* findFunctionNode(const QString& target,
const Node* relative,
Node::Genus genus);
const Node* findNodeForTarget(QStringList& targetPath,
const Node* relative,
Node::Genus genus,
QString& ref);
const Node* findTypeNode(const QStringList& path, const Node* relative)
{
foreach (Tree* t, searchOrder()) {
int flags = SearchBaseClasses | SearchEnumValues | NonFunction;
const Node* n = t->findNode(path, relative, flags, Node::DontCare);
if (n)
return n;
relative = 0;
}
return 0;
}
const DocumentNode* findDocumentNodeByTitle(const QString& title)
{
foreach (Tree* t, searchOrder()) {
const DocumentNode* n = t->findDocumentNodeByTitle(title);
if (n)
return n;
}
return 0;
}
const CollectionNode* getCollectionNode(const QString& name, Node::Genus genus)
{
foreach (Tree* t, searchOrder()) {
const CollectionNode* cn = t->getCollection(name, genus);
if (cn)
return cn;
}
return 0;
}
QmlTypeNode* lookupQmlType(const QString& name)
{
foreach (Tree* t, searchOrder()) {
QmlTypeNode* qcn = t->lookupQmlType(name);
if (qcn)
return qcn;
}
return 0;
}
void clearSearchOrder() { searchOrder_.clear(); }
void clearLinkCounts()
{
foreach (Tree* t, searchOrder())
t->clearLinkCount();
}
void printLinkCounts(const QString& project);
QString getLinkCounts(QStringList& strings, QVector<int>& counts);
private:
void newPrimaryTree(const QString& module);
void setPrimaryTree(const QString& t);
NamespaceNode* newIndexTree(const QString& module);
private:
QDocDatabase* qdb_;
Tree* primaryTree_;
int currentIndex_;
QMap<QString, Tree*> forest_;
QVector<Tree*> searchOrder_;
QVector<Tree*> indexSearchOrder_;
QVector<QString> moduleNames_;
};
class QDocDatabase
{
Q_DECLARE_TR_FUNCTIONS(QDoc::QDocDatabase)
public:
static QDocDatabase* qdocDB();
static void destroyQdocDB();
~QDocDatabase();
Tree* findTree(const QString& t) { return forest_.findTree(t); }
const CNMap& groups() { return primaryTree()->groups(); }
const CNMap& modules() { return primaryTree()->modules(); }
const CNMap& qmlModules() { return primaryTree()->qmlModules(); }
const CNMap& jsModules() { return primaryTree()->jsModules(); }
CollectionNode* addGroup(const QString& name) { return primaryTree()->addGroup(name); }
CollectionNode* addModule(const QString& name) { return primaryTree()->addModule(name); }
CollectionNode* addQmlModule(const QString& name) { return primaryTree()->addQmlModule(name); }
CollectionNode* addJsModule(const QString& name) { return primaryTree()->addJsModule(name); }
CollectionNode* addToGroup(const QString& name, Node* node) {
return primaryTree()->addToGroup(name, node);
}
CollectionNode* addToModule(const QString& name, Node* node) {
return primaryTree()->addToModule(name, node);
}
CollectionNode* addToQmlModule(const QString& name, Node* node) {
return primaryTree()->addToQmlModule(name, node);
}
CollectionNode* addToJsModule(const QString& name, Node* node) {
return primaryTree()->addToJsModule(name, node);
}
void addExampleNode(ExampleNode* n) { primaryTree()->addExampleNode(n); }
ExampleNodeMap& exampleNodeMap() { return primaryTree()->exampleNodeMap(); }
QmlTypeNode* findQmlType(const QString& name);
QmlTypeNode* findQmlType(const QString& qmid, const QString& name);
QmlTypeNode* findQmlType(const ImportRec& import, const QString& name);
private:
void findAllClasses(Aggregate *node);
void findAllFunctions(Aggregate *node);
void findAllLegaleseTexts(Aggregate *node);
void findAllNamespaces(Aggregate *node);
void findAllObsoleteThings(Aggregate* node);
void findAllSince(Aggregate *node);
public:
/*******************************************************************
special collection access functions
********************************************************************/
NodeMultiMap& getCppClasses();
NodeMultiMap& getObsoleteClasses();
NodeMultiMap& getClassesWithObsoleteMembers();
NodeMultiMap& getObsoleteQmlTypes();
NodeMultiMap& getQmlTypesWithObsoleteMembers();
NodeMultiMap& getNamespaces() { resolveNamespaces(); return namespaceIndex_; }
NodeMultiMap& getQmlBasicTypes();
NodeMultiMap& getQmlTypes();
NodeMapMap& getFunctionIndex();
TextToNodeMap& getLegaleseTexts();
const NodeMap& getClassMap(const QString& key);
const NodeMap& getQmlTypeMap(const QString& key);
const NodeMap& getSinceMap(const QString& key);
/*******************************************************************
Many of these will be either eliminated or replaced.
********************************************************************/
void resolveInheritance() { primaryTree()->resolveInheritance(); }
void resolveQmlInheritance(Aggregate* root);
void resolveIssues();
void resolveStuff();
void fixInheritance() { primaryTree()->fixInheritance(); }
void resolveProperties() { primaryTree()->resolveProperties(); }
void insertTarget(const QString& name,
const QString& title,
TargetRec::TargetType type,
Node* node,
int priority) {
primaryTree()->insertTarget(name, title, type, node, priority);
}
/*******************************************************************
The functions declared below are called for the current tree only.
********************************************************************/
FunctionNode* findFunctionNode(const QStringList& parentPath, const FunctionNode* clone) {
return primaryTree()->findFunctionNode(parentPath, clone);
}
FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone);
Node* findNodeInOpenNamespace(QStringList& path, Node::NodeType type);
const Node* checkForCollision(const QString& name) {
return primaryTree()->checkForCollision(name);
}
/*******************************************************************/
/*******************************************************************
The functions declared below handle the parameters in '[' ']'.
********************************************************************/
const Node* findNodeForAtom(const Atom* atom, const Node* relative, QString& ref);
/*******************************************************************/
/*******************************************************************
The functions declared below are called for all trees.
********************************************************************/
ClassNode* findClassNode(const QStringList& path) { return forest_.findClassNode(path); }
Node* findNodeForInclude(const QStringList& path) { return forest_.findNodeForInclude(path); }
Aggregate* findRelatesNode(const QStringList& path) { return forest_.findRelatesNode(path); }
const Node* findFunctionNode(const QString& target, const Node* relative, Node::Genus genus) {
return forest_.findFunctionNode(target, relative, genus);
}
const Node* findTypeNode(const QString& type, const Node* relative);
const Node* findNodeForTarget(const QString& target, const Node* relative);
const DocumentNode* findDocumentNodeByTitle(const QString& title) {
return forest_.findDocumentNodeByTitle(title);
}
Node* findNodeByNameAndType(const QStringList& path, Node::NodeType type) {
return forest_.findNodeByNameAndType(path, type);
}
const CollectionNode* getCollectionNode(const QString& name, Node::Genus genus) {
return forest_.getCollectionNode(name, genus);
}
private:
const Node* findNodeForTarget(QStringList& targetPath,
const Node* relative,
Node::Genus genus,
QString& ref) {
return forest_.findNodeForTarget(targetPath, relative, genus, ref);
}
/*******************************************************************/
public:
void addPropertyFunction(PropertyNode* property,
const QString& funcName,
PropertyNode::FunctionRole funcRole) {
primaryTree()->addPropertyFunction(property, funcName, funcRole);
}
void setVersion(const QString& v) { version_ = v; }
QString version() const { return version_; }
void generateTagFile(const QString& name, Generator* g);
void readIndexes(const QStringList& indexFiles);
void generateIndex(const QString& fileName,
const QString& url,
const QString& title,
Generator* g,
bool generateInternalNodes = false);
void clearOpenNamespaces() { openNamespaces_.clear(); }
void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); }
void setShowInternal(bool value) { showInternal_ = value; }
void setSingleExec(bool value) { singleExec_ = value; }
void processForest();
// Try to make this function private.
QDocForest& forest() { return forest_; }
NamespaceNode* primaryTreeRoot() { return forest_.primaryTreeRoot(); }
void newPrimaryTree(const QString& module) { forest_.newPrimaryTree(module); }
void setPrimaryTree(const QString& t) { forest_.setPrimaryTree(t); }
NamespaceNode* newIndexTree(const QString& module) { return forest_.newIndexTree(module); }
const QVector<Tree*>& searchOrder() { return forest_.searchOrder(); }
void setLocalSearch() { forest_.searchOrder_ = QVector<Tree*>(1, primaryTree()); }
void setSearchOrder(const QVector<Tree*>& searchOrder) { forest_.searchOrder_ = searchOrder; }
void setSearchOrder(QStringList& t) { forest_.setSearchOrder(t); }
void mergeCollections(Node::Genus genus, CNMap& cnm, const Node* relative);
void mergeCollections(CollectionNode* c);
void clearSearchOrder() { forest_.clearSearchOrder(); }
void incrementLinkCount(const Node* t) { t->tree()->incrementLinkCount(); }
void clearLinkCounts() { forest_.clearLinkCounts(); }
void printLinkCounts(const QString& t) { forest_.printLinkCounts(t); }
QString getLinkCounts(QStringList& strings, QVector<int>& counts) {
return forest_.getLinkCounts(strings, counts);
}
QString getNewLinkTarget(const Node* locNode,
const Node* t,
const QString& fileName,
QString& text,
bool broken = false) {
return primaryTree()->getNewLinkTarget(locNode, t, fileName, text, broken);
}
TargetList* getTargetList(const QString& t) { return primaryTree()->getTargetList(t); }
QStringList getTargetListKeys() { return primaryTree()->getTargetListKeys(); }
QStringList keys() { return forest_.keys(); }
void resolveNamespaces();
private:
friend class QDocIndexFiles;
friend class QDocTagFiles;
const Node* findNode(const QStringList& path,
const Node* relative,
int findFlags,
Node::Genus genus) {
return forest_.findNode(path, relative, findFlags, genus);
}
void processForest(void (QDocDatabase::*) (Aggregate*));
bool isLoaded(const QString& t) { return forest_.isLoaded(t); }
static void initializeDB();
private:
QDocDatabase();
QDocDatabase(QDocDatabase const& ) : showInternal_(false), forest_(this) { }
QDocDatabase& operator=(QDocDatabase const& );
Tree* primaryTree() { return forest_.primaryTree(); }
public:
static bool debug;
private:
static QDocDatabase* qdocDB_;
static NodeMap typeNodeMap_;
bool showInternal_;
bool singleExec_;
QString version_;
QDocForest forest_;
NodeMultiMap cppClasses_;
NodeMultiMap obsoleteClasses_;
NodeMultiMap classesWithObsoleteMembers_;
NodeMultiMap obsoleteQmlTypes_;
NodeMultiMap qmlTypesWithObsoleteMembers_;
NodeMultiMap namespaceIndex_;
NodeMultiMap nmm_;
NodeMultiMap qmlBasicTypes_;
NodeMultiMap qmlTypes_;
NodeMapMap newClassMaps_;
NodeMapMap newQmlTypeMaps_;
NodeMultiMapMap newSinceMaps_;
NodeMapMap funcIndex_;
TextToNodeMap legaleseTexts_;
QSet<QString> openNamespaces_;
};
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,86 +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 QDOCINDEXFILES_H
#define QDOCINDEXFILES_H
#include "node.h"
#include "tree.h"
QT_BEGIN_NAMESPACE
class Atom;
class Generator;
class QStringList;
class QDocDatabase;
class QXmlStreamWriter;
class QXmlStreamAttributes;
class QDocIndexFiles
{
friend class QDocDatabase;
private:
static QDocIndexFiles* qdocIndexFiles();
static void destroyQDocIndexFiles();
QDocIndexFiles();
~QDocIndexFiles();
void readIndexes(const QStringList& indexFiles);
void generateIndex(const QString& fileName,
const QString& url,
const QString& title,
Generator* g,
bool generateInternalNodes = false);
void readIndexFile(const QString& path);
void readIndexSection(QXmlStreamReader &reader, Node* current, const QString& indexUrl);
void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes, Node *node);
void resolveIndex();
void resolveRelates();
bool generateIndexSection(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false);
void generateIndexSections(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false);
private:
static QDocIndexFiles* qdocIndexFiles_;
QDocDatabase* qdb_;
Generator* gen_;
QString project_;
QVector<QPair<ClassNode*,QString> > basesList_;
QVector<QPair<FunctionNode*,QString> > relatedList_;
};
QT_END_NAMESPACE
#endif

View File

@ -1,385 +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 "node.h"
#include "qdoctagfiles.h"
#include "qdocdatabase.h"
#include "atom.h"
#include "doc.h"
#include "htmlgenerator.h"
#include "location.h"
#include "node.h"
#include "text.h"
#include <limits.h>
#include <qdebug.h>
QT_BEGIN_NAMESPACE
/*!
\class QDocTagFiles
This class handles the generation of the qdoc tag file.
*/
QDocTagFiles* QDocTagFiles::qdocTagFiles_ = NULL;
/*!
Constructs the singleton. \a qdb is the pointer to the
qdoc database that is used when reading and writing the
index files.
*/
QDocTagFiles::QDocTagFiles()
{
qdb_ = QDocDatabase::qdocDB();
}
/*!
Destroys the singleton QDocTagFiles.
*/
QDocTagFiles::~QDocTagFiles()
{
qdb_ = 0;
}
/*!
Creates the singleton. Allows only one instance of the class
to be created. Returns a pointer to the singleton.
*/
QDocTagFiles* QDocTagFiles::qdocTagFiles()
{
if (!qdocTagFiles_)
qdocTagFiles_ = new QDocTagFiles;
return qdocTagFiles_;
}
/*!
Destroys the singleton.
*/
void QDocTagFiles::destroyQDocTagFiles()
{
if (qdocTagFiles_) {
delete qdocTagFiles_;
qdocTagFiles_ = 0;
}
}
/*!
Generate the tag file section with the given \a writer for the \a node
specified, returning true if an element was written; otherwise returns
false.
*/
void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter& writer, const Aggregate* inner)
{
foreach (const Node* node, inner->childNodes()) {
if (!node->url().isEmpty())
continue;
QString kind;
switch (node->type()) {
case Node::Namespace:
kind = "namespace";
break;
case Node::Class:
case Node::QmlType:
kind = "class";
break;
case Node::Enum:
case Node::Typedef:
case Node::Property:
case Node::Function:
case Node::Variable:
default:
continue;
}
QString access;
switch (node->access()) {
case Node::Public:
access = "public";
break;
case Node::Protected:
access = "protected";
break;
case Node::Private:
default:
continue;
}
QString objName = node->name();
// Special case: only the root node should have an empty name.
if (objName.isEmpty() && node != qdb_->primaryTreeRoot())
continue;
// *** Write the starting tag for the element here. ***
writer.writeStartElement("compound");
writer.writeAttribute("kind", kind);
if (node->type() == Node::Class) {
writer.writeTextElement("name", node->fullDocumentName());
writer.writeTextElement("filename", gen_->fullDocumentLocation(node, false));
// Classes contain information about their base classes.
const ClassNode* classNode = static_cast<const ClassNode*>(node);
QList<RelatedClass> bases = classNode->baseClasses();
foreach (const RelatedClass& related, bases) {
ClassNode* n = related.node_;
if (n)
writer.writeTextElement("base", n->name());
}
// Recurse to write all members.
generateTagFileMembers(writer, static_cast<const Aggregate*>(node));
writer.writeEndElement();
// Recurse to write all compounds.
generateTagFileCompounds(writer, static_cast<const Aggregate*>(node));
}
else {
writer.writeTextElement("name", node->fullDocumentName());
writer.writeTextElement("filename", gen_->fullDocumentLocation(node, false));
// Recurse to write all members.
generateTagFileMembers(writer, static_cast<const Aggregate*>(node));
writer.writeEndElement();
// Recurse to write all compounds.
generateTagFileCompounds(writer, static_cast<const Aggregate*>(node));
}
}
}
/*!
Writes all the members of the \a inner node with the \a writer.
The node represents a C++ class, namespace, etc.
*/
void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter& writer, const Aggregate* inner)
{
foreach (const Node* node, inner->childNodes()) {
if (!node->url().isEmpty())
continue;
QString nodeName;
QString kind;
switch (node->type()) {
case Node::Enum:
nodeName = "member";
kind = "enum";
break;
case Node::Typedef:
nodeName = "member";
kind = "typedef";
break;
case Node::Property:
nodeName = "member";
kind = "property";
break;
case Node::Function:
nodeName = "member";
kind = "function";
break;
case Node::Namespace:
nodeName = "namespace";
break;
case Node::Class:
nodeName = "class";
break;
case Node::Variable:
default:
continue;
}
QString access;
switch (node->access()) {
case Node::Public:
access = "public";
break;
case Node::Protected:
access = "protected";
break;
case Node::Private:
default:
continue;
}
QString objName = node->name();
// Special case: only the root node should have an empty name.
if (objName.isEmpty() && node != qdb_->primaryTreeRoot())
continue;
// *** Write the starting tag for the element here. ***
writer.writeStartElement(nodeName);
if (!kind.isEmpty())
writer.writeAttribute("kind", kind);
switch (node->type()) {
case Node::Class:
writer.writeCharacters(node->fullDocumentName());
writer.writeEndElement();
break;
case Node::Namespace:
writer.writeCharacters(node->fullDocumentName());
writer.writeEndElement();
break;
case Node::Function:
{
/*
Function nodes contain information about
the type of function being described.
*/
const FunctionNode* functionNode = static_cast<const FunctionNode*>(node);
writer.writeAttribute("protection", access);
switch (functionNode->virtualness()) {
case FunctionNode::NonVirtual:
writer.writeAttribute("virtualness", "non");
break;
case FunctionNode::NormalVirtual:
writer.writeAttribute("virtualness", "virtual");
break;
case FunctionNode::PureVirtual:
writer.writeAttribute("virtual", "pure");
break;
default:
break;
}
writer.writeAttribute("static", functionNode->isStatic() ? "yes" : "no");
if (functionNode->virtualness() == FunctionNode::NonVirtual)
writer.writeTextElement("type", functionNode->returnType());
else
writer.writeTextElement("type", "virtual " + functionNode->returnType());
writer.writeTextElement("name", objName);
QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
writer.writeTextElement("anchorfile", pieces[0]);
writer.writeTextElement("anchor", pieces[1]);
QString signature = functionNode->signature();
signature = signature.mid(signature.indexOf(QChar('('))).trimmed();
if (functionNode->isConst())
signature += " const";
if (functionNode->virtualness() == FunctionNode::PureVirtual)
signature += " = 0";
writer.writeTextElement("arglist", signature);
}
writer.writeEndElement(); // member
break;
case Node::Property:
{
const PropertyNode* propertyNode = static_cast<const PropertyNode*>(node);
writer.writeAttribute("type", propertyNode->dataType());
writer.writeTextElement("name", objName);
QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
writer.writeTextElement("anchorfile", pieces[0]);
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", QString());
}
writer.writeEndElement(); // member
break;
case Node::Enum:
{
const EnumNode* enumNode = static_cast<const EnumNode*>(node);
writer.writeTextElement("name", objName);
QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", QString());
writer.writeEndElement(); // member
for (int i = 0; i < enumNode->items().size(); ++i) {
EnumItem item = enumNode->items().value(i);
writer.writeStartElement("member");
writer.writeAttribute("name", item.name());
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", QString());
writer.writeEndElement(); // member
}
}
break;
case Node::Typedef:
{
const TypedefNode* typedefNode = static_cast<const TypedefNode*>(node);
if (typedefNode->associatedEnum())
writer.writeAttribute("type", typedefNode->associatedEnum()->fullDocumentName());
else
writer.writeAttribute("type", QString());
writer.writeTextElement("name", objName);
QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
writer.writeTextElement("anchorfile", pieces[0]);
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", QString());
}
writer.writeEndElement(); // member
break;
case Node::Variable:
default:
break;
}
}
}
/*!
Writes a tag file named \a fileName.
*/
void QDocTagFiles::generateTagFile(const QString& fileName, Generator* g)
{
QFile file(fileName);
QFileInfo fileInfo(fileName);
// If no path was specified or it doesn't exist,
// default to the output directory
if (fileInfo.fileName() == fileName || !fileInfo.dir().exists())
file.setFileName(gen_->outputDir() + QLatin1Char('/') +
fileInfo.fileName());
if (!file.open(QFile::WriteOnly | QFile::Text)) {
Location::null.warning(
QString("Failed to open %1 for writing.").arg(file.fileName()));
return;
}
gen_ = g;
QXmlStreamWriter writer(&file);
writer.setAutoFormatting(true);
writer.writeStartDocument();
writer.writeStartElement("tagfile");
generateTagFileCompounds(writer, qdb_->primaryTreeRoot());
writer.writeEndElement(); // tagfile
writer.writeEndDocument();
file.close();
}
QT_END_NAMESPACE

View File

@ -1,68 +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 QDOCTAGFILES_H
#define QDOCTAGFILES_H
#include "qxmlstream.h"
QT_BEGIN_NAMESPACE
class Aggregate;
class QDocDatabase;
class Generator;
class QDocTagFiles
{
friend class QDocDatabase;
private:
static QDocTagFiles* qdocTagFiles();
static void destroyQDocTagFiles();
QDocTagFiles();
~QDocTagFiles();
void generateTagFileCompounds(QXmlStreamWriter& writer, const Aggregate* inner);
void generateTagFileMembers(QXmlStreamWriter& writer, const Aggregate* inner);
void generateTagFile(const QString& fileName, Generator* g);
private:
static QDocTagFiles* qdocTagFiles_;
QDocDatabase* qdb_;
Generator* gen_;
};
QT_END_NAMESPACE
#endif

View File

@ -1,273 +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$
**
****************************************************************************/
/*
qmlcodemarker.cpp
*/
#include "qqmljsast_p.h"
#include "qqmljsastfwd_p.h"
#include "qqmljsengine_p.h"
#include "qqmljslexer_p.h"
#include "qqmljsparser_p.h"
#include "atom.h"
#include "node.h"
#include "qmlcodemarker.h"
#include "qmlmarkupvisitor.h"
#include "text.h"
#include "tree.h"
#include "generator.h"
QT_BEGIN_NAMESPACE
QmlCodeMarker::QmlCodeMarker()
{
}
QmlCodeMarker::~QmlCodeMarker()
{
}
/*!
Returns \c true if the \a code is recognized by the parser.
*/
bool QmlCodeMarker::recognizeCode(const QString &code)
{
QQmlJS::Engine engine;
QQmlJS::Lexer lexer(&engine);
QQmlJS::Parser parser(&engine);
QString newCode = code;
extractPragmas(newCode);
lexer.setCode(newCode, 1);
return parser.parse();
}
/*!
Returns \c true if \a ext is any of a list of file extensions
for the QML language.
*/
bool QmlCodeMarker::recognizeExtension(const QString &ext)
{
return ext == "qml";
}
/*!
Returns \c true if the \a language is recognized. Only "QML" is
recognized by this marker.
*/
bool QmlCodeMarker::recognizeLanguage(const QString &language)
{
return language == "QML";
}
/*!
Returns the type of atom used to represent QML code in the documentation.
*/
Atom::AtomType QmlCodeMarker::atomType() const
{
return Atom::Qml;
}
QString QmlCodeMarker::markedUpCode(const QString &code,
const Node *relative,
const Location &location)
{
return addMarkUp(code, relative, location);
}
QString QmlCodeMarker::markedUpName(const Node *node)
{
QString name = linkTag(node, taggedNode(node));
if (node->type() == Node::QmlMethod)
name += "()";
return name;
}
QString QmlCodeMarker::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 QmlCodeMarker::markedUpIncludes(const QStringList& includes)
{
QString code;
QStringList::ConstIterator inc = includes.constBegin();
while (inc != includes.constEnd()) {
code += "import " + *inc + QLatin1Char('\n');
++inc;
}
Location location;
return addMarkUp(code, 0, location);
}
QString QmlCodeMarker::functionBeginRegExp(const QString& funcName)
{
return QLatin1Char('^') + QRegExp::escape("function " + funcName) + QLatin1Char('$');
}
QString QmlCodeMarker::functionEndRegExp(const QString& /* funcName */)
{
return "^\\}$";
}
QString QmlCodeMarker::addMarkUp(const QString &code,
const Node * /* relative */,
const Location &location)
{
QQmlJS::Engine engine;
QQmlJS::Lexer lexer(&engine);
QString newCode = code;
QVector<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
lexer.setCode(newCode, 1);
QQmlJS::Parser parser(&engine);
QString output;
if (parser.parse()) {
QQmlJS::AST::UiProgram *ast = parser.ast();
// Pass the unmodified code to the visitor so that pragmas and other
// unhandled source text can be output.
QmlMarkupVisitor visitor(code, pragmas, &engine);
QQmlJS::AST::Node::accept(ast, &visitor);
output = visitor.markedUpCode();
} else {
location.warning(tr("Unable to parse QML snippet: \"%1\" at line %2, column %3").arg(
parser.errorMessage()).arg(parser.errorLineNumber()).arg(
parser.errorColumnNumber()));
output = protect(code);
}
return output;
}
/*
Copied and pasted from
src/declarative/qml/qqmlscriptparser.cpp.
*/
static void replaceWithSpace(QString &str, int idx, int n)
{
QChar *data = str.data() + idx;
const QChar space(QLatin1Char(' '));
for (int ii = 0; ii < n; ++ii)
*data++ = space;
}
/*
Copied and pasted from
src/declarative/qml/qqmlscriptparser.cpp then modified to
return a list of removed pragmas.
Searches for ".pragma <value>" or ".import <stuff>" declarations
in \a script. Currently supported pragmas are: library
*/
QVector<QQmlJS::AST::SourceLocation> QmlCodeMarker::extractPragmas(QString &script)
{
const QString pragma(QLatin1String("pragma"));
const QString library(QLatin1String("library"));
QVector<QQmlJS::AST::SourceLocation> removed;
QQmlJS::Lexer l(0);
l.setCode(script, 0);
int token = l.lex();
while (true) {
if (token != QQmlJSGrammar::T_DOT)
return removed;
int startOffset = l.tokenOffset();
int startLine = l.tokenStartLine();
int startColumn = l.tokenStartColumn();
token = l.lex();
if (token != QQmlJSGrammar::T_PRAGMA && token != QQmlJSGrammar::T_IMPORT)
return removed;
int endOffset = 0;
while (startLine == l.tokenStartLine()) {
endOffset = l.tokenLength() + l.tokenOffset();
token = l.lex();
}
replaceWithSpace(script, startOffset, endOffset - startOffset);
removed.append(QQmlJS::AST::SourceLocation(startOffset,
endOffset - startOffset,
startLine,
startColumn));
#if 0
token = l.lex();
if (Generator::debugging())
qDebug() << " third token";
if (token != QQmlJSGrammar::T_IDENTIFIER ||
l.tokenStartLine() != startLine)
return removed;
QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength());
int endOffset = l.tokenLength() + l.tokenOffset();
token = l.lex();
if (l.tokenStartLine() == startLine)
return removed;
if (pragmaValue == QLatin1String("library")) {
replaceWithSpace(script, startOffset, endOffset - startOffset);
removed.append(
QQmlJS::AST::SourceLocation(
startOffset, endOffset - startOffset,
startLine, startColumn));
} else
return removed;
#endif
}
return removed;
}
QT_END_NAMESPACE

View File

@ -1,78 +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$
**
****************************************************************************/
/*
qmlcodemarker.h
*/
#ifndef QMLCODEMARKER_H
#define QMLCODEMARKER_H
#include "qqmljsastfwd_p.h"
#include "cppcodemarker.h"
QT_BEGIN_NAMESPACE
class QmlCodeMarker : public CppCodeMarker
{
Q_DECLARE_TR_FUNCTIONS(QDoc::QmlCodeMarker)
public:
QmlCodeMarker();
~QmlCodeMarker();
virtual bool recognizeCode(const QString &code) Q_DECL_OVERRIDE;
virtual bool recognizeExtension(const QString &ext) Q_DECL_OVERRIDE;
virtual bool recognizeLanguage(const QString &language) 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 markedUpName(const Node *node) Q_DECL_OVERRIDE;
virtual QString markedUpFullName(const Node *node, 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;
/* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */
QVector<QQmlJS::AST::SourceLocation> extractPragmas(QString &script);
private:
QString addMarkUp(const QString &code, const Node *relative,
const Location &location);
};
QT_END_NAMESPACE
#endif

View File

@ -1,331 +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$
**
****************************************************************************/
/*
qmlcodeparser.cpp
*/
#include "qqmljsast_p.h"
#include "qqmljsastvisitor_p.h"
#include "qmlcodeparser.h"
#include "node.h"
#include "config.h"
#include "qmlvisitor.h"
#include <qdebug.h>
QT_BEGIN_NAMESPACE
#define COMMAND_STARTPAGE Doc::alias("startpage")
#define COMMAND_VARIABLE Doc::alias("variable")
#define COMMAND_DEPRECATED Doc::alias("deprecated")
#define COMMAND_INGROUP Doc::alias("ingroup")
#define COMMAND_INTERNAL Doc::alias("internal")
#define COMMAND_OBSOLETE Doc::alias("obsolete")
#define COMMAND_PAGEKEYWORDS Doc::alias("pagekeywords")
#define COMMAND_PRELIMINARY Doc::alias("preliminary")
#define COMMAND_SINCE Doc::alias("since")
#define COMMAND_WRAPPER Doc::alias("wrapper")
#define COMMAND_NOAUTOLIST Doc::alias("noautolist")
#define COMMAND_ABSTRACT Doc::alias("abstract")
#define COMMAND_QMLABSTRACT Doc::alias("qmlabstract")
#define COMMAND_QMLCLASS Doc::alias("qmlclass")
#define COMMAND_QMLTYPE Doc::alias("qmltype")
#define COMMAND_QMLMODULE Doc::alias("qmlmodule")
#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_INQMLMODULE Doc::alias("inqmlmodule")
#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_JSTYPE Doc::alias("jstype")
#define COMMAND_JSMODULE Doc::alias("jsmodule")
#define COMMAND_JSPROPERTY Doc::alias("jsproperty")
#define COMMAND_JSPROPERTYGROUP Doc::alias("jspropertygroup")
#define COMMAND_JSATTACHEDPROPERTY Doc::alias("jsattachedproperty")
#define COMMAND_INJSMODULE Doc::alias("injsmodule")
#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")
/*!
Constructs the QML code parser.
*/
QmlCodeParser::QmlCodeParser()
: lexer( 0 ),
parser( 0 )
{
}
/*!
Destroys the QML code parser.
*/
QmlCodeParser::~QmlCodeParser()
{
}
/*!
Initializes the code parser base class. The \a config argument
is passed to the initialization functions in the base class.
Also creates a lexer and parser from QQmlJS.
*/
void QmlCodeParser::initializeParser(const Config &config)
{
CodeParser::initializeParser(config);
lexer = new QQmlJS::Lexer(&engine);
parser = new QQmlJS::Parser(&engine);
}
/*!
Terminates the QML code parser. Deletes the lexer and parser
created by the constructor.
*/
void QmlCodeParser::terminateParser()
{
delete lexer;
delete parser;
}
/*!
Returns "QML".
*/
QString QmlCodeParser::language()
{
return "QML";
}
/*!
Returns a string list containing "*.qml". This is the only
file type parsed by the QMLN parser.
*/
QStringList QmlCodeParser::sourceFileNameFilter()
{
return QStringList() << "*.qml";
}
/*!
Parses the source file at \a filePath and inserts the contents
into the database. The \a location is used for error reporting.
If it can't open the file at \a filePath, it reports an error
and returns without doing anything.
*/
void QmlCodeParser::parseSourceFile(const Location& location, const QString& filePath)
{
QFile in(filePath);
currentFile_ = filePath;
if (!in.open(QIODevice::ReadOnly)) {
location.error(tr("Cannot open QML file '%1'").arg(filePath));
currentFile_.clear();
return;
}
QString document = in.readAll();
in.close();
Location fileLocation(filePath);
QString newCode = document;
extractPragmas(newCode);
lexer->setCode(newCode, 1);
const QSet<QString>& topicCommandsAllowed = topicCommands();
const QSet<QString>& otherMetacommandsAllowed = otherMetaCommands();
const QSet<QString>& metacommandsAllowed = topicCommandsAllowed + otherMetacommandsAllowed;
if (parser->parse()) {
QQmlJS::AST::UiProgram *ast = parser->ast();
QmlDocVisitor visitor(filePath,
newCode,
&engine,
metacommandsAllowed,
topicCommandsAllowed);
QQmlJS::AST::Node::accept(ast, &visitor);
}
foreach (const QQmlJS::DiagnosticMessage &msg, parser->diagnosticMessages()) {
qDebug().nospace() << qPrintable(filePath) << ':' << msg.loc.startLine
<< ": QML syntax error at col " << msg.loc.startColumn
<< ": " << qPrintable(msg.message);
}
currentFile_.clear();
}
/*!
Performs cleanup after qdoc is done parsing all the QML files.
Currently, no cleanup is required.
*/
void QmlCodeParser::doneParsingSourceFiles()
{
}
static QSet<QString> topicCommands_;
/*!
Returns the set of strings representing the topic commands.
*/
const QSet<QString>& QmlCodeParser::topicCommands()
{
if (topicCommands_.isEmpty()) {
topicCommands_ << COMMAND_VARIABLE
<< COMMAND_QMLCLASS
<< COMMAND_QMLTYPE
<< COMMAND_QMLPROPERTY
<< COMMAND_QMLPROPERTYGROUP
<< COMMAND_QMLATTACHEDPROPERTY
<< COMMAND_QMLSIGNAL
<< COMMAND_QMLATTACHEDSIGNAL
<< COMMAND_QMLMETHOD
<< COMMAND_QMLATTACHEDMETHOD
<< COMMAND_QMLBASICTYPE
<< COMMAND_JSTYPE
<< COMMAND_JSPROPERTY
<< COMMAND_JSPROPERTYGROUP
<< COMMAND_JSATTACHEDPROPERTY
<< COMMAND_JSSIGNAL
<< COMMAND_JSATTACHEDSIGNAL
<< COMMAND_JSMETHOD
<< COMMAND_JSATTACHEDMETHOD
<< COMMAND_JSBASICTYPE;
}
return topicCommands_;
}
static QSet<QString> otherMetaCommands_;
/*!
Returns the set of strings representing the common metacommands
plus some other metacommands.
*/
const QSet<QString>& QmlCodeParser::otherMetaCommands()
{
if (otherMetaCommands_.isEmpty()) {
otherMetaCommands_ = commonMetaCommands();
otherMetaCommands_ << COMMAND_STARTPAGE
<< COMMAND_QMLINHERITS
<< COMMAND_QMLDEFAULT
<< COMMAND_QMLREADONLY
<< COMMAND_DEPRECATED
<< COMMAND_INGROUP
<< COMMAND_INTERNAL
<< COMMAND_OBSOLETE
<< COMMAND_PRELIMINARY
<< COMMAND_SINCE
<< COMMAND_ABSTRACT
<< COMMAND_QMLABSTRACT
<< COMMAND_INQMLMODULE
<< COMMAND_INJSMODULE
<< COMMAND_WRAPPER
<< COMMAND_NOAUTOLIST;
}
return otherMetaCommands_;
}
/*!
Copy and paste from src/declarative/qml/qdeclarativescriptparser.cpp.
This function blanks out the section of the \a str beginning at \a idx
and running for \a n characters.
*/
static void replaceWithSpace(QString &str, int idx, int n)
{
QChar *data = str.data() + idx;
const QChar space(QLatin1Char(' '));
for (int ii = 0; ii < n; ++ii)
*data++ = space;
}
/*!
Copy & paste from src/declarative/qml/qdeclarativescriptparser.cpp,
then modified to return no values.
Searches for ".pragma <value>" declarations within \a script.
Currently supported pragmas are: library
*/
void QmlCodeParser::extractPragmas(QString &script)
{
const QString pragma(QLatin1String("pragma"));
const QString library(QLatin1String("library"));
QQmlJS::Lexer l(0);
l.setCode(script, 0);
int token = l.lex();
while (true) {
if (token != QQmlJSGrammar::T_DOT)
return;
int startOffset = l.tokenOffset();
int startLine = l.tokenStartLine();
token = l.lex();
if (token != QQmlJSGrammar::T_IDENTIFIER ||
l.tokenStartLine() != startLine ||
script.mid(l.tokenOffset(), l.tokenLength()) != pragma)
return;
token = l.lex();
if (token != QQmlJSGrammar::T_IDENTIFIER ||
l.tokenStartLine() != startLine)
return;
QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength());
int endOffset = l.tokenLength() + l.tokenOffset();
token = l.lex();
if (l.tokenStartLine() == startLine)
return;
if (pragmaValue == QLatin1String("library"))
replaceWithSpace(script, startOffset, endOffset - startOffset);
else
return;
}
return;
}
QT_END_NAMESPACE

View File

@ -1,84 +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$
**
****************************************************************************/
/*
qmlcodeparser.h
*/
#ifndef QMLCODEPARSER_H
#define QMLCODEPARSER_H
#include <qset.h>
#include "qqmljsengine_p.h"
#include "qqmljslexer_p.h"
#include "qqmljsparser_p.h"
#include "codeparser.h"
QT_BEGIN_NAMESPACE
class Config;
class Node;
class QString;
class QmlCodeParser : public CodeParser
{
Q_DECLARE_TR_FUNCTIONS(QDoc::QmlCodeParser)
public:
QmlCodeParser();
virtual ~QmlCodeParser();
virtual void initializeParser(const Config& config) Q_DECL_OVERRIDE;
virtual void terminateParser() Q_DECL_OVERRIDE;
virtual QString language() Q_DECL_OVERRIDE;
virtual QStringList sourceFileNameFilter() Q_DECL_OVERRIDE;
virtual void parseSourceFile(const Location& location, const QString& filePath) Q_DECL_OVERRIDE;
virtual void doneParsingSourceFiles() Q_DECL_OVERRIDE;
/* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */
void extractPragmas(QString &script);
protected:
const QSet<QString>& topicCommands();
const QSet<QString>& otherMetaCommands();
private:
QQmlJS::Engine engine;
QQmlJS::Lexer *lexer;
QQmlJS::Parser *parser;
};
QT_END_NAMESPACE
#endif

View File

@ -1,844 +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 <qstringlist.h>
#include <qglobal.h>
#include "qqmljsast_p.h"
#include "qqmljsastfwd_p.h"
#include "qqmljsengine_p.h"
#include "qmlmarkupvisitor.h"
QT_BEGIN_NAMESPACE
QmlMarkupVisitor::QmlMarkupVisitor(const QString &source,
const QVector<QQmlJS::AST::SourceLocation> &pragmas,
QQmlJS::Engine *engine)
{
this->source = source;
this->engine = engine;
cursor = 0;
extraIndex = 0;
// Merge the lists of locations of pragmas and comments in the source code.
int i = 0;
int j = 0;
const QVector<QQmlJS::AST::SourceLocation> comments = engine->comments();
while (i < comments.size() && j < pragmas.length()) {
if (comments[i].offset < pragmas[j].offset) {
extraTypes.append(Comment);
extraLocations.append(comments[i]);
++i;
} else {
extraTypes.append(Pragma);
extraLocations.append(comments[j]);
++j;
}
}
while (i < comments.size()) {
extraTypes.append(Comment);
extraLocations.append(comments[i]);
++i;
}
while (j < pragmas.length()) {
extraTypes.append(Pragma);
extraLocations.append(pragmas[j]);
++j;
}
}
QmlMarkupVisitor::~QmlMarkupVisitor()
{
}
// The protect() function is a copy of the one from CppCodeMarker.
static const QString samp = QLatin1String("&amp;");
static const QString slt = QLatin1String("&lt;");
static const QString sgt = QLatin1String("&gt;");
static const QString squot = QLatin1String("&quot;");
QString QmlMarkupVisitor::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;
}
QString QmlMarkupVisitor::markedUpCode()
{
if (int(cursor) < source.length())
addExtra(cursor, source.length());
return output;
}
void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish)
{
if (extraIndex >= extraLocations.length()) {
QString extra = source.mid(start, finish - start);
if (extra.trimmed().isEmpty())
output += extra;
else
output += protect(extra); // text that should probably have been caught by the parser
cursor = finish;
return;
}
while (extraIndex < extraLocations.length()) {
if (extraTypes[extraIndex] == Comment) {
if (extraLocations[extraIndex].offset - 2 >= start)
break;
} else {
if (extraLocations[extraIndex].offset >= start)
break;
}
extraIndex++;
}
quint32 i = start;
while (i < finish && extraIndex < extraLocations.length()) {
quint32 j = extraLocations[extraIndex].offset - 2;
if (i <= j && j < finish) {
if (i < j)
output += protect(source.mid(i, j - i));
quint32 l = extraLocations[extraIndex].length;
if (extraTypes[extraIndex] == Comment) {
if (source.mid(j, 2) == QLatin1String("/*"))
l += 4;
else
l += 2;
output += QLatin1String("<@comment>");
output += protect(source.mid(j, l));
output += QLatin1String("</@comment>");
} else
output += protect(source.mid(j, l));
extraIndex++;
i = j + l;
} else
break;
}
QString extra = source.mid(i, finish - i);
if (extra.trimmed().isEmpty())
output += extra;
else
output += protect(extra); // text that should probably have been caught by the parser
cursor = finish;
}
void QmlMarkupVisitor::addMarkedUpToken(
QQmlJS::AST::SourceLocation &location, const QString &tagName,
const QHash<QString, QString> &attributes)
{
if (!location.isValid())
return;
if (cursor < location.offset)
addExtra(cursor, location.offset);
else if (cursor > location.offset)
return;
output += QString(QLatin1String("<@%1")).arg(tagName);
foreach (const QString &key, attributes)
output += QString(QLatin1String(" %1=\"%2\"")).arg(key).arg(attributes[key]);
output += QString(QLatin1String(">%2</@%3>")).arg(protect(sourceText(location)), tagName);
cursor += location.length;
}
QString QmlMarkupVisitor::sourceText(QQmlJS::AST::SourceLocation &location)
{
return source.mid(location.offset, location.length);
}
void QmlMarkupVisitor::addVerbatim(QQmlJS::AST::SourceLocation first,
QQmlJS::AST::SourceLocation last)
{
if (!first.isValid())
return;
quint32 start = first.begin();
quint32 finish;
if (last.isValid())
finish = last.end();
else
finish = first.end();
if (cursor < start)
addExtra(cursor, start);
else if (cursor > start)
return;
QString text = source.mid(start, finish - start);
output += protect(text);
cursor = finish;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiImport *uiimport)
{
addVerbatim(uiimport->importToken);
if (!uiimport->importUri)
addMarkedUpToken(uiimport->fileNameToken, QLatin1String("headerfile"));
return false;
}
void QmlMarkupVisitor::endVisit(QQmlJS::AST::UiImport *uiimport)
{
addVerbatim(uiimport->versionToken);
addVerbatim(uiimport->asToken);
addMarkedUpToken(uiimport->importIdToken, QLatin1String("headerfile"));
addVerbatim(uiimport->semicolonToken);
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiPublicMember *member)
{
if (member->type == QQmlJS::AST::UiPublicMember::Property) {
addVerbatim(member->defaultToken);
addVerbatim(member->readonlyToken);
addVerbatim(member->propertyToken);
addVerbatim(member->typeModifierToken);
addMarkedUpToken(member->typeToken, QLatin1String("type"));
addMarkedUpToken(member->identifierToken, QLatin1String("name"));
addVerbatim(member->colonToken);
if (member->binding)
QQmlJS::AST::Node::accept(member->binding, this);
else if (member->statement)
QQmlJS::AST::Node::accept(member->statement, this);
} else {
addVerbatim(member->propertyToken);
addVerbatim(member->typeModifierToken);
addMarkedUpToken(member->typeToken, QLatin1String("type"));
//addVerbatim(member->identifierToken);
QQmlJS::AST::Node::accept(member->parameters, this);
}
addVerbatim(member->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiObjectInitializer *initializer)
{
addVerbatim(initializer->lbraceToken, initializer->lbraceToken);
return true;
}
void QmlMarkupVisitor::endVisit(QQmlJS::AST::UiObjectInitializer *initializer)
{
addVerbatim(initializer->rbraceToken, initializer->rbraceToken);
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiObjectBinding *binding)
{
QQmlJS::AST::Node::accept(binding->qualifiedId, this);
addVerbatim(binding->colonToken);
QQmlJS::AST::Node::accept(binding->qualifiedTypeNameId, this);
QQmlJS::AST::Node::accept(binding->initializer, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiScriptBinding *binding)
{
QQmlJS::AST::Node::accept(binding->qualifiedId, this);
addVerbatim(binding->colonToken);
QQmlJS::AST::Node::accept(binding->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiArrayBinding *binding)
{
QQmlJS::AST::Node::accept(binding->qualifiedId, this);
addVerbatim(binding->colonToken);
addVerbatim(binding->lbracketToken);
QQmlJS::AST::Node::accept(binding->members, this);
addVerbatim(binding->rbracketToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiArrayMemberList *list)
{
for (QQmlJS::AST::UiArrayMemberList *it = list; it; it = it->next) {
QQmlJS::AST::Node::accept(it->member, this);
//addVerbatim(it->commaToken);
}
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiQualifiedId *id)
{
addMarkedUpToken(id->identifierToken, QLatin1String("name"));
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ThisExpression *expression)
{
addVerbatim(expression->thisToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::IdentifierExpression *identifier)
{
addMarkedUpToken(identifier->identifierToken, QLatin1String("name"));
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::NullExpression *null)
{
addMarkedUpToken(null->nullToken, QLatin1String("number"));
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::TrueLiteral *literal)
{
addMarkedUpToken(literal->trueToken, QLatin1String("number"));
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::FalseLiteral *literal)
{
addMarkedUpToken(literal->falseToken, QLatin1String("number"));
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::NumericLiteral *literal)
{
addMarkedUpToken(literal->literalToken, QLatin1String("number"));
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::StringLiteral *literal)
{
addMarkedUpToken(literal->literalToken, QLatin1String("string"));
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::RegExpLiteral *literal)
{
addVerbatim(literal->literalToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ArrayLiteral *literal)
{
addVerbatim(literal->lbracketToken);
QQmlJS::AST::Node::accept(literal->elements, this);
addVerbatim(literal->rbracketToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ObjectLiteral *literal)
{
addVerbatim(literal->lbraceToken);
return true;
}
void QmlMarkupVisitor::endVisit(QQmlJS::AST::ObjectLiteral *literal)
{
addVerbatim(literal->rbraceToken);
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ElementList *list)
{
for (QQmlJS::AST::ElementList *it = list; it; it = it->next) {
QQmlJS::AST::Node::accept(it->expression, this);
//addVerbatim(it->commaToken);
}
QQmlJS::AST::Node::accept(list->elision, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::Elision *elision)
{
addVerbatim(elision->commaToken, elision->commaToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::PropertyNameAndValue *list)
{
QQmlJS::AST::Node::accept(list->name, this);
addVerbatim(list->colonToken, list->colonToken);
QQmlJS::AST::Node::accept(list->value, this);
addVerbatim(list->commaToken, list->commaToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ArrayMemberExpression *expression)
{
QQmlJS::AST::Node::accept(expression->base, this);
addVerbatim(expression->lbracketToken);
QQmlJS::AST::Node::accept(expression->expression, this);
addVerbatim(expression->rbracketToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::FieldMemberExpression *expression)
{
QQmlJS::AST::Node::accept(expression->base, this);
addVerbatim(expression->dotToken);
addMarkedUpToken(expression->identifierToken, QLatin1String("name"));
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::NewMemberExpression *expression)
{
addVerbatim(expression->newToken);
QQmlJS::AST::Node::accept(expression->base, this);
addVerbatim(expression->lparenToken);
QQmlJS::AST::Node::accept(expression->arguments, this);
addVerbatim(expression->rparenToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::NewExpression *expression)
{
addVerbatim(expression->newToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ArgumentList *list)
{
addVerbatim(list->commaToken, list->commaToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::PostIncrementExpression *expression)
{
addVerbatim(expression->incrementToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::PostDecrementExpression *expression)
{
addVerbatim(expression->decrementToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::DeleteExpression *expression)
{
addVerbatim(expression->deleteToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::VoidExpression *expression)
{
addVerbatim(expression->voidToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::TypeOfExpression *expression)
{
addVerbatim(expression->typeofToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::PreIncrementExpression *expression)
{
addVerbatim(expression->incrementToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::PreDecrementExpression *expression)
{
addVerbatim(expression->decrementToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UnaryPlusExpression *expression)
{
addVerbatim(expression->plusToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::UnaryMinusExpression *expression)
{
addVerbatim(expression->minusToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::TildeExpression *expression)
{
addVerbatim(expression->tildeToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::NotExpression *expression)
{
addVerbatim(expression->notToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::BinaryExpression *expression)
{
QQmlJS::AST::Node::accept(expression->left, this);
addMarkedUpToken(expression->operatorToken, QLatin1String("op"));
QQmlJS::AST::Node::accept(expression->right, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ConditionalExpression *expression)
{
QQmlJS::AST::Node::accept(expression->expression, this);
addVerbatim(expression->questionToken);
QQmlJS::AST::Node::accept(expression->ok, this);
addVerbatim(expression->colonToken);
QQmlJS::AST::Node::accept(expression->ko, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::Expression *expression)
{
QQmlJS::AST::Node::accept(expression->left, this);
addVerbatim(expression->commaToken);
QQmlJS::AST::Node::accept(expression->right, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::Block *block)
{
addVerbatim(block->lbraceToken);
return true;
}
void QmlMarkupVisitor::endVisit(QQmlJS::AST::Block *block)
{
addVerbatim(block->rbraceToken);
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::VariableStatement *statement)
{
addVerbatim(statement->declarationKindToken);
QQmlJS::AST::Node::accept(statement->declarations, this);
addVerbatim(statement->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::VariableDeclarationList *list)
{
for (QQmlJS::AST::VariableDeclarationList *it = list; it; it = it->next) {
QQmlJS::AST::Node::accept(it->declaration, this);
addVerbatim(it->commaToken);
}
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::VariableDeclaration *declaration)
{
addMarkedUpToken(declaration->identifierToken, QLatin1String("name"));
QQmlJS::AST::Node::accept(declaration->expression, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::EmptyStatement *statement)
{
addVerbatim(statement->semicolonToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ExpressionStatement *statement)
{
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::IfStatement *statement)
{
addMarkedUpToken(statement->ifToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->ok, this);
if (statement->ko) {
addMarkedUpToken(statement->elseToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(statement->ko, this);
}
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::DoWhileStatement *statement)
{
addMarkedUpToken(statement->doToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(statement->statement, this);
addMarkedUpToken(statement->whileToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
addVerbatim(statement->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::WhileStatement *statement)
{
addMarkedUpToken(statement->whileToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ForStatement *statement)
{
addMarkedUpToken(statement->forToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
QQmlJS::AST::Node::accept(statement->initialiser, this);
addVerbatim(statement->firstSemicolonToken);
QQmlJS::AST::Node::accept(statement->condition, this);
addVerbatim(statement->secondSemicolonToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::LocalForStatement *statement)
{
addMarkedUpToken(statement->forToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
addMarkedUpToken(statement->varToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(statement->declarations, this);
addVerbatim(statement->firstSemicolonToken);
QQmlJS::AST::Node::accept(statement->condition, this);
addVerbatim(statement->secondSemicolonToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ForEachStatement *statement)
{
addMarkedUpToken(statement->forToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
QQmlJS::AST::Node::accept(statement->initialiser, this);
addVerbatim(statement->inToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::LocalForEachStatement *statement)
{
addMarkedUpToken(statement->forToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
addMarkedUpToken(statement->varToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(statement->declaration, this);
addVerbatim(statement->inToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ContinueStatement *statement)
{
addMarkedUpToken(statement->continueToken, QLatin1String("keyword"));
addMarkedUpToken(statement->identifierToken, QLatin1String("name"));
addVerbatim(statement->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::BreakStatement *statement)
{
addMarkedUpToken(statement->breakToken, QLatin1String("keyword"));
addMarkedUpToken(statement->identifierToken, QLatin1String("name"));
addVerbatim(statement->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ReturnStatement *statement)
{
addMarkedUpToken(statement->returnToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::WithStatement *statement)
{
addMarkedUpToken(statement->withToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::CaseBlock *block)
{
addVerbatim(block->lbraceToken);
return true;
}
void QmlMarkupVisitor::endVisit(QQmlJS::AST::CaseBlock *block)
{
addVerbatim(block->rbraceToken, block->rbraceToken);
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::SwitchStatement *statement)
{
addMarkedUpToken(statement->switchToken, QLatin1String("keyword"));
addVerbatim(statement->lparenToken);
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->rparenToken);
QQmlJS::AST::Node::accept(statement->block, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::CaseClause *clause)
{
addMarkedUpToken(clause->caseToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(clause->expression, this);
addVerbatim(clause->colonToken);
QQmlJS::AST::Node::accept(clause->statements, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::DefaultClause *clause)
{
addMarkedUpToken(clause->defaultToken, QLatin1String("keyword"));
addVerbatim(clause->colonToken, clause->colonToken);
return true;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::LabelledStatement *statement)
{
addMarkedUpToken(statement->identifierToken, QLatin1String("name"));
addVerbatim(statement->colonToken);
QQmlJS::AST::Node::accept(statement->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::ThrowStatement *statement)
{
addMarkedUpToken(statement->throwToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(statement->expression, this);
addVerbatim(statement->semicolonToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::Catch *c)
{
addMarkedUpToken(c->catchToken, QLatin1String("keyword"));
addVerbatim(c->lparenToken);
addMarkedUpToken(c->identifierToken, QLatin1String("name"));
addVerbatim(c->rparenToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::Finally *f)
{
addMarkedUpToken(f->finallyToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(f->statement, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::TryStatement *statement)
{
addMarkedUpToken(statement->tryToken, QLatin1String("keyword"));
QQmlJS::AST::Node::accept(statement->statement, this);
QQmlJS::AST::Node::accept(statement->catchExpression, this);
QQmlJS::AST::Node::accept(statement->finallyExpression, this);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::FunctionExpression *expression)
{
addMarkedUpToken(expression->functionToken, QLatin1String("keyword"));
addMarkedUpToken(expression->identifierToken, QLatin1String("name"));
addVerbatim(expression->lparenToken);
QQmlJS::AST::Node::accept(expression->formals, this);
addVerbatim(expression->rparenToken);
addVerbatim(expression->lbraceToken);
QQmlJS::AST::Node::accept(expression->body, this);
addVerbatim(expression->rbraceToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::FunctionDeclaration *declaration)
{
addMarkedUpToken(declaration->functionToken, QLatin1String("keyword"));
addMarkedUpToken(declaration->identifierToken, QLatin1String("name"));
addVerbatim(declaration->lparenToken);
QQmlJS::AST::Node::accept(declaration->formals, this);
addVerbatim(declaration->rparenToken);
addVerbatim(declaration->lbraceToken);
QQmlJS::AST::Node::accept(declaration->body, this);
addVerbatim(declaration->rbraceToken);
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::FormalParameterList *list)
{
addVerbatim(list->commaToken);
addMarkedUpToken(list->identifierToken, QLatin1String("name"));
return false;
}
bool QmlMarkupVisitor::visit(QQmlJS::AST::DebuggerStatement *statement)
{
addVerbatim(statement->debuggerToken);
addVerbatim(statement->semicolonToken);
return true;
}
// Elements and items are represented by UiObjectDefinition nodes.
bool QmlMarkupVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
{
QHash<QString, QString> attributes;
addMarkedUpToken(definition->qualifiedTypeNameId->identifierToken, QLatin1String("type"));
QQmlJS::AST::Node::accept(definition->initializer, this);
return false;
}
QT_END_NAMESPACE

View File

@ -1,171 +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 QMLMARKUPVISITOR_H
#define QMLMARKUPVISITOR_H
#include <qstring.h>
#include "qqmljsastvisitor_p.h"
#include "node.h"
#include "tree.h"
QT_BEGIN_NAMESPACE
class QmlMarkupVisitor : public QQmlJS::AST::Visitor
{
public:
enum ExtraType{
Comment,
Pragma
};
QmlMarkupVisitor(const QString &code,
const QVector<QQmlJS::AST::SourceLocation> &pragmas,
QQmlJS::Engine *engine);
virtual ~QmlMarkupVisitor();
QString markedUpCode();
virtual bool visit(QQmlJS::AST::UiImport *) Q_DECL_OVERRIDE;
virtual void endVisit(QQmlJS::AST::UiImport *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiPublicMember *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiObjectDefinition *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiObjectInitializer *) Q_DECL_OVERRIDE;
virtual void endVisit(QQmlJS::AST::UiObjectInitializer *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiObjectBinding *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiScriptBinding *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiArrayBinding *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiArrayMemberList *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UiQualifiedId *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ThisExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::IdentifierExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::NullExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::TrueLiteral *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::FalseLiteral *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::NumericLiteral *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::StringLiteral *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::RegExpLiteral *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ArrayLiteral *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ObjectLiteral *) Q_DECL_OVERRIDE;
virtual void endVisit(QQmlJS::AST::ObjectLiteral *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ElementList *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::Elision *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::PropertyNameAndValue *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ArrayMemberExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::FieldMemberExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::NewMemberExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::NewExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ArgumentList *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::PostIncrementExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::PostDecrementExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::DeleteExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::VoidExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::TypeOfExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::PreIncrementExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::PreDecrementExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UnaryPlusExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::UnaryMinusExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::TildeExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::NotExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::BinaryExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ConditionalExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::Expression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::Block *) Q_DECL_OVERRIDE;
virtual void endVisit(QQmlJS::AST::Block *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::VariableStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::VariableDeclarationList *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::VariableDeclaration *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::EmptyStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ExpressionStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::IfStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::DoWhileStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::WhileStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ForStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::LocalForStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ForEachStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::LocalForEachStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ContinueStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::BreakStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ReturnStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::WithStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::CaseBlock *) Q_DECL_OVERRIDE;
virtual void endVisit(QQmlJS::AST::CaseBlock *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::SwitchStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::CaseClause *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::DefaultClause *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::LabelledStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::ThrowStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::TryStatement *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::Catch *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::Finally *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::FunctionDeclaration *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::FunctionExpression *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::FormalParameterList *) Q_DECL_OVERRIDE;
virtual bool visit(QQmlJS::AST::DebuggerStatement *) Q_DECL_OVERRIDE;
protected:
QString protect(const QString &string);
private:
typedef QHash<QString, QString> StringHash;
void addExtra(quint32 start, quint32 finish);
void addMarkedUpToken(QQmlJS::AST::SourceLocation &location,
const QString &text,
const StringHash &attributes = StringHash());
void addVerbatim(QQmlJS::AST::SourceLocation first,
QQmlJS::AST::SourceLocation last = QQmlJS::AST::SourceLocation());
QString sourceText(QQmlJS::AST::SourceLocation &location);
QQmlJS::Engine *engine;
QVector<ExtraType> extraTypes;
QVector<QQmlJS::AST::SourceLocation> extraLocations;
QString source;
QString output;
quint32 cursor;
int extraIndex;
};
Q_DECLARE_TYPEINFO(QmlMarkupVisitor::ExtraType, Q_PRIMITIVE_TYPE);
QT_END_NAMESPACE
#endif

View File

@ -1,22 +0,0 @@
HEADERS += \
$$PWD/qqmljsast_p.h \
$$PWD/qqmljsastfwd_p.h \
$$PWD/qqmljsastvisitor_p.h \
$$PWD/qqmljsengine_p.h \
$$PWD/qqmljsgrammar_p.h \
$$PWD/qqmljslexer_p.h \
$$PWD/qqmljsmemorypool_p.h \
$$PWD/qqmljsparser_p.h \
$$PWD/qqmljsglobal_p.h \
$$PWD/qqmljskeywords_p.h \
SOURCES += \
$$PWD/qqmljsast.cpp \
$$PWD/qqmljsastvisitor.cpp \
$$PWD/qqmljsengine_p.cpp \
$$PWD/qqmljsgrammar.cpp \
$$PWD/qqmljslexer.cpp \
$$PWD/qqmljsparser.cpp \
OTHER_FILES += \
$$PWD/qqmljs.g

File diff suppressed because it is too large Load Diff

View File

@ -1,968 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module 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 "qqmljsast_p.h"
#include "qqmljsastvisitor_p.h"
QT_QML_BEGIN_NAMESPACE
namespace QQmlJS { namespace AST {
void Node::accept(Visitor *visitor)
{
if (visitor->preVisit(this)) {
accept0(visitor);
}
visitor->postVisit(this);
}
void Node::accept(Node *node, Visitor *visitor)
{
if (node)
node->accept(visitor);
}
ExpressionNode *Node::expressionCast()
{
return 0;
}
BinaryExpression *Node::binaryExpressionCast()
{
return 0;
}
Statement *Node::statementCast()
{
return 0;
}
UiObjectMember *Node::uiObjectMemberCast()
{
return 0;
}
ExpressionNode *ExpressionNode::expressionCast()
{
return this;
}
BinaryExpression *BinaryExpression::binaryExpressionCast()
{
return this;
}
Statement *Statement::statementCast()
{
return this;
}
UiObjectMember *UiObjectMember::uiObjectMemberCast()
{
return this;
}
void NestedExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void ThisExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void IdentifierExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void NullExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void TrueLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void FalseLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void StringLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void NumericLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void RegExpLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ArrayLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(elements, visitor);
accept(elision, visitor);
}
visitor->endVisit(this);
}
void ObjectLiteral::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(properties, visitor);
}
visitor->endVisit(this);
}
void ElementList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (ElementList *it = this; it; it = it->next) {
accept(it->elision, visitor);
accept(it->expression, visitor);
}
}
visitor->endVisit(this);
}
void Elision::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
// ###
}
visitor->endVisit(this);
}
void PropertyNameAndValue::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(name, visitor);
accept(value, visitor);
}
visitor->endVisit(this);
}
void PropertyGetterSetter::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(name, visitor);
accept(formals, visitor);
accept(functionBody, visitor);
}
visitor->endVisit(this);
}
void PropertyAssignmentList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (PropertyAssignmentList *it = this; it; it = it->next) {
accept(it->assignment, visitor);
}
}
visitor->endVisit(this);
}
void IdentifierPropertyName::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void StringLiteralPropertyName::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void NumericLiteralPropertyName::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ArrayMemberExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(base, visitor);
accept(expression, visitor);
}
visitor->endVisit(this);
}
void FieldMemberExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(base, visitor);
}
visitor->endVisit(this);
}
void NewMemberExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(base, visitor);
accept(arguments, visitor);
}
visitor->endVisit(this);
}
void NewExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void CallExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(base, visitor);
accept(arguments, visitor);
}
visitor->endVisit(this);
}
void ArgumentList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (ArgumentList *it = this; it; it = it->next) {
accept(it->expression, visitor);
}
}
visitor->endVisit(this);
}
void PostIncrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(base, visitor);
}
visitor->endVisit(this);
}
void PostDecrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(base, visitor);
}
visitor->endVisit(this);
}
void DeleteExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void VoidExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void TypeOfExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void PreIncrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void PreDecrementExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void UnaryPlusExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void UnaryMinusExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void TildeExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void NotExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void BinaryExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(left, visitor);
accept(right, visitor);
}
visitor->endVisit(this);
}
void ConditionalExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
accept(ok, visitor);
accept(ko, visitor);
}
visitor->endVisit(this);
}
void Expression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(left, visitor);
accept(right, visitor);
}
visitor->endVisit(this);
}
void Block::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statements, visitor);
}
visitor->endVisit(this);
}
void StatementList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (StatementList *it = this; it; it = it->next) {
accept(it->statement, visitor);
}
}
visitor->endVisit(this);
}
void VariableStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(declarations, visitor);
}
visitor->endVisit(this);
}
void VariableDeclarationList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (VariableDeclarationList *it = this; it; it = it->next) {
accept(it->declaration, visitor);
}
}
visitor->endVisit(this);
}
void VariableDeclaration::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void EmptyStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ExpressionStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void IfStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
accept(ok, visitor);
accept(ko, visitor);
}
visitor->endVisit(this);
}
void DoWhileStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
accept(expression, visitor);
}
visitor->endVisit(this);
}
void WhileStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
accept(statement, visitor);
}
visitor->endVisit(this);
}
void ForStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(initialiser, visitor);
accept(condition, visitor);
accept(expression, visitor);
accept(statement, visitor);
}
visitor->endVisit(this);
}
void LocalForStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(declarations, visitor);
accept(condition, visitor);
accept(expression, visitor);
accept(statement, visitor);
}
visitor->endVisit(this);
}
void ForEachStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(initialiser, visitor);
accept(expression, visitor);
accept(statement, visitor);
}
visitor->endVisit(this);
}
void LocalForEachStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(declaration, visitor);
accept(expression, visitor);
accept(statement, visitor);
}
visitor->endVisit(this);
}
void ContinueStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void BreakStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ReturnStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void WithStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
accept(statement, visitor);
}
visitor->endVisit(this);
}
void SwitchStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
accept(block, visitor);
}
visitor->endVisit(this);
}
void CaseBlock::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(clauses, visitor);
accept(defaultClause, visitor);
accept(moreClauses, visitor);
}
visitor->endVisit(this);
}
void CaseClauses::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (CaseClauses *it = this; it; it = it->next) {
accept(it->clause, visitor);
}
}
visitor->endVisit(this);
}
void CaseClause::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
accept(statements, visitor);
}
visitor->endVisit(this);
}
void DefaultClause::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statements, visitor);
}
visitor->endVisit(this);
}
void LabelledStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
}
visitor->endVisit(this);
}
void ThrowStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(expression, visitor);
}
visitor->endVisit(this);
}
void TryStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
accept(catchExpression, visitor);
accept(finallyExpression, visitor);
}
visitor->endVisit(this);
}
void Catch::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
}
visitor->endVisit(this);
}
void Finally::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
}
visitor->endVisit(this);
}
void FunctionDeclaration::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(formals, visitor);
accept(body, visitor);
}
visitor->endVisit(this);
}
void FunctionExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(formals, visitor);
accept(body, visitor);
}
visitor->endVisit(this);
}
void FormalParameterList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
// ###
}
visitor->endVisit(this);
}
void FunctionBody::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(elements, visitor);
}
visitor->endVisit(this);
}
void Program::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(elements, visitor);
}
visitor->endVisit(this);
}
void SourceElements::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (SourceElements *it = this; it; it = it->next) {
accept(it->element, visitor);
}
}
visitor->endVisit(this);
}
void FunctionSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(declaration, visitor);
}
visitor->endVisit(this);
}
void StatementSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
}
visitor->endVisit(this);
}
void DebuggerStatement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void UiProgram::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(headers, visitor);
accept(members, visitor);
}
visitor->endVisit(this);
}
void UiPublicMember::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(statement, visitor);
accept(binding, visitor);
}
visitor->endVisit(this);
}
void UiObjectDefinition::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(qualifiedTypeNameId, visitor);
accept(initializer, visitor);
}
visitor->endVisit(this);
}
void UiObjectInitializer::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(members, visitor);
}
visitor->endVisit(this);
}
void UiParameterList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void UiObjectBinding::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(qualifiedId, visitor);
accept(qualifiedTypeNameId, visitor);
accept(initializer, visitor);
}
visitor->endVisit(this);
}
void UiScriptBinding::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(qualifiedId, visitor);
accept(statement, visitor);
}
visitor->endVisit(this);
}
void UiArrayBinding::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(qualifiedId, visitor);
accept(members, visitor);
}
visitor->endVisit(this);
}
void UiObjectMemberList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (UiObjectMemberList *it = this; it; it = it->next)
accept(it->member, visitor);
}
visitor->endVisit(this);
}
void UiArrayMemberList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
for (UiArrayMemberList *it = this; it; it = it->next)
accept(it->member, visitor);
}
visitor->endVisit(this);
}
void UiQualifiedId::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void UiImport::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(importUri, visitor);
}
visitor->endVisit(this);
}
void UiQualifiedPragmaId::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void UiPragma::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(pragmaType, visitor);
}
visitor->endVisit(this);
}
void UiHeaderItemList::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(headerItem, visitor);
accept(next, visitor);
}
visitor->endVisit(this);
}
void UiSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
accept(sourceElement, visitor);
}
visitor->endVisit(this);
}
} } // namespace QQmlJS::AST
QT_QML_END_NAMESPACE

File diff suppressed because it is too large Load Diff

View File

@ -1,186 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module 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 QQMLJSAST_FWD_P_H
#define QQMLJSAST_FWD_P_H
#include "qqmljsglobal_p.h"
#include <QtCore/qglobal.h>
#include <QtCore/qtypeinfo.h>
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
QT_QML_BEGIN_NAMESPACE
namespace QQmlJS { namespace AST {
class Visitor;
class Node;
class ExpressionNode;
class Statement;
class ThisExpression;
class IdentifierExpression;
class NullExpression;
class TrueLiteral;
class FalseLiteral;
class NumericLiteral;
class StringLiteral;
class RegExpLiteral;
class ArrayLiteral;
class ObjectLiteral;
class ElementList;
class Elision;
class PropertyAssignmentList;
class PropertyGetterSetter;
class PropertyNameAndValue;
class PropertyName;
class IdentifierPropertyName;
class StringLiteralPropertyName;
class NumericLiteralPropertyName;
class ArrayMemberExpression;
class FieldMemberExpression;
class NewMemberExpression;
class NewExpression;
class CallExpression;
class ArgumentList;
class PostIncrementExpression;
class PostDecrementExpression;
class DeleteExpression;
class VoidExpression;
class TypeOfExpression;
class PreIncrementExpression;
class PreDecrementExpression;
class UnaryPlusExpression;
class UnaryMinusExpression;
class TildeExpression;
class NotExpression;
class BinaryExpression;
class ConditionalExpression;
class Expression; // ### rename
class Block;
class StatementList;
class VariableStatement;
class VariableDeclarationList;
class VariableDeclaration;
class EmptyStatement;
class ExpressionStatement;
class IfStatement;
class DoWhileStatement;
class WhileStatement;
class ForStatement;
class LocalForStatement;
class ForEachStatement;
class LocalForEachStatement;
class ContinueStatement;
class BreakStatement;
class ReturnStatement;
class WithStatement;
class SwitchStatement;
class CaseBlock;
class CaseClauses;
class CaseClause;
class DefaultClause;
class LabelledStatement;
class ThrowStatement;
class TryStatement;
class Catch;
class Finally;
class FunctionDeclaration;
class FunctionExpression;
class FormalParameterList;
class FunctionBody;
class Program;
class SourceElements;
class SourceElement;
class FunctionSourceElement;
class StatementSourceElement;
class DebuggerStatement;
class NestedExpression;
// ui elements
class UiProgram;
class UiPragma;
class UiImport;
class UiPublicMember;
class UiParameterList;
class UiObjectDefinition;
class UiObjectInitializer;
class UiObjectBinding;
class UiScriptBinding;
class UiSourceElement;
class UiArrayBinding;
class UiObjectMember;
class UiObjectMemberList;
class UiArrayMemberList;
class UiQualifiedId;
class UiQualifiedPragmaId;
class UiHeaderItemList;
class SourceLocation
{
public:
explicit SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0)
: offset(offset), length(length),
startLine(line), startColumn(column)
{ }
bool isValid() const { return length != 0; }
quint32 begin() const { return offset; }
quint32 end() const { return offset + length; }
// attributes
// ### encode
quint32 offset;
quint32 length;
quint32 startLine;
quint32 startColumn;
};
} } // namespace AST
Q_DECLARE_TYPEINFO(QQmlJS::AST::SourceLocation, Q_PRIMITIVE_TYPE);
QT_QML_END_NAMESPACE
#endif

View File

@ -1,50 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module 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 "qqmljsastvisitor_p.h"
QT_QML_BEGIN_NAMESPACE
namespace QQmlJS { namespace AST {
Visitor::Visitor()
{
}
Visitor::~Visitor()
{
}
} } // namespace QQmlJS::AST
QT_QML_END_NAMESPACE

Some files were not shown because too many files have changed in this diff Show More