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:42
The Atom class is the fundamental unit for representing documents internally.
Definition atom.h:19
AtomType type() const
Return the type of this atom.
Definition atom.h:151
@ InlineImage
Definition atom.h:56
@ ListItemRight
Definition atom.h:68
@ Image
Definition atom.h:52
@ ListItemLeft
Definition atom.h:67
@ ListLeft
Definition atom.h:63
@ ListRight
Definition atom.h:69
@ Link
Definition atom.h:61
const Atom * next() const
Return the next atom in the atom list.
Definition atom.h:148
The ClassNode represents a C++ class.
Definition classnode.h:21
The Config class contains the configuration variables for controlling how qdoc produces documentation...
Definition config.h:85
const Location & location() const
Returns the starting location of a qdoc comment.
Definition doc.cpp:90
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)
static bool isIncluded(const InclusionPolicy &policy, const NodeContext &context)
A PageNode is a Node that generates a documentation page.
Definition pagenode.h:19
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:27
#define CONFIG_QHP
Definition config.h:408
#define CONFIG_VERSION
Definition config.h:427
#define CONFIG_PROJECT
Definition config.h:404
NodeType
Definition genustypes.h:150
QList< Node * > NodeList
Definition node.h:44
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
The Node class is the base class for all the nodes in QDoc's parse tree.
bool isDontDocument() const
Returns true if this node's status is DontDocument.
Definition node.h:99
const Doc & doc() const
Returns a reference to the node's Doc data member.
Definition node.h:242
bool isQmlNode() const
Returns true if this node's Genus value is QML.
Definition node.h:126
bool isGroup() const
Returns true if the node type is Group.
Definition node.h:111
virtual bool isWrapper() const
Returns true if the node is a class node or a QML type node that is marked as being a wrapper class o...
Definition node.cpp:906
bool isNamespace() const
Returns true if the node type is Namespace.
Definition node.h:115
bool isTypedef() const
Returns true if the node type is Typedef.
Definition node.h:133
bool isQmlBasicType() const
Returns true if the node type is QmlBasicType.
Definition node.h:124
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
Definition node.h:128
bool isHeader() const
Returns true if the node type is HeaderFile.
Definition node.h:112
NodeType nodeType() const override
Returns this node's type.
Definition node.h:89
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
Definition node.h:155
bool isEnumType() const
Returns true if the node type is Enum.
Definition node.h:100
virtual Status status() const
Returns the node's status value.
Definition node.h:249
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Definition node.h:160
Aggregate * parent() const
Returns the node's parent pointer.
Definition node.h:215
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:143
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Definition node.cpp:59
virtual bool wasSeen() const
Returns the seen flag data member of this node if it is a NamespaceNode or a CollectionNode.
Definition node.h:199
NodeContext createContext() const
Definition node.cpp:116
virtual CollectionNode * logicalModule() const
If this is a QmlTypeNode, a pointer to its QML module is returned, which is a pointer to a Collection...
Definition node.h:268
bool isRelatedNonmember() const
Returns true if this is a related nonmember of something.
Definition node.h:129
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
Definition node.h:150
@ Deprecated
Definition node.h:58
bool isQmlModule() const
Returns true if the node type is QmlModule.
Definition node.h:125
bool isIndexNode() const
Returns true if this node was created from something in an index file.
Definition node.h:113
QHash< QString, const Node * > m_nodes
QStringList m_groups
NodeTypeSet m_selectors
QString m_indexTitle