diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2f4238a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dfmt.braceStyle": "allman" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..1c5c698 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,27 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Dub Build", + "type": "shell", + "command": "dub build", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Dub Test", + "type": "shell", + "command": "dub test", + "problemMatcher": [], + "group": { + "kind": "test", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/source/poodinis/valueinjector/mirage.d b/source/poodinis/valueinjector/mirage.d index 75cc5b0..8242f95 100644 --- a/source/poodinis/valueinjector/mirage.d +++ b/source/poodinis/valueinjector/mirage.d @@ -6,3 +6,65 @@ */ module poodinis.valueinjector.mirage; + +import poodinis : ValueInjector, DependencyContainer; + +class MirageValueInjector(Type) : ValueInjector!Type +{ + public override Type get(string key) + { + throw new Exception("Not yet implemented"); + } +} + +alias MirageBoolValueInjector = MirageValueInjector!bool; +alias MirageByteValueInjector = MirageValueInjector!byte; +alias MirageUbyteValueInjector = MirageValueInjector!ubyte; +alias MirageCharValueInjector = MirageValueInjector!char; +alias MirageShortValueInjector = MirageValueInjector!short; +alias MirageUshortValueInjector = MirageValueInjector!ushort; +alias MirageWcharValueInjector = MirageValueInjector!wchar; +alias MirageIntValueInjector = MirageValueInjector!int; +alias MirageUintValueInjector = MirageValueInjector!uint; +alias MirageDcharValueInjector = MirageValueInjector!dchar; +alias MirageLongValueInjector = MirageValueInjector!long; +alias MirageUlongValueInjector = MirageValueInjector!ulong; +alias MirageFloatValueInjector = MirageValueInjector!float; +alias MirageDoubleValueInjector = MirageValueInjector!double; +alias MirageRealValueInjector = MirageValueInjector!real; +alias MirageStringValueInjector = MirageValueInjector!string; + +/** + * Registers Mirage Config value injectors for all primitive types. + * Params: + * container = Dependency container to register injectors with. + */ +public void registerMirageInjectors(shared(DependencyContainer) container) +{ + container.register!(ValueInjector!bool, MirageBoolValueInjector); + container.register!(ValueInjector!byte, MirageByteValueInjector); + container.register!(ValueInjector!ubyte, MirageUbyteValueInjector); + container.register!(ValueInjector!char, MirageCharValueInjector); + container.register!(ValueInjector!short, MirageShortValueInjector); + container.register!(ValueInjector!ushort, MirageUshortValueInjector); + container.register!(ValueInjector!wchar, MirageWcharValueInjector); + container.register!(ValueInjector!int, MirageIntValueInjector); + container.register!(ValueInjector!uint, MirageUintValueInjector); + container.register!(ValueInjector!dchar, MirageDcharValueInjector); + container.register!(ValueInjector!long, MirageLongValueInjector); + container.register!(ValueInjector!ulong, MirageUlongValueInjector); + container.register!(ValueInjector!float, MirageFloatValueInjector); + container.register!(ValueInjector!double, MirageDoubleValueInjector); + container.register!(ValueInjector!real, MirageRealValueInjector); + container.register!(ValueInjector!string, MirageStringValueInjector); +} + +version (unittest) +{ + @("Register primitive value injectors") + unittest + { + auto dependencies = new shared DependencyContainer; + dependencies.registerMirageInjectors; + } +}