Alien-SmokeQt
view release on metacpan or search on metacpan
generator/type.cpp 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.
*/
#include "type.h"
QHash<QString, Class> classes;
QHash<QString, Typedef> typedefs;
QHash<QString, Enum> enums;
QHash<QString, Function> functions;
QHash<QString, GlobalVar> globals;
QHash<QString, Type> types;
QString BasicTypeDeclaration::toString() const
{
QString ret;
Class* parent = m_parent;
while (parent) {
ret.prepend(parent->name() + "::");
parent = parent->parent();
}
if (!m_nspace.isEmpty())
ret.prepend(m_nspace + "::");
ret += m_name;
return ret;
}
QString Member::toString(bool withAccess, bool withClass) const
{
QString ret;
if (withAccess) {
if (m_access == Access_public)
ret += "public ";
else if (m_access == Access_protected)
ret += "protected ";
else if (m_access == Access_private)
ret += "private ";
}
if (m_flags & Static)
ret += "static ";
if (m_flags & Virtual)
ret += "virtual ";
ret += m_type->toString() + " ";
if (withClass)
ret += m_typeDecl->toString() + "::";
ret += m_name;
return ret;
}
QString EnumMember::toString() const
{
QString ret;
if (m_typeDecl->parent())
ret += m_typeDecl->parent()->toString();
else
ret += m_typeDecl->nameSpace();
return ret + "::" + name();
}
QString Parameter::toString() const
{
return m_type->toString();
}
QString Method::toString(bool withAccess, bool withClass, bool withInitializer) const
{
QString ret = Member::toString(withAccess, withClass);
ret += "(";
for (int i = 0; i < m_params.count(); i++) {
ret += m_params[i].toString();
if (i < m_params.count() - 1) ret += ", ";
( run in 0.450 second using v1.01-cache-2.11-cpan-13bb782fe5a )