Skip to content

Version 1.5.0

Choose a tag to compare

@druhasu druhasu released this 26 Jul 20:24
· 45 commits to master since this release

Summary

  • Added EXPOSE_DEPENDENCIES macro to register InitDependencies signature
  • Added IInjector::CanInject method to check if dependencies may be injected in class

InitDependencies registration

In previous versions you had to register all types in container before you could use them. Most annoying part was registration of types for IInjector usage.

Those issues are now resolved with EXPOSE_DEPENDENCIES macro. You can use it to register the class inside its own cpp file:

#include "MyClass.h"
#include "SomeDependency.h"
#include "DI/ExposeDependencies.h" // new header contains everything you need

EXPOSE_DEPENDENCIES(UMyClass);

void UMyClass::InitDependencies( USomeDependency* InDependency )
{
    // Do something with InDependency
}

After that you can use IInjector to inject dependencies to UMyClass objects. And you can use IInjector::CanInject method to check if InitDependencies signature was registered for given class.