summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-11-26 07:06:20 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2019-11-26 07:06:20 -0500
commit2c2c47c21502db6471fe7d727f942c2400b150c1 (patch)
tree196108eb94119cbd9fd2abac5fc67dddbf37fa01 /src/env.h
parent08bf03854d0688cd8dbbfed7d596888dbedfcb4b (diff)
log new modules being loaded after startup
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/env.h b/src/env.h
index f8b1eb70..946cb13b 100644
--- a/src/env.h
+++ b/src/env.h
@@ -119,6 +119,27 @@ private:
};
+class ModuleNotification
+{
+public:
+ ModuleNotification(std::function<void (Module)> f);
+ ~ModuleNotification();
+
+ ModuleNotification(const ModuleNotification&) = delete;
+ ModuleNotification& operator=(const ModuleNotification&) = delete;
+
+ ModuleNotification(ModuleNotification&&) = default;
+ ModuleNotification& operator=(ModuleNotification&&) = default;
+
+ void setCookie(void* c);
+ void fire(const Module& m);
+
+private:
+ void* m_cookie;
+ std::function<void (Module)> m_f;
+};
+
+
// represents the process's environment
//
class Environment
@@ -151,6 +172,9 @@ public:
//
QString timezone() const;
+ std::unique_ptr<ModuleNotification> onModuleLoaded(
+ std::function<void (Module)> f);
+
// logs the environment
//
void dump(const Settings& s) const;