Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
helpprojectwriter.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef HELPPROJECTWRITER_H
5#define HELPPROJECTWRITER_H
6
7#include "node.h"
8
9#include <QtCore/qstring.h>
10#include <QtCore/qxmlstream.h>
11
12#include <utility>
13
14QT_BEGIN_NAMESPACE
15
16class QDocDatabase;
17class Generator;
18
19using NodeTypeSet = QSet<unsigned char>;
20
32
33/*
34 * Name is the human-readable name to be shown in Assistant.
35 * Ids is a list of unique identifiers.
36 * Ref is the location of the documentation for the keyword.
37 */
38struct Keyword {
42 Keyword(QString name, const QString &id, QString ref)
44 {
45 }
46 Keyword(QString name, QStringList ids, QString ref)
48 {
49 }
50 bool operator<(const Keyword &o) const
51 {
52 // Order by name; use ref as a secondary sort key
53 return (m_name == o.m_name) ? m_ref < o.m_ref : m_name < o.m_name;
54 }
55};
56
78
79
81{
82public:
83 HelpProjectWriter(const QString &defaultFileName, Generator *g);
84 void reset(const QString &defaultFileName, Generator *g);
85 void addExtraFile(const QString &file);
86 void generate();
87
88private:
89 void generateProject(HelpProject &project);
90 void generateSections(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
91 bool generateSection(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
92 Keyword keywordDetails(const Node *node) const;
93 void writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
94 void readSelectors(SubProject &subproject, const QStringList &selectors);
95 void addMembers(HelpProject &project, QXmlStreamWriter &writer, const Node *node);
96 void writeSection(QXmlStreamWriter &writer, const QString &path, const QString &value);
97
98 QDocDatabase *m_qdb {};
99 Generator *m_gen {};
100
101 QString m_outputDir {};
102 QList<HelpProject> m_projects {};
103};
104
105QT_END_NAMESPACE
106
107#endif
const NodeList & childNodes() const
Returns a const reference to the child list.
Definition aggregate.h:41
The Atom class is the fundamental unit for representing documents internally.
Definition atom.h:18
AtomType type() const
Return the type of this atom.
Definition atom.h:149
@ InlineImage
Definition atom.h:55
@ ListItemRight
Definition atom.h:67
@ Image
Definition atom.h:51
@ ListItemLeft
Definition atom.h:66
@ ListLeft
Definition atom.h:62
@ ListRight
Definition atom.h:68
@ Link
Definition atom.h:60
const Atom * next() const
Return the next atom in the atom list.
Definition atom.h:146
The ClassNode represents a C++ class.
Definition classnode.h:21
A class for holding the members of a collection of doc pages.
const NodeList & members() const
The Config class contains the configuration variables for controlling how qdoc produces documentation...
Definition config.h:84
const Text & body() const
Definition doc.cpp:115
This node is used to represent any kind of function being documented.
bool isSomeCtor() const
HelpProjectWriter(const QString &defaultFileName, Generator *g)
void addExtraFile(const QString &file)
void reset(const QString &defaultFileName, Generator *g)
bool isExternalPage() const
Returns true if the node type is ExternalPage.
Definition node.h:134
bool isDontDocument() const
Returns true if this node's status is DontDocument.
Definition node.h:131
const Doc & doc() const
Returns a reference to the node's Doc data member.
Definition node.h:271
bool isQmlNode() const
Returns true if this node's Genus value is QML.
Definition node.h:153
bool isGroup() const
Returns true if the node type is Group.
Definition node.h:139
bool isPrivate() const
Returns true if this node's access is Private.
Definition node.h:146
@ Variable
Definition node.h:69
@ Module
Definition node.h:71
@ Struct
Definition node.h:58
@ QmlModule
Definition node.h:73
@ Typedef
Definition node.h:66
@ QmlValueType
Definition node.h:75
@ Function
Definition node.h:65
@ TypeAlias
Definition node.h:67
@ Union
Definition node.h:59
@ Page
Definition node.h:61
@ Group
Definition node.h:70
@ Enum
Definition node.h:62
@ HeaderFile
Definition node.h:60
@ QmlProperty
Definition node.h:74
@ QmlType
Definition node.h:72
@ Namespace
Definition node.h:56
@ Property
Definition node.h:68
@ Class
Definition node.h:57
@ ExternalPage
Definition node.h:64
@ Example
Definition node.h:63
bool isNamespace() const
Returns true if the node type is Namespace.
Definition node.h:143
bool isQmlBasicType() const
Returns true if the node type is QmlBasicType.
Definition node.h:151
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
Definition node.h:155
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
Definition node.cpp:849
bool isHeader() const
Returns true if the node type is HeaderFile.
Definition node.h:140
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
Definition node.h:182
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Definition node.h:187
Aggregate * parent() const
Returns the node's parent pointer.
Definition node.h:244
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
Definition node.h:170
NodeType nodeType() const
Returns this node's type.
Definition node.h:121
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Definition node.cpp:57
virtual bool wasSeen() const
Returns the seen flag data member of this node if it is a NamespaceNode or a CollectionNode.
Definition node.h:225
LinkType
An unsigned char value that probably should be moved out of the Node base class.
Definition node.h:112
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
Definition node.h:177
virtual bool isCollectionNode() const
Returns true if this is an instance of CollectionNode.
Definition node.h:178
@ Deprecated
Definition node.h:90
bool isQmlModule() const
Returns true if the node type is QmlModule.
Definition node.h:152
bool isIndexNode() const
Returns true if this node was created from something in an index file.
Definition node.h:141
Status status() const
Returns the node's status value.
Definition node.h:278
A PageNode is a Node that generates a documentation page.
Definition pagenode.h:18
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static QDocDatabase * qdocDB()
Creates the singleton.
NamespaceNode * primaryTreeRoot()
Returns a pointer to the root node of the primary tree.
void setLocalSearch()
Definition text.h:12
const Atom * firstAtom() const
Definition text.h:34
Atom * firstAtom()
Definition text.h:21
Atom * lastAtom()
Definition text.h:22
const EnumNode * associatedEnum() const
Definition typedefnode.h:26
#define CONFIG_QHP
Definition config.h:375
#define CONFIG_VERSION
Definition config.h:392
#define CONFIG_PROJECT
Definition config.h:373
Combined button and popup list for selecting options.
QList< Node * > NodeList
Definition node.h:41
QSet< QString > m_filterAttributes
QString m_virtualFolder
QSet< QString > m_files
QString m_helpNamespace
QSet< QString > m_extraFiles
QList< SubProject > m_subprojects
QList< Keyword > m_keywords
QSet< QString > m_excluded
QHash< const Node *, NodeStatusSet > m_memberStatus
QString m_name
Keyword(QString name, const QString &id, QString ref)
bool operator<(const Keyword &o) const
Keyword(QString name, QStringList ids, QString ref)
QStringList m_ids
QString m_ref
QHash< QString, const Node * > m_nodes
QStringList m_groups
NodeTypeSet m_selectors
QString m_indexTitle