summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/plugin-support.h
blob: 838569227d06cd439dfdc3292625ae0d9892adda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once

#include "facetracknoir/plugin-api.hpp"

#include <QWidget>
#include <QDebug>
#include <QString>
#include <QLibrary>
#include <QFrame>

#include <memory>
template<typename t> using ptr = std::shared_ptr<t>;

extern "C" typedef void* (*CTOR_FUNPTR)(void);
extern "C" typedef Metadata* (*METADATA_FUNPTR)(void);

class DynamicLibrary {
public:
    DynamicLibrary(const QString& filename);
    ~DynamicLibrary();
    CTOR_FUNPTR Dialog;
    CTOR_FUNPTR Constructor;
    METADATA_FUNPTR Metadata;
    QString filename;
private:
#if defined(_WIN32)
    QLibrary* handle;
#else
    void* handle;
#endif
};

struct SelectedLibraries {
    using dylib = ptr<DynamicLibrary>;

    ptr<ITracker> pTracker;
    ptr<IFilter> pFilter;
    ptr<IProtocol> pProtocol;
    SelectedLibraries(QFrame* frame, dylib t, dylib p, dylib f);
    SelectedLibraries() : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) {}
    ~SelectedLibraries();
    bool correct;
};