cutelyst 4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
main.cpp
1/*
2 * SPDX-FileCopyrightText: (C) 2016-2017 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#include "config.h"
6#include "server.h"
7
8#include <QCoreApplication>
9#include <QLibraryInfo>
10#include <QLocale>
11#include <QTranslator>
12
13int main(int argc, char *argv[])
14{
15 QCoreApplication::setOrganizationName(QStringLiteral("Cutelyst"));
16 QCoreApplication::setOrganizationDomain(QStringLiteral("cutelyst.org"));
17 QCoreApplication::setApplicationName(QStringLiteral("cutelystd"));
18 QCoreApplication::setApplicationVersion(QStringLiteral(CUTELYST_VERSION));
19
20 Cutelyst::Server server;
21
22 QObject::connect(&server, &Cutelyst::Server::errorOccured, [](const QString &error) {
23 qFatal("Server terminated due to error %s", qPrintable(error));
24 });
25
26 QCoreApplication app(argc, argv);
27
28 QTranslator appTranslator;
29 if (appTranslator.load(QLocale(),
30 QStringLiteral("cutelystserver"),
31 QStringLiteral("."),
32 QStringLiteral(CUTELYST_I18N_DIR))) {
34 }
35
36 server.parseCommandLine(app.arguments());
37
38 // QTranslator qtTranslator;
39 // qtTranslator.load(QLatin1String("qt_") % QLocale::system().name(),
40 // QLibraryInfo::location(QLibraryInfo::TranslationsPath));
41 // QCoreApplication::installTranslator(&qtTranslator);
42
43 return server.exec();
44}
Implements a web server.
Definition server.h:60
void errorOccured(const QString &error)
int exec(Cutelyst::Application *app=nullptr)
Definition server.cpp:676
void parseCommandLine(const QStringList &args)
Definition server.cpp:94
void setApplicationName(const QString &application)
void setApplicationVersion(const QString &version)
bool installTranslator(QTranslator *translationFile)
void setOrganizationDomain(const QString &orgDomain)
void setOrganizationName(const QString &orgName)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool load(const QLocale &locale, const QString &filename, const QString &prefix, const QString &directory, const QString &suffix)