diff options
Diffstat (limited to 'src/tools/qdoc/tree.h')
-rw-r--r-- | src/tools/qdoc/tree.h | 116 |
1 files changed, 74 insertions, 42 deletions
diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h index 6bb13ee327..2e6f766770 100644 --- a/src/tools/qdoc/tree.h +++ b/src/tools/qdoc/tree.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** 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. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** 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$ @@ -67,10 +67,24 @@ struct TargetRec Type type_; }; +struct TargetLoc +{ + public: + TargetLoc(const Node* loc, const QString& t, const QString& fileName, const QString& text, bool broken) + : loc_(loc), target_(t), fileName_(fileName), text_(text), broken_(broken) { } + const Node* loc_; + QString target_; + QString fileName_; + QString text_; + bool broken_; +}; + typedef QMultiMap<QString, TargetRec*> TargetMap; -typedef QMultiMap<QString, DocNode*> DocNodeMultiMap; -typedef QMap<QString, QmlClassNode*> QmlTypeMap; +typedef QMultiMap<QString, DocumentNode*> DocumentNodeMultiMap; +typedef QMap<QString, QmlTypeNode*> QmlTypeMap; typedef QMultiMap<QString, const ExampleNode*> ExampleNodeMap; +typedef QVector<TargetLoc*> TargetList; +typedef QMap<QString, TargetList*> TargetListMap; class Tree { @@ -118,7 +132,7 @@ class Tree int findFlags, // = 0, Node::Genus genus) const; // = Node::DontCare) const; - QmlClassNode* findQmlTypeNode(const QStringList& path); + QmlTypeNode* findQmlTypeNode(const QStringList& path); Node* findNodeByNameAndType(const QStringList& path, Node::Type type) const; InnerNode* findRelatesNode(const QStringList& path); @@ -130,7 +144,7 @@ class Tree int priority); void resolveTargets(InnerNode* root); const Node* findUnambiguousTarget(const QString& target, QString& ref) const; - const DocNode* findDocNodeByTitle(const QString& title) const; + const DocumentNode* findDocumentNodeByTitle(const QString& title) const; void addPropertyFunction(PropertyNode *property, const QString &funcName, @@ -153,57 +167,75 @@ class Tree NodeList allBaseClasses(const ClassNode *classe) const; QString refForAtom(const Atom* atom); + CNMap* getCollectionMap(Node::Genus genus); const CNMap& groups() const { return groups_; } const CNMap& modules() const { return modules_; } const CNMap& qmlModules() const { return qmlModules_; } - const CNMap& getCollections(Node::Type t) const { - if (t == Node::Group) - return groups_; - if (t == Node::Module) - return modules_; - return qmlModules_; - } - - CollectionNode* getCorrespondingCollection(CollectionNode* cn); - - GroupNode* getGroup(const QString& name); - ModuleNode* getModule(const QString& name); - QmlModuleNode* getQmlModule(const QString& name); - - GroupNode* findGroup(const QString& name); - ModuleNode* findModule(const QString& name); - QmlModuleNode* findQmlModule(const QString& name); - - GroupNode* addGroup(const QString& name); - ModuleNode* addModule(const QString& name); - QmlModuleNode* addQmlModule(const QString& name); - - GroupNode* addToGroup(const QString& name, Node* node); - ModuleNode* addToModule(const QString& name, Node* node); - QmlModuleNode* addToQmlModule(const QString& name, Node* node); - - QmlClassNode* lookupQmlType(const QString& name) const { return qmlTypeMap_.value(name); } - void insertQmlType(const QString& key, QmlClassNode* n); + const CNMap& jsModules() const { return jsModules_; } + + CollectionNode* getCollection(const QString& name, Node::Genus genus); + CollectionNode* findCollection(const QString& name, Node::Genus genus); + + CollectionNode* findGroup(const QString& name) { return findCollection(name, Node::DOC); } + CollectionNode* findModule(const QString& name) { return findCollection(name, Node::CPP); } + CollectionNode* findQmlModule(const QString& name) { return findCollection(name, Node::QML); } + CollectionNode* findJsModule(const QString& name) { return findCollection(name, Node::JS); } + + CollectionNode* addGroup(const QString& name) { return findGroup(name); } + CollectionNode* addModule(const QString& name) { return findModule(name); } + CollectionNode* addQmlModule(const QString& name) { return findQmlModule(name); } + CollectionNode* addJsModule(const QString& name) { return findJsModule(name); } + + CollectionNode* addToGroup(const QString& name, Node* node); + CollectionNode* addToModule(const QString& name, Node* node); + CollectionNode* addToQmlModule(const QString& name, Node* node); + CollectionNode* addToJsModule(const QString& name, Node* node); + + QmlTypeNode* lookupQmlType(const QString& name) const { return qmlTypeMap_.value(name); } + void insertQmlType(const QString& key, QmlTypeNode* n); void addExampleNode(ExampleNode* n) { exampleNodeMap_.insert(n->title(), n); } ExampleNodeMap& exampleNodeMap() { return exampleNodeMap_; } const Node* checkForCollision(const QString& name); + void setIndexFileName(const QString& t) { indexFileName_ = t; } + + bool treeHasBeenAnalyzed() const { return treeHasBeenAnalyzed_; } + bool docsHaveBeenGenerated() const { return docsHaveBeenGenerated_; } + void setTreeHasBeenAnalyzed() { treeHasBeenAnalyzed_ = true; } + void setdocsHaveBeenGenerated() { docsHaveBeenGenerated_ = true; } + QString getNewLinkTarget(const Node* locNode, + const Node* t, + const QString& fileName, + QString& text, + bool broken); + TargetList* getTargetList(const QString& module); + QStringList getTargetListKeys() { return targetListMap_->keys(); } public: - const QString& moduleName() const { return module_; } + const QString& physicalModuleName() const { return physicalModuleName_; } + const QString& indexFileName() const { return indexFileName_; } + long incrementLinkCount() { return --linkCount_; } + void clearLinkCount() { linkCount_ = 0; } + long linkCount() const { return linkCount_; } private: - QString module_; + bool treeHasBeenAnalyzed_; + bool docsHaveBeenGenerated_; + long linkCount_; + QString physicalModuleName_; + QString indexFileName_; QDocDatabase* qdb_; NamespaceNode root_; PropertyMap unresolvedPropertyMap; - DocNodeMultiMap docNodesByTitle_; + DocumentNodeMultiMap docNodesByTitle_; TargetMap nodesByTargetRef_; TargetMap nodesByTargetTitle_; CNMap groups_; CNMap modules_; CNMap qmlModules_; + CNMap jsModules_; QmlTypeMap qmlTypeMap_; ExampleNodeMap exampleNodeMap_; + TargetListMap* targetListMap_; }; QT_END_NAMESPACE |