Changeset 179
- Timestamp:
- 11/12/08 21:22:06 (4 years ago)
- Files:
-
- dconstructor/trunk/dconstructor/build.d (modified) (2 diffs)
- dconstructor/trunk/dconstructor/object_builder.d (modified) (1 diff)
- dconstructor/trunk/examples/bind.d (added)
- dconstructor/trunk/examples/dsss.conf (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dconstructor/trunk/dconstructor/build.d
r148 r179 60 60 static assert (is (TImpl : TVisible), "binding failure: cannot convert type " ~ TImpl.stringof ~ " to type " ~ TVisible.stringof); 61 61 // again, only possible b/c no inheritance for structs 62 wrap (TVisible.classinfo, new DelegatingBuilder!(TBuilder, TVisible, TImpl)()); 63 return this; 62 wrap (TVisible.classinfo, new DelegatingBuilder!(TBuilder, TVisible, TImpl)(singleton!(TImpl))); 63 return this; 64 } 65 66 private bool singleton(T)() 67 { 68 if (is (T : Singleton)) return true; 69 if (is (T : Instance)) return false; 70 return _defaultSingleton; 64 71 } 65 72 … … 69 76 { 70 77 static assert (is (T == class), "Currently, only classes can be registered for creation. Tried to register " ~ T.stringof); 71 if ( (_defaultSingleton || is (T : Singleton)) && !is (T : Instance))78 if (singleton!(T)) 72 79 { 73 80 wrap (T.classinfo, new SingletonBuilder!(TBuilder, T)()); dconstructor/trunk/dconstructor/object_builder.d
r148 r179 115 115 class DelegatingBuilder (TBuilder, T, TImpl): AbstractBuilder!(TBuilder, T) 116 116 { 117 private ObjectBuilder!(TBuilder, TImpl) _builder;117 private AbstractBuilder!(TBuilder, TImpl) _builder; 118 118 119 this ( )119 this (bool singleton) 120 120 { 121 _builder = new typeof(_builder)(); 121 if (singleton) 122 { 123 _builder = new SingletonBuilder!(TBuilder, TImpl)(); 124 } 125 else 126 { 127 _builder = new ObjectBuilder!(TBuilder, TImpl)(); 128 } 122 129 } 123 130 dconstructor/trunk/examples/dsss.conf
r133 r179 1 1 [interception.d] 2 [bind.d] 2 3 [simple.d] 3 4 [mkspeed.d]
