2018-07-27 13:42:21 +08:00
|
|
|
#ifndef EXTENSIONS_H
|
|
|
|
#define EXTENSIONS_H
|
|
|
|
|
2018-08-23 00:24:55 +08:00
|
|
|
#include "qtcommon.h"
|
2018-10-28 14:27:24 +08:00
|
|
|
#include <shared_mutex>
|
2018-07-27 13:42:21 +08:00
|
|
|
|
2018-07-30 05:36:45 +08:00
|
|
|
struct InfoForExtension
|
|
|
|
{
|
2018-10-10 19:03:15 +08:00
|
|
|
const char* name;
|
|
|
|
int64_t value;
|
|
|
|
InfoForExtension* next;
|
|
|
|
~InfoForExtension() { if (next) delete next; };
|
|
|
|
};
|
|
|
|
|
2018-10-28 14:27:24 +08:00
|
|
|
class Extension
|
2018-10-10 19:03:15 +08:00
|
|
|
{
|
2018-10-28 14:27:24 +08:00
|
|
|
public:
|
|
|
|
static bool DispatchSentence(std::wstring& sentence, std::unordered_map<std::string, int64_t> miscInfo);
|
|
|
|
static void Load(QString extenName);
|
|
|
|
static void SendToBack(QString extenName);
|
|
|
|
static void Unload(QString extenName);
|
|
|
|
static QVector<QString> GetNames();
|
|
|
|
|
2018-10-10 19:03:15 +08:00
|
|
|
QString name;
|
2018-10-28 14:27:24 +08:00
|
|
|
wchar_t* (*callback)(const wchar_t*, const InfoForExtension*);
|
2018-10-10 19:03:15 +08:00
|
|
|
|
2018-10-28 14:27:24 +08:00
|
|
|
private:
|
|
|
|
inline static std::shared_mutex extenMutex;
|
|
|
|
inline static QVector<Extension> extensions;
|
|
|
|
};
|
2018-07-27 13:42:21 +08:00
|
|
|
|
|
|
|
#endif // EXTENSIONS_H
|