/usr/include/smokegen/generatorvisitor.h is in smoke-dev-tools 4:4.14.3-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | /*
Copyright (C) 2009 Arno Rehn <arno@arnorehn.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PARSERVISITOR_H
#define PARSERVISITOR_H
#include <QStringList>
#include <QStack>
#include <default_visitor.h>
#include <parsesession.h>
#include <lexer.h>
#include "type.h"
class NameCompiler;
class TypeCompiler;
struct QProperty
{
QString type;
bool isPtr;
QString name;
QString read;
QString write;
};
class GeneratorVisitor : public DefaultVisitor
{
public:
GeneratorVisitor(ParseSession *session, const QString& header = QString());
virtual ~GeneratorVisitor();
BasicTypeDeclaration* resolveTypeInSuperClasses(const Class* klass, const QString& name);
BasicTypeDeclaration* resolveType(const QString& name);
BasicTypeDeclaration* resolveType(QString& name);
QString resolveEnumMember(const QString& name);
QString resolveEnumMember(const QString& parent, const QString& name);
QPair<bool, bool> parseCv(const ListNode<std::size_t> *cv);
protected:
inline const Token& token(std::size_t token) { return m_session->token_stream->token(token); }
virtual void visitAccessSpecifier(AccessSpecifierAST* node);
virtual void visitBaseSpecifier(BaseSpecifierAST* node);
virtual void visitClassSpecifier(ClassSpecifierAST* node);
virtual void visitDeclarator(DeclaratorAST* node);
virtual void visitElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST* node);
virtual void visitEnumSpecifier(EnumSpecifierAST *);
virtual void visitEnumerator(EnumeratorAST *);
virtual void visitFunctionDefinition(FunctionDefinitionAST* );
virtual void visitInitializerClause(InitializerClauseAST *);
virtual void visitNamespace(NamespaceAST* node);
virtual void visitParameterDeclaration(ParameterDeclarationAST* node);
virtual void visitSimpleDeclaration(SimpleDeclarationAST* node);
virtual void visitSimpleTypeSpecifier(SimpleTypeSpecifierAST* node);
virtual void visitTemplateDeclaration(TemplateDeclarationAST* node);
virtual void visitTemplateArgument(TemplateArgumentAST* node);
virtual void visitTypedef(TypedefAST* node);
virtual void visitUsing(UsingAST* node);
virtual void visitUsingDirective(UsingDirectiveAST* node);
private:
NameCompiler *nc;
TypeCompiler *tc;
ParseSession *m_session;
QString m_header;
bool createType;
bool createTypedef;
short inClass;
bool inTemplate;
bool isStatic;
bool isVirtual;
bool isExplicit;
bool hasInitializer;
Type currentType;
Type* currentTypeRef;
bool inMethod;
Method currentMethod;
Function currentFunction;
Enum currentEnum;
Enum* currentEnumRef;
Class::Kind kind;
QStack<Class*> klass;
QStack<Access> access;
QStack<bool> inSignals;
QStack<bool> inSlots;
QStack<QStringList> usingTypes;
QStack<QStringList> usingNamespaces;
QStringList nspace;
QStack<QList<QProperty> > q_properties;
};
#endif // PARSERVISITOR_H
|