diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-08 19:22:52 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-08 19:22:52 +0200 |
| commit | cc4c62ab5d809ff451ca475a7949adc4fdfd806b (patch) | |
| tree | 3b39b3eeffbadbc930941e37c1ef3b5026339da3 /src/Instantiator.cs | |
| parent | 4d4a9116ea5c68b27f0b7c43db9682ab57738ae7 (diff) | |
IMLInstantiator implementation
Diffstat (limited to 'src/Instantiator.cs')
| -rw-r--r-- | src/Instantiator.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Instantiator.cs b/src/Instantiator.cs new file mode 100644 index 00000000..e54e744e --- /dev/null +++ b/src/Instantiator.cs @@ -0,0 +1,41 @@ +// +// Instantiator.cs +// +// Author: +// Jean-Philippe Bruyère <jp.bruyere@hotmail.com> +// +// Copyright (c) 2016 jp +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +using System; + +namespace Crow +{ + public class Instantiator + { + Type RootType; + Interface.LoaderInvoker Loader; + public Instantiator (Type _root, Interface.LoaderInvoker loader) + { + RootType = _root; + Loader = loader; + } + public GraphicObject CreateInstance(){ + GraphicObject tmp = (GraphicObject)Activator.CreateInstance(RootType); + Loader (tmp); + return tmp; + } + } +} + |