Add rpp files
[rpp.git] / src / declarator_compiler.h
blob305b544d9db471ab749e59c91634f68aee2e9ae7
1 /****************************************************************************
2 **
3 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
4 **
5 ** This file is part of Qt Jambi.
6 **
7 ** ** This file may be used under the terms of the GNU General Public
8 ** License version 2.0 as published by the Free Software Foundation
9 ** and appearing in the file LICENSE.GPL included in the packaging of
10 ** this file. Please review the following information to ensure GNU
11 ** General Public Licensing requirements will be met:
12 ** http://www.trolltech.com/products/qt/opensource.html
14 ** If you are unsure which license is appropriate for your use, please
15 ** review the following information:
16 ** http://www.trolltech.com/products/qt/licensing.html or contact the
17 ** 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 ****************************************************************************/
25 /* This file is part of KDevelop
26 Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
28 This library is free software; you can redistribute it and/or
29 modify it under the terms of the GNU Library General Public
30 License version 2 as published by the Free Software Foundation.
32 This library is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 Library General Public License for more details.
37 You should have received a copy of the GNU Library General Public License
38 along with this library; see the file COPYING.LIB. If not, write to
39 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
40 Boston, MA 02110-1301, USA.
43 #ifndef DECLARATOR_COMPILER_H
44 #define DECLARATOR_COMPILER_H
46 #include "default_visitor.h"
47 #include "codemodel.h"
49 #include <QtCore/QString>
50 #include <QtCore/QList>
52 class TokenStream;
53 class Binder;
55 class DeclaratorCompiler: protected DefaultVisitor
57 public:
58 struct Parameter
60 TypeInfo type;
61 QString name;
62 QString defaultValueExpression;
63 bool defaultValue;
65 Parameter(): defaultValue(false) {}
68 public:
69 DeclaratorCompiler(Binder *binder);
71 void run(DeclaratorAST *node);
73 inline QString id() const { return _M_id; }
74 inline QStringList arrayElements() const { return _M_array; }
75 inline bool isFunction() const { return _M_function; }
76 inline bool isVariadics() const { return _M_variadics; }
77 inline bool isReference() const { return _M_reference; }
78 inline int indirection() const { return _M_indirection; }
79 inline QList<Parameter> parameters() const { return _M_parameters; }
81 protected:
82 virtual void visitPtrOperator(PtrOperatorAST *node);
83 virtual void visitParameterDeclaration(ParameterDeclarationAST *node);
85 private:
86 Binder *_M_binder;
87 TokenStream *_M_token_stream;
89 bool _M_function;
90 bool _M_reference;
91 bool _M_variadics;
92 int _M_indirection;
93 QString _M_id;
94 QStringList _M_array;
95 QList<Parameter> _M_parameters;
98 #endif // DECLARATOR_COMPILER_H
100 // kate: space-indent on; indent-width 2; replace-tabs on;