use separate slot implementation for each module
[lqt.git] / cpptoxml / parser / class_compiler.cpp
blob098437d63c47389dbb2c58af6b3d227d143607e8
1 /****************************************************************************
2 **
3 ** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
4 ** Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
5 **
6 ** This file is part of the Qt Script Generator project on Trolltech Labs.
7 **
8 ** This file may be used under the terms of the GNU General Public
9 ** License version 2.0 as published by the Free Software Foundation
10 ** and appearing in the file LICENSE.GPL included in the packaging of
11 ** this file. Please review the following information to ensure GNU
12 ** General Public Licensing requirements will be met:
13 ** http://www.trolltech.com/products/qt/opensource.html
15 ** If you are unsure which license is appropriate for your use, please
16 ** review the following information:
17 ** http://www.trolltech.com/products/qt/licensing.html or contact the
18 ** sales department at sales@trolltech.com.
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 ****************************************************************************/
26 #include "class_compiler.h"
27 #include "lexer.h"
28 #include "binder.h"
29 #include "tokens.h"
31 ClassCompiler::ClassCompiler(Binder *binder)
32 : _M_binder (binder),
33 _M_token_stream(binder->tokenStream ()),
34 name_cc(_M_binder),
35 type_cc(_M_binder)
39 ClassCompiler::~ClassCompiler()
43 void ClassCompiler::run(ClassSpecifierAST *node)
45 name_cc.run(node->name);
46 _M_name = name_cc.name();
47 _M_base_classes.clear();
49 visit(node);
52 void ClassCompiler::visitClassSpecifier(ClassSpecifierAST *node)
54 visit(node->base_clause);
57 void ClassCompiler::visitBaseSpecifier(BaseSpecifierAST *node)
59 name_cc.run(node->name);
60 QString name = name_cc.name();
61 QString modifier = "";
63 if (! name.isEmpty()) {
64 _M_base_classes.append(name);
65 switch (_M_token_stream->kind(node->access_specifier)) {
66 case Token_public:
67 modifier = modifier.prepend("public");
68 break;
69 case Token_private:
70 modifier = modifier.prepend("private");
71 break;
72 case Token_protected:
73 modifier = modifier.prepend("protected");
74 break;
75 default:
76 modifier = modifier.prepend("private");
77 break;
79 if (_M_token_stream->kind(node->virt)==Token_virtual) {
80 modifier = modifier.prepend("virtual ");
82 _M_base_classes_mod.append(modifier);
87 // kate: space-indent on; indent-width 2; replace-tabs on;