support for creating template instance classes
[lqt/mk.git] / cpptoxml / parser / name_compiler.h
blobd0e0272bb3d5d4957cb5da13eb2713777de6c6d9
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 NAME_COMPILER_H
27 #define NAME_COMPILER_H
29 #include "default_visitor.h"
30 #include <QtCore/QStringList>
32 class TokenStream;
33 class Binder;
35 class NameCompiler: protected DefaultVisitor
37 public:
38 NameCompiler(Binder *binder);
40 void run(NameAST *node) { internal_run(node); }
41 void run(UnqualifiedNameAST *node) { internal_run(node); }
43 QString name() const { return _M_name.join("::"); }
44 QStringList qualifiedName() const { return _M_name; }
46 protected:
47 virtual void visitUnqualifiedName(UnqualifiedNameAST *node);
48 virtual void visitTemplateArgument(TemplateArgumentAST *node);
50 QString internal_run(AST *node);
51 QString decode_operator(std::size_t index) const;
53 private:
54 Binder *_M_binder;
55 TokenStream *_M_token_stream;
56 QStringList _M_name;
59 #endif // NAME_COMPILER_H
61 // kate: space-indent on; indent-width 2; replace-tabs on;