Alien-SmokeQt

 view release on metacpan or  search on metacpan

generator/type.h  view on Meta::CPAN

/*
    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 TYPE_H
#define TYPE_H

#include <QString>
#include <QStringList>
#include <QHash>
#include <QtDebug>

#include "generator_export.h"

class Class;
class Typedef;
class Enum;
class GlobalVar;
class Function;
class Type;

extern GENERATOR_EXPORT QHash<QString, Class> classes;
extern GENERATOR_EXPORT QHash<QString, Typedef> typedefs;
extern GENERATOR_EXPORT QHash<QString, Enum> enums;
extern GENERATOR_EXPORT QHash<QString, Function> functions;
extern GENERATOR_EXPORT QHash<QString, GlobalVar> globals;
extern GENERATOR_EXPORT QHash<QString, Type> types;

class Method;
class Field;

enum Access {
    Access_public,
    Access_protected,
    Access_private
};

class Class;

class GENERATOR_EXPORT BasicTypeDeclaration
{
public:
    BasicTypeDeclaration() : m_access(Access_public) {}
    virtual ~BasicTypeDeclaration() {}
    virtual bool isValid() const { return !m_name.isEmpty(); }
    
    void setName(const QString& name) { m_name = name; }
    QString name() const { return m_name; }
    
    void setNameSpace(const QString& nspace) { m_nspace = nspace; }
    QString nameSpace() const { return m_nspace; }

    void setParent(Class* parent) { m_parent = parent; }
    Class* parent() const { return m_parent; }

    void setAccess(Access access) { m_access = access; }
    Access access() const { return m_access; }

    void setFileName(const QString& fileName) { m_file = fileName; }
    QString fileName() const { return m_file; }

    QString toString() const;

protected:
    BasicTypeDeclaration(const QString& name, const QString& nspace = QString(), Class* parent = 0)
        : m_name(name), m_nspace(nspace), m_parent(parent) {}

    QString m_name;
    QString m_nspace;
    Class* m_parent;
    QString m_file;
    Access m_access;
};

class GENERATOR_EXPORT Class : public BasicTypeDeclaration
{
public:
    enum Kind {
        Kind_Class,
        Kind_Struct,
        Kind_Union
    };
    
    struct BaseClassSpecifier {
        Class *baseClass;
        Access access;



( run in 0.960 second using v1.01-cache-2.11-cpan-13bb782fe5a )