Rename Startup class to YACReaderHttpServer

This commit is contained in:
Luis Ángel San Martín
2022-10-13 23:24:35 +02:00
parent 59639ad68c
commit be0c0ff341
9 changed files with 44 additions and 54 deletions

View File

@ -10,8 +10,8 @@ DEPENDPATH += $$PWD/controllers/v2
HEADERS += \
$$PWD/static.h \
$$PWD/startup.h \
$$PWD/requestmapper.h \
$$PWD/yacreader_http_server.h \
$$PWD/yacreader_http_session.h \
$$PWD/yacreader_http_session_store.h \
$$PWD/yacreader_server_data_helper.h \
@ -52,8 +52,8 @@ HEADERS += \
SOURCES += \
$$PWD/static.cpp \
$$PWD/startup.cpp \
$$PWD/requestmapper.cpp \
$$PWD/yacreader_http_server.cpp \
$$PWD/yacreader_http_session.cpp \
$$PWD/yacreader_http_session_store.cpp \
$$PWD/yacreader_server_data_helper.cpp \

View File

@ -1,38 +0,0 @@
/**
@file
@author Stefan Frings
*/
#ifndef STARTUP_H
#define STARTUP_H
#include <QString>
namespace stefanfrings {
class HttpListener;
}
/**
Helper class to install and run the application as a windows
service.
*/
class Startup
{
private:
// QTcpServer
stefanfrings::HttpListener *listener;
public:
/** Constructor */
Startup();
/** Start the server */
void start(quint16 port = 0);
/** Stop the server */
void stop();
QString getPort();
protected:
};
#endif // STARTUP_H

View File

@ -4,7 +4,7 @@
*/
#include "static.h"
#include "startup.h"
#include "yacreader_http_server.h"
//#include "dualfilelogger.h"
#include "httplistener.h"
#include "requestmapper.h"
@ -32,7 +32,7 @@ using stefanfrings::HttpSessionStore;
using stefanfrings::StaticFileController;
using stefanfrings::TemplateCache;
void Startup::start(quint16 port)
void YACReaderHttpServer::start(quint16 port)
{
// Initialize the core application
QCoreApplication *app = QCoreApplication::instance();
@ -146,7 +146,7 @@ void Startup::start(quint16 port)
}
}
void Startup::stop()
void YACReaderHttpServer::stop()
{
qDebug("ServiceHelper: Service has been stopped");
// QCoreApplication destroys all objects that have been created in start().
@ -157,12 +157,12 @@ void Startup::stop()
}
}
Startup::Startup()
YACReaderHttpServer::YACReaderHttpServer()
: listener(nullptr)
{
}
QString Startup::getPort()
QString YACReaderHttpServer::getPort()
{
return QString("%1").arg(listener->serverPort());
}

View File

@ -0,0 +1,26 @@
#ifndef YACREADER_HTTP_SERVER_H
#define YACREADER_HTTP_SERVER_H
#include <QString>
namespace stefanfrings {
class HttpListener;
}
class YACReaderHttpServer
{
private:
stefanfrings::HttpListener *listener;
public:
YACReaderHttpServer();
void start(quint16 port = 0);
void stop();
QString getPort();
protected:
};
#endif // YACREADER_HTTP_SERVER_H