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

Last change on this file since 500 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 4.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the qt3to4 porting application of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** 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 are unsure which license is appropriate for your use, please
37** contact the sales department 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.