umbrello: umbrello/codeimport/kdevcppparser/cpptree2uml.h Source File

umbrello 2.34.0 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

cpptree2uml.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2005-2014 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef CPPTREE2UML_H
7#define CPPTREE2UML_H
8
9#include "tree_parser.h"
10#include "model_utils.h"
11
12#include <QStringList>
13
14// fwd decls
15class CodeImpThread;
16class UMLClassifier;
17class UMLFolder;
18class UMLOperation;
19class UMLPackage;
20
21 class CppTree2Uml: public TreeParser
22{
23public:
24 explicit CppTree2Uml(const QString& fileName, CodeImpThread* thread = 0);
25 virtual ~CppTree2Uml();
26
27 void clear();
28 void setRootPath(const QString &rootPath);
29 //FileDom file() { return m_file; }
30
31 // translation-unit
32 virtual void parseTranslationUnit(const ParsedFile &file);
33
34 // declarations
35 //virtual void parseDeclaration(DeclarationAST*); // use parent method
36 //virtual void parseLinkageSpecification(LinkageSpecificationAST*); // use parent method
37 virtual void parseNamespace(NamespaceAST*);
38 //virtual void parseNamespaceAlias(NamespaceAliasAST*); // use parent method
39 //virtual void parseUsing(UsingAST*); // use parent method
40 //virtual void parseUsingDirective(UsingDirectiveAST*); // use parent method
41 virtual void parseTypedef(TypedefAST*);
42 virtual void parseTemplateDeclaration(TemplateDeclarationAST*);
43 virtual void parseSimpleDeclaration(SimpleDeclarationAST*);
44 virtual void parseFunctionDefinition(FunctionDefinitionAST*);
45 //virtual void parseLinkageBody(LinkageBodyAST*); // use parent method
46 virtual void parseAccessDeclaration(AccessDeclarationAST*);
47
48 // type-specifier
49 //virtual void parseTypeSpecifier(TypeSpecifierAST*); // use parent method
50 virtual void parseClassSpecifier(ClassSpecifierAST*);
51 virtual void parseEnumSpecifier(EnumSpecifierAST*);
52 virtual void parseElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST*);
53
54 // non-overriding (locally added) methods
55
56 virtual void parseDeclaration2(GroupAST* funSpec, GroupAST* storageSpec, TypeSpecifierAST* typeSpec, InitDeclaratorAST* decl);
57 virtual void parseFunctionDeclaration(GroupAST* funSpec, GroupAST* storageSpec, TypeSpecifierAST* typeSpec, InitDeclaratorAST* decl);
58 void parseFunctionArguments(DeclaratorAST* declarator, UMLOperation* method);
59 virtual void parseBaseClause(BaseClauseAST* baseClause, UMLClassifier* klass);
60
61private:
62 //NamespaceDom findOrInsertNamespace(NamespaceAST* ast, const QString& name);
63
64 QString typeOfDeclaration(TypeSpecifierAST* typeSpec, DeclaratorAST* declarator);
65 QStringList scopeOfName(NameAST* id, const QStringList& scope);
66 QStringList scopeOfDeclarator(DeclaratorAST* d, const QStringList& scope);
67 void flushTemplateParams(UMLClassifier *klass);
68
69private:
70 //FileDom m_file;
71 QString m_fileName;
72 QStringList m_currentScope;
73 Uml::Visibility::Enum m_currentAccess;
74 bool m_inSlots;
75 bool m_inSignals;
76 int m_anon;
77 bool m_inStorageSpec;
78 bool m_inTypedef;
79 QString m_comment;
80 Model_Utils::NameAndType_List m_templateParams;
81
82 DeclaratorAST* m_currentDeclarator;
83# define STACKSIZE 30
84 UMLPackage* m_currentNamespace[STACKSIZE+1];
85 UMLClassifier* m_currentClass[STACKSIZE+1];
86 int m_nsCnt;
87 int m_clsCnt;
88 CodeImpThread* m_thread;
89 QString m_rootPath;
90 UMLFolder *m_rootFolder;
91 UMLDoc *m_doc;
92
93private:
94 CppTree2Uml(const CppTree2Uml& source);
95 void operator = (const CppTree2Uml& source);
96};
97
98#endif // CPPTREE2UML
CodeImpThread
Definition: codeimpthread.h:22
CppTree2Uml
Definition: cpptree2uml.h:22
CppTree2Uml::m_comment
QString m_comment
Definition: cpptree2uml.h:79
CppTree2Uml::parseFunctionDefinition
virtual void parseFunctionDefinition(FunctionDefinitionAST *)
Definition: cpptree2uml.cpp:289
CppTree2Uml::scopeOfName
QStringList scopeOfName(NameAST *id, const QStringList &scope)
Definition: cpptree2uml.cpp:776
CppTree2Uml::m_rootPath
QString m_rootPath
root path of project
Definition: cpptree2uml.h:89
CppTree2Uml::m_currentScope
QStringList m_currentScope
Definition: cpptree2uml.h:72
CppTree2Uml::m_inSignals
bool m_inSignals
Definition: cpptree2uml.h:75
CppTree2Uml::m_currentNamespace
UMLPackage * m_currentNamespace[STACKSIZE+1]
stack
Definition: cpptree2uml.h:84
CppTree2Uml::m_fileName
QString m_fileName
Definition: cpptree2uml.h:71
CppTree2Uml::m_anon
int m_anon
Definition: cpptree2uml.h:76
CppTree2Uml::m_inSlots
bool m_inSlots
Definition: cpptree2uml.h:74
CppTree2Uml::typeOfDeclaration
QString typeOfDeclaration(TypeSpecifierAST *typeSpec, DeclaratorAST *declarator)
Definition: cpptree2uml.cpp:726
CppTree2Uml::m_currentDeclarator
DeclaratorAST * m_currentDeclarator
Definition: cpptree2uml.h:82
CppTree2Uml::parseClassSpecifier
virtual void parseClassSpecifier(ClassSpecifierAST *)
Definition: cpptree2uml.cpp:398
CppTree2Uml::m_nsCnt
int m_nsCnt
stack top for m_currentNamespace
Definition: cpptree2uml.h:86
CppTree2Uml::~CppTree2Uml
virtual ~CppTree2Uml()
Definition: cpptree2uml.cpp:48
CppTree2Uml::flushTemplateParams
void flushTemplateParams(UMLClassifier *klass)
Definition: cpptree2uml.cpp:801
CppTree2Uml::operator=
void operator=(const CppTree2Uml &source)
CppTree2Uml::m_inTypedef
bool m_inTypedef
Definition: cpptree2uml.h:78
CppTree2Uml::m_inStorageSpec
bool m_inStorageSpec
Definition: cpptree2uml.h:77
CppTree2Uml::parseTranslationUnit
virtual void parseTranslationUnit(const ParsedFile &file)
Definition: cpptree2uml.cpp:85
CppTree2Uml::parseTypedef
virtual void parseTypedef(TypedefAST *)
Definition: cpptree2uml.cpp:152
CppTree2Uml::parseSimpleDeclaration
virtual void parseSimpleDeclaration(SimpleDeclarationAST *)
Definition: cpptree2uml.cpp:267
CppTree2Uml::setRootPath
void setRootPath(const QString &rootPath)
Definition: cpptree2uml.cpp:69
CppTree2Uml::m_doc
UMLDoc * m_doc
Definition: cpptree2uml.h:91
CppTree2Uml::parseNamespace
virtual void parseNamespace(NamespaceAST *)
Definition: cpptree2uml.cpp:106
CppTree2Uml::parseAccessDeclaration
virtual void parseAccessDeclaration(AccessDeclarationAST *)
Definition: cpptree2uml.cpp:599
CppTree2Uml::m_currentClass
UMLClassifier * m_currentClass[STACKSIZE+1]
stack
Definition: cpptree2uml.h:85
CppTree2Uml::m_rootFolder
UMLFolder * m_rootFolder
Definition: cpptree2uml.h:90
CppTree2Uml::m_thread
CodeImpThread * m_thread
Definition: cpptree2uml.h:88
CppTree2Uml::parseFunctionDeclaration
virtual void parseFunctionDeclaration(GroupAST *funSpec, GroupAST *storageSpec, TypeSpecifierAST *typeSpec, InitDeclaratorAST *decl)
Definition: cpptree2uml.cpp:611
CppTree2Uml::parseFunctionArguments
void parseFunctionArguments(DeclaratorAST *declarator, UMLOperation *method)
Definition: cpptree2uml.cpp:701
CppTree2Uml::scopeOfDeclarator
QStringList scopeOfDeclarator(DeclaratorAST *d, const QStringList &scope)
Definition: cpptree2uml.cpp:793
CppTree2Uml::CppTree2Uml
CppTree2Uml(const QString &fileName, CodeImpThread *thread=0)
Definition: cpptree2uml.cpp:38
CppTree2Uml::m_currentAccess
Uml::Visibility::Enum m_currentAccess
Definition: cpptree2uml.h:73
CppTree2Uml::CppTree2Uml
CppTree2Uml(const CppTree2Uml &source)
CppTree2Uml::parseBaseClause
virtual void parseBaseClause(BaseClauseAST *baseClause, UMLClassifier *klass)
Definition: cpptree2uml.cpp:750
CppTree2Uml::parseElaboratedTypeSpecifier
virtual void parseElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST *)
Definition: cpptree2uml.cpp:526
CppTree2Uml::m_templateParams
Model_Utils::NameAndType_List m_templateParams
Definition: cpptree2uml.h:80
CppTree2Uml::m_clsCnt
int m_clsCnt
stack top for m_currentClass
Definition: cpptree2uml.h:87
CppTree2Uml::parseTemplateDeclaration
virtual void parseTemplateDeclaration(TemplateDeclarationAST *)
Definition: cpptree2uml.cpp:220
CppTree2Uml::clear
void clear()
Definition: cpptree2uml.cpp:52
CppTree2Uml::parseDeclaration2
virtual void parseDeclaration2(GroupAST *funSpec, GroupAST *storageSpec, TypeSpecifierAST *typeSpec, InitDeclaratorAST *decl)
Definition: cpptree2uml.cpp:542
CppTree2Uml::parseEnumSpecifier
virtual void parseEnumSpecifier(EnumSpecifierAST *)
Definition: cpptree2uml.cpp:503
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:35
UMLDoc
Definition: umldoc.h:70
UMLFolder
Non-graphical management of objects and diagrams of a Folder.
Definition: folder.h:30
UMLOperation
Definition: operation.h:20
UMLPackage
Non-graphical information for a Package.
Definition: package.h:28
STACKSIZE
#define STACKSIZE
Definition: cpptree2uml.h:83
model_utils.h
Model_Utils::NameAndType_List
QLinkedList< NameAndType > NameAndType_List
Auxiliary type for OpDescriptor.
Definition: model_utils.h:123
Uml::Visibility::Enum
Enum
Definition: basictypes.h:45