reload: encapsulate each engine generation more

This commit is contained in:
outfoxxed 2024-03-13 22:53:05 -07:00
parent 211f454de9
commit 1687ff3614
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
7 changed files with 125 additions and 79 deletions

View file

@ -21,15 +21,10 @@ public:
class SingletonRegistry {
public:
SingletonRegistry() = default;
~SingletonRegistry();
Q_DISABLE_COPY_MOVE(SingletonRegistry);
void install(const QUrl& url, Singleton* singleton);
void flip();
static SingletonRegistry* instance();
void registerSingleton(const QUrl& url, Singleton* singleton);
void onReload(SingletonRegistry* old);
private:
QMap<QUrl, QObject*>* previousRegistry = nullptr;
QMap<QUrl, QObject*>* currentRegistry = nullptr;
QMap<QUrl, Singleton*> registry;
};