<commit_before>
#include <QCoreApplication>
#include <QCommandLineParser>

#include <QLocale>
#include <QTranslator>
#include <QLibraryInfo>
#include <QDebug>

#include <QRegularExpression>
#include <QStringBuilder>
#include <QDir>

#include <ostream>
#include <utime.h>

#include "uwsgiprocess.h"

#define OUT_EXISTS  "  exists"
#define OUT_CREATED " created"

bool buildControllerHeader(const QString &filename, const QString &controllerName, bool helpers);
bool buildControllerImplementation(const QString &filename, const QString &controllerName, bool helpers);

bool createController(const QString &controllerName)
{
    if (controllerName.contains(QRegularExpression(QStringLiteral("\\W"))) || controllerName.contains(QRegularExpression(QStringLiteral("^\\d")))) {
        qDebug() << "Error: Invalid Controller name.";
        return false;
    }

    QDir projectDir;
    if (!uwsgiProcess::findProjectDir(QDir::current(), &projectDir)) {
        qDebug() << "Error: failed to find project";
        return false;
    }

    if (!buildControllerHeader(projectDir.absoluteFilePath(QStringLiteral("src/")) % controllerName.toLower() % QLatin1String(".h"),
                               controllerName,
                               false)) {
        return false;
    }

    if (!buildControllerImplementation(projectDir.absoluteFilePath(QStringLiteral("src/")) % controllerName.toLower() % QLatin1String(".cpp"),
                                       controllerName,
                                       false)) {
        return false;
    }

    // Change the modification time of CMakeLists.txt to force FILE_GLOB to be updated
    utime(projectDir.absoluteFilePath(QStringLiteral("CMakeLists.txt")).toLatin1().data(), NULL);

    qDebug() << "Now, on your application class include and instantiate the controller.";

    return true;
}

bool buildApplicationImplementation(const QString &filename, const QString &appName)<commit_msg>Add ifdef for utime<commit_after>
#include <QCoreApplication>
#include <QCommandLineParser>

#include <QLocale>
#include <QTranslator>
#include <QLibraryInfo>
#include <QDebug>

#include <QRegularExpression>
#include <QStringBuilder>
#include <QDir>

#include <ostream>

#ifdef Q_OS_UNIX
#include <utime.h>
#endif

#include "uwsgiprocess.h"

#define OUT_EXISTS  "  exists"
#define OUT_CREATED " created"

bool buildControllerHeader(const QString &filename, const QString &controllerName, bool helpers);
bool buildControllerImplementation(const QString &filename, const QString &controllerName, bool helpers);

bool createController(const QString &controllerName)
{
    if (controllerName.contains(QRegularExpression(QStringLiteral("\\W"))) || controllerName.contains(QRegularExpression(QStringLiteral("^\\d")))) {
        qDebug() << "Error: Invalid Controller name.";
        return false;
    }

    QDir projectDir;
    if (!uwsgiProcess::findProjectDir(QDir::current(), &projectDir)) {
        qDebug() << "Error: failed to find project";
        return false;
    }

    if (!buildControllerHeader(projectDir.absoluteFilePath(QStringLiteral("src/")) % controllerName.toLower() % QLatin1String(".h"),
                               controllerName,
                               false)) {
        return false;
    }

    if (!buildControllerImplementation(projectDir.absoluteFilePath(QStringLiteral("src/")) % controllerName.toLower() % QLatin1String(".cpp"),
                                       controllerName,
                                       false)) {
        return false;
    }

#ifdef Q_OS_UNIX
    // Change the modification time of CMakeLists.txt to force FILE_GLOB to be updated
    utime(projectDir.absoluteFilePath(QStringLiteral("CMakeLists.txt")).toLatin1().data(), NULL);
#endif

    qDebug() << "Now, on your application class include and instantiate the controller.";

    return true;
}

bool buildApplicationImplementation(const QString &filename, const QString &appName)
{'fraction_non_alphanumeric': 0.11338901543912934, 'fraction_numerical': 0.0015186028853454822, 'mean_word_length': 3.56878612716763, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2674600', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1060, 'n_words': 260}