1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2005-2007 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef CPPTREE2UML_H
#define CPPTREE2UML_H
#include "tree_parser.h"
#include <tqstringlist.h>
#include "../../model_utils.h"
// fwd decls
class UMLClassifier;
class UMLOperation;
class UMLPackage;
class CppTree2Uml: public TreeParser
{
public:
CppTree2Uml( const TQString& fileName);
virtual ~CppTree2Uml();
//FileDom file() { return m_file; }
// translation-unit
virtual void parseTranslationUnit( TranslationUnitAST* );
// declarations
//virtual void parseDeclaration( DeclarationAST* ); // use tqparent method
//virtual void parseLinkageSpecification( LinkageSpecificationAST* ); // use tqparent method
virtual void parseNamespace( NamespaceAST* );
//virtual void parseNamespaceAlias( NamespaceAliasAST* ); // use tqparent method
//virtual void parseUsing( UsingAST* ); // use tqparent method
//virtual void parseUsingDirective( UsingDirectiveAST* ); // use tqparent method
virtual void parseTypedef( TypedefAST* );
virtual void parseTemplateDeclaration( TemplateDeclarationAST* );
virtual void parseSimpleDeclaration( SimpleDeclarationAST* );
virtual void parseFunctionDefinition( FunctionDefinitionAST* );
//virtual void parseLinkageBody( LinkageBodyAST* ); // use tqparent method
virtual void parseAccessDeclaration( AccessDeclarationAST* );
// type-specifier
//virtual void parseTypeSpecifier( TypeSpecifierAST* ); // use tqparent method
virtual void parseClassSpecifier( ClassSpecifierAST* );
virtual void parseEnumSpecifier( EnumSpecifierAST* );
virtual void parseElaboratedTypeSpecifier( ElaboratedTypeSpecifierAST* );
// non-overriding (locally added) methods
virtual void parseDeclaration( GroupAST* funSpec, GroupAST* storageSpec, TypeSpecifierAST* typeSpec, InitDeclaratorAST* decl );
virtual void parseFunctionDeclaration( GroupAST* funSpec, GroupAST* storageSpec, TypeSpecifierAST* typeSpec, InitDeclaratorAST* decl );
void parseFunctionArguments( DeclaratorAST* declarator, UMLOperation* method);
virtual void parseBaseClause( BaseClauseAST* baseClause, UMLClassifier* klass );
private:
//NamespaceDom findOrInsertNamespace( NamespaceAST* ast, const TQString& name );
TQString typeOfDeclaration( TypeSpecifierAST* typeSpec, DeclaratorAST* declarator );
TQStringList scopeOfName( NameAST* id, const TQStringList& scope );
TQStringList scopeOfDeclarator( DeclaratorAST* d, const TQStringList& scope );
/**
* Flush template parameters pending in m_templateParams to the klass.
*/
void flushTemplateParams(UMLClassifier *klass);
private:
//FileDom m_file;
TQString m_fileName;
TQStringList m_currentScope;
Uml::Visibility m_currentAccess;
bool m_inSlots;
bool m_inSignals;
int m_anon;
bool m_inStorageSpec;
bool m_inTypedef;
TQString m_comment;
Model_Utils::NameAndType_List m_templateParams;
DeclaratorAST* m_currentDeclarator;
# define STACKSIZE 30
UMLPackage* m_currentNamespace[STACKSIZE+1]; ///< stack
UMLClassifier* m_currentClass[STACKSIZE+1]; ///< stack
int m_nsCnt; ///< stack top for m_currentNamespace
int m_clsCnt; ///< stack top for m_currentClass
private:
CppTree2Uml( const CppTree2Uml& source );
void operator = ( const CppTree2Uml& source );
};
#endif // CPPTREE2UML
|