|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the qt3to4 porting application of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
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 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "codemodelwalker.h" |
|
43 |
|
44 QT_BEGIN_NAMESPACE |
|
45 using namespace CodeModel; |
|
46 |
|
47 void 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 |
|
80 void 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 |
|
102 void 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 |
|
117 void CodeModelWalker::parseFunctionMember(CodeModel::FunctionMember *member) |
|
118 { |
|
119 if(!member) |
|
120 return; |
|
121 if(member->functionBodyScope()) |
|
122 parseScope(member->functionBodyScope()); |
|
123 } |
|
124 |
|
125 QT_END_NAMESPACE |