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

umbrello 2.32.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 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2005-2014 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef CPPTREE2UML_H
12 #define CPPTREE2UML_H
13
14 #include "tree_parser.h"
15 #include "model_utils.h"
16
17 #include <QStringList>
18
19 // fwd decls
20 class CodeImpThread;
21 class UMLClassifier;
22 class UMLFolder;
23 class UMLOperation;
24 class UMLPackage;
25
26 class CppTree2Uml: public TreeParser
27 {
28 public:
29 explicit CppTree2Uml(const QString& fileName, CodeImpThread* thread = 0);
30 virtual ~CppTree2Uml();
31
32 void clear();
33 void setRootPath(const QString &rootPath);
34 //FileDom file() { return m_file; }
35
36 // translation-unit
37 virtual void parseTranslationUnit(const ParsedFile &file);
38
39 // declarations
40 //virtual void parseDeclaration(DeclarationAST*); // use parent method
41 //virtual void parseLinkageSpecification(LinkageSpecificationAST*); // use parent method
42 virtual void parseNamespace(NamespaceAST*);
43 //virtual void parseNamespaceAlias(NamespaceAliasAST*); // use parent method
44 //virtual void parseUsing(UsingAST*); // use parent method
45 //virtual void parseUsingDirective(UsingDirectiveAST*); // use parent method
46 virtual void parseTypedef(TypedefAST*);
47 virtual void parseTemplateDeclaration(TemplateDeclarationAST*);
48 virtual void parseSimpleDeclaration(SimpleDeclarationAST*);
49 virtual void parseFunctionDefinition(FunctionDefinitionAST*);
50 //virtual void parseLinkageBody(LinkageBodyAST*); // use parent method
51 virtual void parseAccessDeclaration(AccessDeclarationAST*);
52
53 // type-specifier
54 //virtual void parseTypeSpecifier(TypeSpecifierAST*); // use parent method
55 virtual void parseClassSpecifier(ClassSpecifierAST*);
56 virtual void parseEnumSpecifier(EnumSpecifierAST*);
57 virtual void parseElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST*);
58
59 // non-overriding (locally added) methods
60
61 virtual void parseDeclaration2(GroupAST* funSpec, GroupAST* storageSpec, TypeSpecifierAST* typeSpec, InitDeclaratorAST* decl);
62 virtual void parseFunctionDeclaration(GroupAST* funSpec, GroupAST* storageSpec, TypeSpecifierAST* typeSpec, InitDeclaratorAST* decl);
63 void parseFunctionArguments(DeclaratorAST* declarator, UMLOperation* method);
64 virtual void parseBaseClause(BaseClauseAST* baseClause, UMLClassifier* klass);
65
66 private:
67 //NamespaceDom findOrInsertNamespace(NamespaceAST* ast, const QString& name);
68
69 QString typeOfDeclaration(TypeSpecifierAST* typeSpec, DeclaratorAST* declarator);
70 QStringList scopeOfName(NameAST* id, const QStringList& scope);
71 QStringList scopeOfDeclarator(DeclaratorAST* d, const QStringList& scope);
72 void flushTemplateParams(UMLClassifier *klass);
73
74 private:
75 //FileDom m_file;
76 QString m_fileName;
77 QStringList m_currentScope;
78 Uml::Visibility::Enum m_currentAccess;
79 bool m_inSlots;
80 bool m_inSignals;
81 int m_anon;
82 bool m_inStorageSpec;
83 bool m_inTypedef;
84 QString m_comment;
85 Model_Utils::NameAndType_List m_templateParams;
86
87 DeclaratorAST* m_currentDeclarator;
88 # define STACKSIZE 30
89 UMLPackage* m_currentNamespace[STACKSIZE+1];
90 UMLClassifier* m_currentClass[STACKSIZE+1];
91 int m_nsCnt;
92 int m_clsCnt;
93 CodeImpThread* m_thread;
94 QString m_rootPath;
95 UMLFolder *m_rootFolder;
96 UMLDoc *m_doc;
97
98 private:
99 CppTree2Uml(const CppTree2Uml& source);
100 void operator = (const CppTree2Uml& source);
101 };
102
103 #endif // CPPTREE2UML
CodeImpThread
Definition: codeimpthread.h:36
CppTree2Uml
Definition: cpptree2uml.h:27
CppTree2Uml::m_comment
QString m_comment
Definition: cpptree2uml.h:84
CppTree2Uml::parseFunctionDefinition
virtual void parseFunctionDefinition(FunctionDefinitionAST *)
Definition: cpptree2uml.cpp:292
CppTree2Uml::scopeOfName
QStringList scopeOfName(NameAST *id, const QStringList &scope)
Definition: cpptree2uml.cpp:784
CppTree2Uml::m_rootPath
QString m_rootPath
root path of project
Definition: cpptree2uml.h:94
CppTree2Uml::m_currentScope
QStringList m_currentScope
Definition: cpptree2uml.h:77
CppTree2Uml::m_inSignals
bool m_inSignals
Definition: cpptree2uml.h:80
CppTree2Uml::m_currentNamespace
UMLPackage * m_currentNamespace[STACKSIZE+1]
stack
Definition: cpptree2uml.h:89
CppTree2Uml::m_fileName
QString m_fileName
Definition: cpptree2uml.h:76
CppTree2Uml::m_anon
int m_anon
Definition: cpptree2uml.h:81
CppTree2Uml::m_inSlots
bool m_inSlots
Definition: cpptree2uml.h:79
CppTree2Uml::typeOfDeclaration
QString typeOfDeclaration(TypeSpecifierAST *typeSpec, DeclaratorAST *declarator)
Definition: cpptree2uml.cpp:736
CppTree2Uml::m_currentDeclarator
DeclaratorAST * m_currentDeclarator
Definition: cpptree2uml.h:87
CppTree2Uml::parseClassSpecifier
virtual void parseClassSpecifier(ClassSpecifierAST *)
Definition: cpptree2uml.cpp:397
CppTree2Uml::m_nsCnt
int m_nsCnt
stack top for m_currentNamespace
Definition: cpptree2uml.h:91
CppTree2Uml::~CppTree2Uml
virtual ~CppTree2Uml()
Definition: cpptree2uml.cpp:50
CppTree2Uml::flushTemplateParams
void flushTemplateParams(UMLClassifier *klass)
Definition: cpptree2uml.cpp:809
CppTree2Uml::operator=
void operator=(const CppTree2Uml &source)
CppTree2Uml::m_inTypedef
bool m_inTypedef
Definition: cpptree2uml.h:83
CppTree2Uml::m_inStorageSpec
bool m_inStorageSpec
Definition: cpptree2uml.h:82
CppTree2Uml::parseTranslationUnit
virtual void parseTranslationUnit(const ParsedFile &file)
Definition: cpptree2uml.cpp:87
CppTree2Uml::parseTypedef
virtual void parseTypedef(TypedefAST *)
Definition: cpptree2uml.cpp:154
CppTree2Uml::parseSimpleDeclaration
virtual void parseSimpleDeclaration(SimpleDeclarationAST *)
Definition: cpptree2uml.cpp:270
CppTree2Uml::setRootPath
void setRootPath(const QString &rootPath)
Definition: cpptree2uml.cpp:71
CppTree2Uml::m_doc
UMLDoc * m_doc
Definition: cpptree2uml.h:96
CppTree2Uml::parseNamespace
virtual void parseNamespace(NamespaceAST *)
Definition: cpptree2uml.cpp:108
CppTree2Uml::parseAccessDeclaration
virtual void parseAccessDeclaration(AccessDeclarationAST *)
Definition: cpptree2uml.cpp:610
CppTree2Uml::m_currentClass
UMLClassifier * m_currentClass[STACKSIZE+1]
stack
Definition: cpptree2uml.h:90
CppTree2Uml::m_rootFolder
UMLFolder * m_rootFolder
Definition: cpptree2uml.h:95
CppTree2Uml::m_thread
CodeImpThread * m_thread
Definition: cpptree2uml.h:93
CppTree2Uml::parseFunctionDeclaration
virtual void parseFunctionDeclaration(GroupAST *funSpec, GroupAST *storageSpec, TypeSpecifierAST *typeSpec, InitDeclaratorAST *decl)
Definition: cpptree2uml.cpp:622
CppTree2Uml::parseFunctionArguments
void parseFunctionArguments(DeclaratorAST *declarator, UMLOperation *method)
Definition: cpptree2uml.cpp:711
CppTree2Uml::scopeOfDeclarator
QStringList scopeOfDeclarator(DeclaratorAST *d, const QStringList &scope)
Definition: cpptree2uml.cpp:801
CppTree2Uml::CppTree2Uml
CppTree2Uml(const QString &fileName, CodeImpThread *thread=0)
Definition: cpptree2uml.cpp:40
CppTree2Uml::m_currentAccess
Uml::Visibility::Enum m_currentAccess
Definition: cpptree2uml.h:78
CppTree2Uml::CppTree2Uml
CppTree2Uml(const CppTree2Uml &source)
CppTree2Uml::parseBaseClause
virtual void parseBaseClause(BaseClauseAST *baseClause, UMLClassifier *klass)
Definition: cpptree2uml.cpp:758
CppTree2Uml::parseElaboratedTypeSpecifier
virtual void parseElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST *)
Definition: cpptree2uml.cpp:525
CppTree2Uml::m_templateParams
Model_Utils::NameAndType_List m_templateParams
Definition: cpptree2uml.h:85
CppTree2Uml::m_clsCnt
int m_clsCnt
stack top for m_currentClass
Definition: cpptree2uml.h:92
CppTree2Uml::parseTemplateDeclaration
virtual void parseTemplateDeclaration(TemplateDeclarationAST *)
Definition: cpptree2uml.cpp:222
CppTree2Uml::clear
void clear()
Definition: cpptree2uml.cpp:54
CppTree2Uml::parseDeclaration2
virtual void parseDeclaration2(GroupAST *funSpec, GroupAST *storageSpec, TypeSpecifierAST *typeSpec, InitDeclaratorAST *decl)
Definition: cpptree2uml.cpp:553
CppTree2Uml::parseEnumSpecifier
virtual void parseEnumSpecifier(EnumSpecifierAST *)
Definition: cpptree2uml.cpp:502
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
UMLDoc
Definition: umldoc.h:75
UMLFolder
Non-graphical management of objects and diagrams of a Folder.
Definition: folder.h:35
UMLOperation
Definition: operation.h:25
UMLPackage
Non-graphical information for a Package.
Definition: package.h:33
STACKSIZE
#define STACKSIZE
Definition: cpptree2uml.h:88
model_utils.h
Model_Utils::NameAndType_List
QLinkedList< NameAndType > NameAndType_List
Auxiliary type for OpDescriptor.
Definition: model_utils.h:126
Uml::Visibility::Enum
Enum
Definition: basictypes.h:59