diff options
author | valmat <ufabiz@gmail.com> | 2014-04-08 08:53:35 +0600 |
---|---|---|
committer | valmat <ufabiz@gmail.com> | 2014-04-08 08:53:35 +0600 |
commit | 08ed8866a5bba0b23a8d5587116a968512df2568 (patch) | |
tree | f42438c1963982db43e0e232c8e9610ff912fba1 /include/namespace.h | |
parent | 7ca2d3f9e4d584d8990e4e33eb3b531a06dc2474 (diff) |
Ini entries emplemented (issues #64)
Diffstat (limited to 'include/namespace.h')
-rw-r--r-- | include/namespace.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/namespace.h b/include/namespace.h index de73924..5830339 100644 --- a/include/namespace.h +++ b/include/namespace.h @@ -167,6 +167,41 @@ public: return *this; } + + /** + * Add a ini entry to the extension by moving it + * @param ini The class implementation + * @return Namespace Same object to allow chaining + */ + Namespace &add(Ini &&ini) + { + // make a copy of the object + auto *copy = new Ini(std::move(ini)); + + // and add it to the list of classes + _ini_entries.push_back(std::unique_ptr<Ini>(copy)); + + // allow chaining + return *this; + } + + /** + * Add a ini entry to the extension by copying it + * @param ini The class implementation + * @param Namespace Same object to allow chaining + */ + Namespace &add(const Ini &ini) + { + // make a copy of the object + auto *copy = new Ini(std::move(ini)); + + // and add it to the list of classes + _ini_entries.push_back(std::unique_ptr<Ini>(copy)); + + // allow chaining + return *this; + } + protected: /** @@ -192,6 +227,12 @@ protected: * @var list */ std::list<std::shared_ptr<Namespace>> _namespaces; + + /** + * Ini entry defined by the extension + * @var list + */ + std::list<std::shared_ptr<Ini>> _ini_entries; /** * The total number of functions |