예제 #1
0
bool ViewGenerator::generate() const
{
    QStringList files;

    // Reserved word check
    if (excludedDirName()->contains(dstDir.dirName())) {
        qCritical("Reserved word error. Please use another word.  View name: %s", qPrintable(dstDir.dirName()));
        return false;
    }

    mkpath(dstDir);

    if (!TableSchema(tableName).exists()) {
        qCritical("table not found, %s", qPrintable(tableName));
        return false;
    }

    // Generates view files
    files << generateViews();

    // Generates a project file
    QDir dir(QDir::cleanPath(dstDir.filePath("..")));
    ProjectFileGenerator progen(dir.filePath("views.pro"));
    return progen.generate(QStringList(), VIEWS_PROJECT);
}
bool OtamaGenerator::generate(const QString &dstDir) const
{
    QDir dir(dstDir + viewName.toLower());

    // Reserved word check
    if (excludedDirName.contains(dir.dirName())) {
        qCritical("Reserved word error. Please use another word.  View name: %s", qPrintable(dir.dirName()));
        return false;
    }

    mkpath(dir);

    // Generates view files
    generateViews(dir.path());
    return true;
}