Code Monkey home page Code Monkey logo

qtdependencyresolver's Introduction

QtDependencyResolver

QtDependencyResolver is a simple, ready-to-use library, that provide you ability to make IoC via DIContainer in your solution. DIContainer is based on Qt Meta-Object System and use invoke method to make a constructor injection.

You can bind your interfaces and base classes to a concrete implementation and retrieve instances later.

Usage

To bind your classes you must create a DIContainer instance and use the Bind method:

DIContainer* resolver = new DIContainer();
resolver->Bind<IUsersService, LocalUsersService>();
resolver->Bind<IUsersRepository, MongoDBUsersRepository>();

Then for resolving your interfaces or base classes you must use the Resolve method:

IUserService* userService = resolver->Resolve<IUsersService>();

Note: Only constructors that are declared with the Q_INVOKABLE modifier are made available to be invoked using QMetaObject::invokeMethod() through the meta-object system. For more details look on DIContainerTest.cpp in DependencyResolver-Tests library.

Resources

https://github.com/SPupko/QtDependencyResolver (Git Repository)

https://github.com/SPupko/QtDependencyResolver/issues (Bug Reports)

https://github.com/SPupko/QtDependencyResolver/wiki (Wiki)

qtdependencyresolver's People

Contributors

spupko avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.