source: trunk/tools/qdoc3/cppcodeparser.h@ 5

Last change on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 6.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/*
43 cppcodeparser.h
44*/
45
46#ifndef CPPCODEPARSER_H
47#define CPPCODEPARSER_H
48
49#include <qregexp.h>
50
51#include "codeparser.h"
52#include "node.h"
53
54QT_BEGIN_NAMESPACE
55
56class ClassNode;
57class CodeChunk;
58class CppCodeParserPrivate;
59class FunctionNode;
60class InnerNode;
61class Tokenizer;
62
63class CppCodeParser : public CodeParser
64{
65 public:
66 CppCodeParser();
67 ~CppCodeParser();
68
69 virtual void initializeParser(const Config& config);
70 virtual void terminateParser();
71 virtual QString language();
72 virtual QString headerFileNameFilter();
73 virtual QString sourceFileNameFilter();
74 virtual void parseHeaderFile(const Location& location,
75 const QString& filePath,
76 Tree *tree);
77 virtual void parseSourceFile(const Location& location,
78 const QString& filePath,
79 Tree *tree);
80 virtual void doneParsingHeaderFiles(Tree *tree);
81 virtual void doneParsingSourceFiles(Tree *tree);
82
83 const FunctionNode *findFunctionNode(const QString& synopsis,
84 Tree *tree,
85 Node *relative = 0,
86 bool fuzzy = false);
87
88 protected:
89 virtual QSet<QString> topicCommands();
90 virtual Node *processTopicCommand(const Doc& doc,
91 const QString& command,
92 const QString& arg);
93 virtual QSet<QString> otherMetaCommands();
94 virtual void processOtherMetaCommand(const Doc& doc,
95 const QString& command,
96 const QString& arg,
97 Node *node);
98 void processOtherMetaCommands(const Doc& doc, Node *node);
99
100 private:
101 void reset(Tree *tree);
102 void readToken();
103 const Location& location();
104 QString previousLexeme();
105 QString lexeme();
106 bool match(int target);
107 bool matchCompat();
108 bool matchTemplateAngles(CodeChunk *type = 0);
109 bool matchTemplateHeader();
110 bool matchDataType(CodeChunk *type, QString *var = 0);
111 bool matchParameter(FunctionNode *func);
112 bool matchFunctionDecl(InnerNode *parent,
113 QStringList *parentPathPtr = 0,
114 FunctionNode **funcPtr = 0,
115 const QString &templateStuff = QString());
116 bool matchBaseSpecifier(ClassNode *classe, bool isClass);
117 bool matchBaseList(ClassNode *classe, bool isClass);
118 bool matchClassDecl(InnerNode *parent,
119 const QString &templateStuff = QString());
120 bool matchNamespaceDecl(InnerNode *parent);
121 bool matchUsingDecl();
122 bool matchEnumItem(InnerNode *parent, EnumNode *enume);
123 bool matchEnumDecl(InnerNode *parent);
124 bool matchTypedefDecl(InnerNode *parent);
125 bool matchProperty(InnerNode *parent);
126 bool matchDeclList(InnerNode *parent);
127 bool matchDocsAndStuff();
128 bool makeFunctionNode(const QString &synopsis,
129 QStringList *parentPathPtr,
130 FunctionNode **funcPtr,
131 InnerNode *root = 0);
132 void parseQiteratorDotH(const Location &location, const QString &filePath);
133 void instantiateIteratorMacro(const QString &container,
134 const QString &includeFile,
135 const QString &macroDef,
136 Tree *tree);
137 void createExampleFileNodes(FakeNode *fake);
138
139 QMap<QString, Node::Type> nodeTypeMap;
140 Tree *tre;
141 Tokenizer *tokenizer;
142 int tok;
143 Node::Access access;
144 FunctionNode::Metaness metaness;
145 QString moduleName;
146 QStringList lastPath;
147 QRegExp varComment;
148 QRegExp sep;
149
150 QString sequentialIteratorDefinition;
151 QString mutableSequentialIteratorDefinition;
152 QString associativeIteratorDefinition;
153 QString mutableAssociativeIteratorDefinition;
154 QSet<QString> usedNamespaces;
155 QMap<QString, QString> sequentialIteratorClasses;
156 QMap<QString, QString> mutableSequentialIteratorClasses;
157 QMap<QString, QString> associativeIteratorClasses;
158 QMap<QString, QString> mutableAssociativeIteratorClasses;
159
160 static QStringList exampleFiles;
161 static QStringList exampleDirs;
162 QString exampleNameFilter;
163};
164
165QT_END_NAMESPACE
166
167#endif
Note: See TracBrowser for help on using the repository browser.