diff options
author | Torsten Paul <Torsten.Paul@gmx.de> | 2014-01-02 21:41:21 (GMT) |
---|---|---|
committer | Torsten Paul <Torsten.Paul@gmx.de> | 2014-01-02 22:28:02 (GMT) |
commit | 7f3659907358f57e912f76291f8c9500b3032fbd (patch) | |
tree | aba281f10d0ef87ae55feaaf8cb6246b1fdc5102 /src/module.h | |
parent | 72865e17dae7f51c60e0db54c1aa070f8125f273 (diff) |
Integrate feature registry with modules.
In case a module is attached to a disabled feature, the module lookup
will give a warning message and ignore that (builtin) module.
Diffstat (limited to 'src/module.h')
-rw-r--r-- | src/module.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/module.h b/src/module.h index 8414706..81e5f10 100644 --- a/src/module.h +++ b/src/module.h @@ -13,6 +13,7 @@ #include "value.h" #include "typedefs.h" #include "localscope.h" +#include "feature.h" class ModuleInstantiation { @@ -60,8 +61,13 @@ public: class AbstractModule { +private: + const Feature *feature; public: + AbstractModule() : feature(NULL) {} + AbstractModule(const Feature& feature) : feature(&feature) {} virtual ~AbstractModule(); + virtual bool is_enabled() const { return (feature == NULL) || feature->is_enabled(); }; virtual class AbstractNode *instantiate(const Context *ctx, const ModuleInstantiation *inst, const class EvalContext *evalctx = NULL) const; virtual std::string dump(const std::string &indent, const std::string &name) const; }; @@ -70,6 +76,7 @@ class Module : public AbstractModule { public: Module() { } + Module(const Feature& feature) : AbstractModule(feature) { } virtual ~Module(); virtual AbstractNode *instantiate(const Context *ctx, const ModuleInstantiation *inst, const EvalContext *evalctx = NULL) const; |