Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
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 QStringList headerFileNameFilter();
73 virtual QStringList 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#ifdef QDOC_QML
94 // might need to implement this in QsCodeParser as well.
95 virtual Node *processTopicCommandGroup(const Doc& doc,
96 const QString& command,
97 const QStringList& args);
98 bool splitQmlPropertyArg(const Doc& doc,
99 const QString& arg,
100 QString& type,
101 QString& element,
102 QString& name);
103 bool splitQmlMethodArg(const Doc& doc,
104 const QString& arg,
105 QString& type,
106 QString& element);
107#endif
108 virtual QSet<QString> otherMetaCommands();
109 virtual void processOtherMetaCommand(const Doc& doc,
110 const QString& command,
111 const QString& arg,
112 Node *node);
113 void processOtherMetaCommands(const Doc& doc, Node *node);
114
115 private:
116 void reset(Tree *tree);
117 void readToken();
118 const Location& location();
119 QString previousLexeme();
120 QString lexeme();
121 bool match(int target);
122 bool skipTo(int target);
123 bool matchCompat();
124 bool matchTemplateAngles(CodeChunk *type = 0);
125 bool matchTemplateHeader();
126 bool matchDataType(CodeChunk *type, QString *var = 0);
127 bool matchParameter(FunctionNode *func);
128 bool matchFunctionDecl(InnerNode *parent,
129 QStringList *parentPathPtr = 0,
130 FunctionNode **funcPtr = 0,
131 const QString &templateStuff = QString(),
132 Node::Type type = Node::Function,
133 bool attached = false);
134 bool matchBaseSpecifier(ClassNode *classe, bool isClass);
135 bool matchBaseList(ClassNode *classe, bool isClass);
136 bool matchClassDecl(InnerNode *parent,
137 const QString &templateStuff = QString());
138 bool matchNamespaceDecl(InnerNode *parent);
139 bool matchUsingDecl();
140 bool matchEnumItem(InnerNode *parent, EnumNode *enume);
141 bool matchEnumDecl(InnerNode *parent);
142 bool matchTypedefDecl(InnerNode *parent);
143 bool matchProperty(InnerNode *parent);
144 bool matchDeclList(InnerNode *parent);
145 bool matchDocsAndStuff();
146 bool makeFunctionNode(const QString &synopsis,
147 QStringList *parentPathPtr,
148 FunctionNode **funcPtr,
149 InnerNode *root = 0,
150 Node::Type type = Node::Function,
151 bool attached = false);
152 FunctionNode* makeFunctionNode(const Doc& doc,
153 const QString& sig,
154 InnerNode* parent,
155 Node::Type type,
156 bool attached,
157 QString qdoctag);
158 void parseQiteratorDotH(const Location &location, const QString &filePath);
159 void instantiateIteratorMacro(const QString &container,
160 const QString &includeFile,
161 const QString &macroDef,
162 Tree *tree);
163 void createExampleFileNodes(FakeNode *fake);
164
165 QMap<QString, Node::Type> nodeTypeMap;
166 Tree *tre;
167 Tokenizer *tokenizer;
168 int tok;
169 Node::Access access;
170 FunctionNode::Metaness metaness;
171 QString moduleName;
172 QStringList lastPath;
173 QRegExp varComment;
174 QRegExp sep;
175
176 QString sequentialIteratorDefinition;
177 QString mutableSequentialIteratorDefinition;
178 QString associativeIteratorDefinition;
179 QString mutableAssociativeIteratorDefinition;
180 QSet<QString> usedNamespaces;
181 QMap<QString, QString> sequentialIteratorClasses;
182 QMap<QString, QString> mutableSequentialIteratorClasses;
183 QMap<QString, QString> associativeIteratorClasses;
184 QMap<QString, QString> mutableAssociativeIteratorClasses;
185
186 static QStringList exampleFiles;
187 static QStringList exampleDirs;
188 QString exampleNameFilter;
189 QString exampleImageFilter;
190};
191
192QT_END_NAMESPACE
193
194#endif
195

Warning: That file was not part of the compilation database. It may have many parsing errors.