use separate slot implementation for each module
[lqt.git] / cpptoxml / parser / declarator_compiler.h
blob7e2d24cf06ac13bfc0504d4e6d3483661e1e7a72
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 #ifndef DECLARATOR_COMPILER_H
27 #define DECLARATOR_COMPILER_H
29 #include "default_visitor.h"
30 #include "codemodel.h"
32 #include <QtCore/QString>
33 #include <QtCore/QList>
35 class TokenStream;
36 class Binder;
38 class DeclaratorCompiler: protected DefaultVisitor
40 public:
41 struct Parameter
43 TypeInfo type;
44 QString name;
45 QString defaultValueExpression;
46 bool defaultValue;
48 Parameter(): defaultValue(false) {}
51 public:
52 DeclaratorCompiler(Binder *binder);
54 void run(DeclaratorAST *node);
56 inline QString id() const { return _M_id; }
57 inline QStringList arrayElements() const { return _M_array; }
58 inline bool isFunction() const { return _M_function; }
59 inline bool isVariadics() const { return _M_variadics; }
60 inline bool isReference() const { return _M_reference; }
61 inline int indirection() const { return _M_indirection; }
62 inline QList<Parameter> parameters() const { return _M_parameters; }
64 protected:
65 virtual void visitPtrOperator(PtrOperatorAST *node);
66 virtual void visitParameterDeclaration(ParameterDeclarationAST *node);
68 private:
69 Binder *_M_binder;
70 TokenStream *_M_token_stream;
72 bool _M_function;
73 bool _M_reference;
74 bool _M_variadics;
75 int _M_indirection;
76 QString _M_id;
77 QStringList _M_array;
78 QList<Parameter> _M_parameters;
81 #endif // DECLARATOR_COMPILER_H
83 // kate: space-indent on; indent-width 2; replace-tabs on;