umbrello  2.35.1
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
15 class CodeImpThread;
16 class UMLClassifier;
17 class UMLFolder;
18 class UMLOperation;
19 class UMLPackage;
20 
21 class CppTree2Uml: public TreeParser
22 {
23 public:
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 
61 private:
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);
68 
69 private:
70  //FileDom m_file;
71  QString m_fileName;
72  QStringList m_currentScope;
74  bool m_inSlots;
76  int m_anon;
79  QString m_comment;
81 
82  DeclaratorAST* m_currentDeclarator;
83 # define STACKSIZE 30
86  int m_nsCnt;
87  int m_clsCnt;
89  QString m_rootPath;
92 
93 private:
94  CppTree2Uml(const CppTree2Uml& source);
95  void operator = (const CppTree2Uml& source);
96 };
97 
98 #endif // CPPTREE2UML
document
GNU GENERAL PUBLIC LICENSE June Free Software Inc Franklin Fifth USA Everyone is permitted to copy and distribute verbatim copies of this license document
Definition: GPL-2.0-only.txt:8
datatype.h
template.h
DEBUG_REGISTER
#define DEBUG_REGISTER(src)
Definition: debug_utils.h:129
Import_Utils::insertAttribute
UMLAttribute * insertAttribute(UMLClassifier *owner, Uml::Visibility::Enum scope, const QString &name, UMLClassifier *attrType, const QString &comment, bool isStatic)
Definition: import_utils.cpp:452
logDebug1
#define logDebug1(s, a)
Definition: uml.h:541
CppTree2Uml
Definition: cpptree2uml.h:21
UMLOperation::isDestructorOperation
bool isDestructorOperation() const
Definition: operation.cpp:391
CppTree2Uml::m_inSignals
bool m_inSignals
Definition: cpptree2uml.h:75
CppTree2Uml::m_currentDeclarator
DeclaratorAST * m_currentDeclarator
Definition: cpptree2uml.h:82
CppTree2Uml::setRootPath
void setRootPath(const QString &rootPath)
Definition: cpptree2uml.cpp:69
UMLOperation::setInline
void setInline(bool b)
Definition: operation.cpp:486
CppTree2Uml::typeOfDeclaration
QString typeOfDeclaration(TypeSpecifierAST *typeSpec, DeclaratorAST *declarator)
Definition: cpptree2uml.cpp:726
Import_Utils::createArtifact
UMLObject * createArtifact(const QString &name, UMLFolder *parentPkg, const QString &comment)
Definition: import_utils.cpp:703
CppTree2Uml::scopeOfName
QStringList scopeOfName(NameAST *id, const QStringList &scope)
Definition: cpptree2uml.cpp:776
UMLDatatype
Non-graphical information for a Datatype.
Definition: datatype.h:20
UMLObject::ot_Class
@ ot_Class
Definition: umlobject.h:85
operation.h
UMLClassifierListItem::getTypeName
virtual QString getTypeName() const
Definition: classifierlistitem.cpp:108
CppTree2Uml::parseSimpleDeclaration
virtual void parseSimpleDeclaration(SimpleDeclarationAST *)
Definition: cpptree2uml.cpp:267
Import_Utils::createGeneralization
UMLAssociation * createGeneralization(UMLClassifier *child, UMLClassifier *parent)
Definition: import_utils.cpp:627
logError0
#define logError0(s)
Definition: uml.h:539
UMLObject::ot_Interface
@ ot_Interface
Definition: umlobject.h:82
CppTree2Uml::m_thread
CodeImpThread * m_thread
Definition: cpptree2uml.h:88
Model_Utils::NameAndType::m_type
UMLObject * m_type
Definition: model_utils.h:113
logError1
#define logError1(s, a)
Definition: uml.h:545
UMLClassifier::getOpList
UMLOperationList getOpList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=0) const
Definition: classifier.cpp:939
CppTree2Uml::parseElaboratedTypeSpecifier
virtual void parseElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST *)
Definition: cpptree2uml.cpp:526
Import_Utils::createUMLObject
UMLObject * createUMLObject(UMLObject::ObjectType type, const QString &inName, UMLPackage *parentPkg, const QString &comment, const QString &stereotype, bool searchInParentPackageOnly, bool remapParent)
Definition: import_utils.cpp:184
UMLObject::isStatic
bool isStatic() const
Definition: umlobject.cpp:362
CppTree2Uml::CppTree2Uml
CppTree2Uml(const QString &fileName, CodeImpThread *thread=0)
Definition: cpptree2uml.cpp:38
UMLObject::ot_Package
@ ot_Package
Definition: umlobject.h:81
CppTree2Uml::m_nsCnt
int m_nsCnt
stack top for m_currentNamespace
Definition: cpptree2uml.h:86
CppTree2Uml::parseNamespace
virtual void parseNamespace(NamespaceAST *)
Definition: cpptree2uml.cpp:106
Import_Utils::insertMethod
void insertMethod(UMLClassifier *klass, UMLOperation *&op, Uml::Visibility::Enum scope, const QString &type, bool isStatic, bool isAbstract, bool isFriend, bool isConstructor, bool isDestructor, const QString &comment)
Definition: import_utils.cpp:524
CppTree2Uml::flushTemplateParams
void flushTemplateParams(UMLClassifier *klass)
Definition: cpptree2uml.cpp:801
UMLObject::ot_UMLObject
@ ot_UMLObject
Definition: umlobject.h:78
model_utils.h
contains
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it contains
Definition: GPL-2.0-only.txt:149
UMLObject
The base class for UML objects.
Definition: umlobject.h:69
UMLObject::isAbstract
bool isAbstract() const
Definition: umlobject.cpp:344
Model_Utils::NameAndType_List
QLinkedList< NameAndType > NameAndType_List
Auxiliary type for OpDescriptor.
Definition: model_utils.h:124
import_utils.h
CppTree2Uml::m_rootPath
QString m_rootPath
root path of project
Definition: cpptree2uml.h:89
Import_Utils::putAtGlobalScope
void putAtGlobalScope(bool yesno)
Definition: import_utils.cpp:80
CppTree2Uml::m_templateParams
Model_Utils::NameAndType_List m_templateParams
Definition: cpptree2uml.h:80
Settings::optionState
OptionState & optionState()
Definition: optionstate.cpp:357
UMLObject::asUMLDatatype
UMLDatatype * asUMLDatatype()
Definition: umlobject.cpp:1425
CppTree2Uml::m_currentAccess
Uml::Visibility::Enum m_currentAccess
Definition: cpptree2uml.h:73
Uml::Visibility::Public
@ Public
Definition: basictypes.h:46
CppTree2Uml::operator=
void operator=(const CppTree2Uml &source)
UMLOperation::setConst
void setConst(bool b)
Definition: operation.cpp:422
cpptree2uml.h
CppTree2Uml::m_doc
UMLDoc * m_doc
Definition: cpptree2uml.h:91
UMLOperation::setFinal
void setFinal(bool b)
Definition: operation.cpp:454
UMLObject::asUMLPackage
UMLPackage * asUMLPackage()
Definition: umlobject.cpp:1438
it
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
Definition: GPL-2.0-only.txt:64
UMLApp
Definition: uml.h:94
UMLDoc::rootFolder
UMLFolder * rootFolder(Uml::ModelType::Enum mt) const
Definition: umldoc.cpp:3264
CppTree2Uml::m_currentScope
QStringList m_currentScope
Definition: cpptree2uml.h:72
CppTree2Uml::m_anon
int m_anon
Definition: cpptree2uml.h:76
number
it is up to the author donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License If the distribution and or use of the Library is restricted in certain countries either by patents or by copyrighted the original copyright holder who places the Library under this License may add an geographical distribution limitation excluding those so that distribution is permitted only in or among countries not thus excluded In such this License incorporates the limitation as if written in the body of this License The Free Software Foundation may publish revised and or new versions of the Library General Public License from time to time Such new versions will be similar in spirit to the present but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Library specifies a version number of this License which applies to it and any later you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation If the Library does not specify a license version number
Definition: LGPL-2.0-only.txt:368
CppTree2Uml::parseClassSpecifier
virtual void parseClassSpecifier(ClassSpecifierAST *)
Definition: cpptree2uml.cpp:398
Uml::ModelType::Component
@ Component
Definition: basictypes.h:30
UMLClassifier::setBaseType
void setBaseType(UMLObject::ObjectType ot)
Definition: classifier.cpp:81
Import_Utils::createSubDir
UMLFolder * createSubDir(const QString &name, UMLFolder *parentPkg, const QString &comment)
Definition: import_utils.cpp:658
UMLClassifierListItem::setType
virtual void setType(UMLObject *type)
Definition: classifierlistitem.cpp:123
CppTree2Uml::parseFunctionDeclaration
virtual void parseFunctionDeclaration(GroupAST *funSpec, GroupAST *storageSpec, TypeSpecifierAST *typeSpec, InitDeclaratorAST *decl)
Definition: cpptree2uml.cpp:611
CppTree2Uml::parseDeclaration2
virtual void parseDeclaration2(GroupAST *funSpec, GroupAST *storageSpec, TypeSpecifierAST *typeSpec, InitDeclaratorAST *decl)
Definition: cpptree2uml.cpp:542
UMLObject::ot_Datatype
@ ot_Datatype
Definition: umlobject.h:83
CppTree2Uml::parseAccessDeclaration
virtual void parseAccessDeclaration(AccessDeclarationAST *)
Definition: cpptree2uml.cpp:599
Model_Utils::NameAndType_ListIt
QLinkedList< NameAndType >::iterator NameAndType_ListIt
Auxiliary type for OpDescriptor.
Definition: model_utils.h:125
Import_Utils::addMethodParameter
UMLAttribute * addMethodParameter(UMLOperation *method, const QString &type, const QString &name)
Definition: import_utils.cpp:596
UMLObject::asUMLClassifier
UMLClassifier * asUMLClassifier()
Definition: umlobject.cpp:1422
CppTree2Uml::m_currentClass
UMLClassifier * m_currentClass[STACKSIZE+1]
stack
Definition: cpptree2uml.h:85
UMLObject::setStereotype
void setStereotype(const QString &_name)
Definition: umlobject.cpp:524
Import_Utils::isDatatype
bool isDatatype(const QString &name, UMLPackage *parentPkg)
Definition: import_utils.cpp:832
CppTree2Uml::m_clsCnt
int m_clsCnt
stack top for m_currentClass
Definition: cpptree2uml.h:87
CodeImpThread
Definition: codeimpthread.h:21
c
type show c for details The hypothetical commands show w and show c should show the appropriate parts of the General Public License Of the commands you use may be called something other than show w and show c
Definition: GPL-2.0-only.txt:301
umllistview.h
Import_Utils::makeOperation
UMLOperation * makeOperation(UMLClassifier *parent, const QString &name)
Definition: import_utils.cpp:442
UMLDoc
Definition: umldoc.h:69
Model_Utils::NameAndType
Definition: model_utils.h:111
UMLAttribute
Sets up attribute information.
Definition: attribute.h:22
UMLClassifier::getAttributeList
UMLAttributeList getAttributeList() const
Definition: classifier.cpp:435
CppTree2Uml::parseEnumSpecifier
virtual void parseEnumSpecifier(EnumSpecifierAST *)
Definition: cpptree2uml.cpp:503
CodeImpThread::emitMessageToLog
void emitMessageToLog(const QString &file, const QString &text)
Definition: codeimpthread.cpp:90
UMLObject::setBaseType
virtual void setBaseType(ObjectType ot)
Definition: umlobject.cpp:411
UMLFolder
Non-graphical management of objects and diagrams of a Folder.
Definition: folder.h:29
STACKSIZE
#define STACKSIZE
Definition: cpptree2uml.h:83
CppTree2Uml::m_comment
QString m_comment
Definition: cpptree2uml.h:79
UMLOperation::setVirtual
void setVirtual(bool b)
Definition: operation.cpp:470
Uml::Visibility::Enum
Enum
Definition: basictypes.h:45
Import_Utils::addEnumLiteral
void addEnumLiteral(UMLEnum *enumType, const QString &literal, const QString &comment, const QString &value)
Definition: import_utils.cpp:617
UMLDoc::findUMLObject
UMLObject * findUMLObject(const QString &name, UMLObject::ObjectType type=UMLObject::ot_UMLObject, UMLObject *currentObj=0)
Definition: umldoc.cpp:1121
classifier.h
UMLDatatype::setIsReference
void setIsReference(bool isRef=true)
Definition: datatype.cpp:51
UMLOperation
Definition: operation.h:19
UMLObject::ot_Enum
@ ot_Enum
Definition: umlobject.h:84
uml.h
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:34
CppTree2Uml::m_inSlots
bool m_inSlots
Definition: cpptree2uml.h:74
debug_utils.h
CppTree2Uml::parseBaseClause
virtual void parseBaseClause(BaseClauseAST *baseClause, UMLClassifier *klass)
Definition: cpptree2uml.cpp:750
CppTree2Uml::scopeOfDeclarator
QStringList scopeOfDeclarator(DeclaratorAST *d, const QStringList &scope)
Definition: cpptree2uml.cpp:793
CppTree2Uml::m_rootFolder
UMLFolder * m_rootFolder
Definition: cpptree2uml.h:90
CppTree2Uml::m_fileName
QString m_fileName
Definition: cpptree2uml.h:71
CppTree2Uml::parseFunctionArguments
void parseFunctionArguments(DeclaratorAST *declarator, UMLOperation *method)
Definition: cpptree2uml.cpp:701
CppTree2Uml::parseFunctionDefinition
virtual void parseFunctionDefinition(FunctionDefinitionAST *)
Definition: cpptree2uml.cpp:289
Uml::Visibility::fromString
Enum fromString(const QString &item, bool checkUnknown)
Definition: basictypes.cpp:115
UMLTemplate
Sets up template information.
Definition: template.h:21
CppTree2Uml::parseTypedef
virtual void parseTypedef(TypedefAST *)
Definition: cpptree2uml.cpp:152
CppTree2Uml::~CppTree2Uml
virtual ~CppTree2Uml()
Definition: cpptree2uml.cpp:48
UMLObject::stereotype
QString stereotype(bool includeAdornments=false) const
Definition: umlobject.cpp:555
UMLOperation::setOverride
void setOverride(bool b)
Definition: operation.cpp:438
codeimpthread.h
UMLEnum
Non-graphical Information for an Enum.
Definition: enum.h:23
CppTree2Uml::m_inTypedef
bool m_inTypedef
Definition: cpptree2uml.h:78
CppTree2Uml::m_currentNamespace
UMLPackage * m_currentNamespace[STACKSIZE+1]
stack
Definition: cpptree2uml.h:84
CppTree2Uml::parseTranslationUnit
virtual void parseTranslationUnit(const ParsedFile &file)
Definition: cpptree2uml.cpp:85
CppTree2Uml::m_inStorageSpec
bool m_inStorageSpec
Definition: cpptree2uml.h:77
Model_Utils::NameAndType::m_name
QString m_name
< Data structure filled by parseAttribute().
Definition: model_utils.h:112
umldoc.h
CppTree2Uml::parseTemplateDeclaration
virtual void parseTemplateDeclaration(TemplateDeclarationAST *)
Definition: cpptree2uml.cpp:220
UMLDatatype::setOriginType
void setOriginType(UMLClassifier *origType)
Definition: datatype.cpp:33
UMLClassifier::addTemplate
UMLTemplate * addTemplate(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: classifier.cpp:1025
UMLPackage
Non-graphical information for a Package.
Definition: package.h:27
CppTree2Uml::clear
void clear()
Definition: cpptree2uml.cpp:52
logDebug0
#define logDebug0(s)
Definition: uml.h:535