Textractor_test/GUI/extensions.h

33 lines
728 B
C
Raw Normal View History

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"
#include <shared_mutex>
2018-07-27 13:42:21 +08:00
2018-07-30 05:36:45 +08:00
struct InfoForExtension
{
const char* name;
int64_t value;
InfoForExtension* next;
~InfoForExtension() { if (next) delete next; };
};
class Extension
{
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();
QString name;
wchar_t* (*callback)(const wchar_t*, const InfoForExtension*);
private:
inline static std::shared_mutex extenMutex;
inline static QVector<Extension> extensions;
};
2018-07-27 13:42:21 +08:00
#endif // EXTENSIONS_H