Older/WebApplication/WebApplication.h

40 lines
920 B
C
Raw Normal View History

2024-10-30 23:59:59 +08:00
#ifndef __WEBAPPLICATION_H__
#define __WEBAPPLICATION_H__
2024-11-11 19:21:48 +08:00
#include "Singleton.h"
2024-11-14 23:06:22 +08:00
#include <memory>
2024-10-30 23:59:59 +08:00
namespace Wt {
class WServer;
2024-11-14 23:06:22 +08:00
class WApplication;
class WEnvironment;
2024-11-07 18:21:04 +08:00
2024-11-11 19:21:48 +08:00
namespace Auth {
class AuthService;
class PasswordService;
} // namespace Auth
2024-11-07 18:21:04 +08:00
}; // namespace Wt
2024-10-30 23:59:59 +08:00
class WebApplication {
2024-11-14 23:06:22 +08:00
friend class Amass::Singleton<WebApplication>;
2024-10-30 23:59:59 +08:00
public:
~WebApplication();
2024-11-11 19:21:48 +08:00
void initializeAuthenticationService();
const Wt::Auth::AuthService &authService();
const Wt::Auth::PasswordService &passwordService();
protected:
2024-11-20 21:10:31 +08:00
WebApplication(uint16_t port, const std::string &documentRoot);
2024-11-14 23:06:22 +08:00
std::unique_ptr<Wt::WApplication> createApplication(const Wt::WEnvironment &env, bool embedded);
2024-11-11 19:21:48 +08:00
2024-10-30 23:59:59 +08:00
private:
std::unique_ptr<Wt::WServer> m_server;
2024-11-11 19:21:48 +08:00
std::unique_ptr<Wt::Auth::AuthService> m_authService;
std::unique_ptr<Wt::Auth::PasswordService> m_passwordService;
2024-10-30 23:59:59 +08:00
};
#endif // __WEBAPPLICATION_H__