Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/httq/include/httq/AbstractServer.h
T
2026-09-01 12:27:57 +02:00

47 lines
919 B
C++

#pragma once
#include "httq_export.h"
#include <QtNetwork/QHostAddress>
#include <QtCore/QObject>
class QTcpServer;
#ifdef QT6_WEBSOCKETS_AVAILABLE
class QWebSocketServer;
#endif
namespace httq
{
class HttpRequest;
class LoggerFactory;
class Logger;
class HTTQ_EXPORT AbstractServer : public QObject
{
Q_OBJECT
public:
explicit AbstractServer(QObject* parent = nullptr);
virtual bool newHttpConnection(HttpRequest* request) = 0;
#ifdef QT6_WEBSOCKETS_AVAILABLE
virtual QWebSocketServer* webSocketServer() const
{
return nullptr;
}
#endif
virtual LoggerFactory* createLoggerFactory();
LoggerFactory* getLoggerFactory();
bool listen(qint16 port, const QHostAddress& host = QHostAddress::Any);
private slots:
void slotNewConnection();
private:
QTcpServer* mSvr;
LoggerFactory* mLoggerFactory{nullptr};
Logger* mLogger;
};
} // namespace httq