source: trunk/tools/porting/src/codemodelwalker.cpp@ 561

Last change on this file since 561 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 4.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the qt3to4 porting application of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "codemodelwalker.h"
43
44QT_BEGIN_NAMESPACE
45using namespace CodeModel;
46
47void CodeModelWalker::parseScope(CodeModel::Scope *scope)
48{
49 if(!scope)
50 return;
51
52 if(scope->toClassScope())
53 parseClassScope(scope->toClassScope());
54 if(scope->toNamespaceScope())
55 parseNamespaceScope(scope->toNamespaceScope());
56 if(scope->toBlockScope())
57 parseBlockScope(scope->toBlockScope());
58
59
60 {
61 MemberCollection collection = scope->members();
62 MemberCollection::ConstIterator it = collection.constBegin();
63 while(it != collection.constEnd())
64 parseMember(*it++);
65 }
66 {
67 ScopeCollection collection = scope->scopes();
68 ScopeCollection::ConstIterator it = collection.constBegin();
69 while(it != collection.constEnd())
70 parseScope(*it++);
71 }
72 {
73 NameUseCollection collection = scope->nameUses();
74 NameUseCollection::ConstIterator it = collection.constBegin();
75 while(it != collection.constEnd())
76 parseNameUse(*it++);
77 }
78}
79
80void CodeModelWalker::parseType(CodeModel::Type *type)
81{
82 if(!type)
83 return;
84 if (type->toEnumType())
85 parseEnumType(type->toEnumType());
86 else if (type->toClassType())
87 parseClassType(type->toClassType());
88 else if (type->toBuiltinType())
89 parseBuiltinType(type->toBuiltinType());
90 else if (type->toPointerType())
91 parsePointerType(type->toPointerType());
92 else if (type->toReferenceType())
93 parseReferenceType(type->toReferenceType());
94 else if (type->toGenericType())
95 parseGenericType(type->toGenericType());
96 else if (type->toAliasType())
97 parseAliasType(type->toAliasType());
98 else if (type->toUnknownType())
99 parseUnknownType(type->toUnknownType());
100}
101
102void CodeModelWalker::parseMember(CodeModel::Member *member)
103{
104 if(!member)
105 return;
106
107 if (member->toFunctionMember())
108 parseFunctionMember(member->toFunctionMember());
109 else if (member->toVariableMember())
110 parseVariableMember(member->toVariableMember());
111 else if (member->toUsingDeclarationMember())
112 parseUsingDeclarationMember(member->toUsingDeclarationMember());
113 else if (member->toTypeMember())
114 parseTypeMember(member->toTypeMember());
115}
116
117void CodeModelWalker::parseFunctionMember(CodeModel::FunctionMember *member)
118{
119 if(!member)
120 return;
121 if(member->functionBodyScope())
122 parseScope(member->functionBodyScope());
123}
124
125QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.