You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
878 B
42 lines
878 B
3 days ago
|
#ifndef HTTPMANAGER_H
|
||
|
#define HTTPMANAGER_H
|
||
|
|
||
|
#include "Controller/Controller.h"
|
||
|
#include "Singleton.h"
|
||
|
#include <QMap>
|
||
|
#include <QSharedPointer>
|
||
|
|
||
|
using ControllerFunc = std::function<Controller *()>;
|
||
|
|
||
|
class HttpManager : public Singleton<HttpManager>
|
||
|
{
|
||
|
private:
|
||
|
QMap<QString, QSharedPointer<Controller>> _controllers;
|
||
|
|
||
|
QMap<QString, ControllerFunc> _ctrlFuncs;
|
||
|
|
||
|
public:
|
||
|
HttpManager();
|
||
|
|
||
|
/**
|
||
|
* @brief getControllers 获取控制器
|
||
|
* @return 控制器
|
||
|
*/
|
||
|
QMap<QString, QSharedPointer<Controller>> getControllers();
|
||
|
|
||
|
/**
|
||
|
* @brief registerCtl 注册控制器
|
||
|
* @param path uri路径
|
||
|
* @param fun function 注册函数
|
||
|
*/
|
||
|
void registerCtl(const QString &path, const ControllerFunc &fun);
|
||
|
|
||
|
private:
|
||
|
/**
|
||
|
* @brief _createController 创建控制器
|
||
|
*/
|
||
|
void _createController();
|
||
|
};
|
||
|
|
||
|
#endif // HTTPMANAGER_H
|