All Projects → INotfound → Magic

INotfound / Magic

Licence: LGPL-2.1 License
C++ Rapid development library based on Inversion of Control

Programming Languages

C++
36643 projects - #6 most used programming language
Ragel
52 projects

Projects that are alternatives of or similar to Magic

Qtnetworkng
QtNetwork Next Generation. A coroutine based network framework for Qt/C++, with more simpler API than boost::asio.
Stars: ✭ 125 (+204.88%)
Mutual labels:  openssl, asio
DI-compiler
A Custom Transformer for Typescript that enables compile-time Dependency Injection
Stars: ✭ 62 (+51.22%)
Mutual labels:  ioc, inversion
typeioc
Dependency injection container for typescript / javascript
Stars: ✭ 32 (-21.95%)
Mutual labels:  ioc, inversion
openssl-android-build-scripts
Builds scripts for openSSL 1.0.2h on Android
Stars: ✭ 15 (-63.41%)
Mutual labels:  openssl
landlord
Magic: The Gathering mulligan and card draw simulator
Stars: ✭ 16 (-60.98%)
Mutual labels:  magic
fusion
A simple automated dependency injection library for TypeScript, supporting React class and functional components.
Stars: ✭ 18 (-56.1%)
Mutual labels:  ioc
mtxclient
Client API library for Matrix, built on top of Boost.Asio
Stars: ✭ 21 (-48.78%)
Mutual labels:  asio
vue-ioc
IoC and DI for Vue powered by InversifyJS and inspired by Angular Module syntactic sugar.
Stars: ✭ 39 (-4.88%)
Mutual labels:  ioc
noisi
A tool for modeling and source inversion of auto- and cross-correlations of ambient seismic "noise".
Stars: ✭ 32 (-21.95%)
Mutual labels:  inversion
tsioc
AOP, Ioc container, Boot framework, unit testing framework , activities workflow framework.
Stars: ✭ 15 (-63.41%)
Mutual labels:  ioc
tls-ca-manage
Multi-level Certificate Authority Management tool, front-end tool to OpenSSL, written in bash shell.
Stars: ✭ 19 (-53.66%)
Mutual labels:  openssl
asio-grpc
Asynchronous gRPC with Asio/unified executors
Stars: ✭ 100 (+143.9%)
Mutual labels:  asio
PhoneVR
Use Steam VR-enabled applications with your phone as HMD (Head-mounted display). The only Open-Source solution to similar commercial packages like VRidge, iVRy, Trinus etc etc.
Stars: ✭ 178 (+334.15%)
Mutual labels:  asio
rust-magic
Rust high level bindings crate for the `libmagic` C library
Stars: ✭ 22 (-46.34%)
Mutual labels:  magic
alpha-dic
Powerful dependency injection container for node.js
Stars: ✭ 27 (-34.15%)
Mutual labels:  ioc
ThunderboltIoc
One of the very first IoC frameworks for .Net that has no reflection. An IoC that casts its services before thunder casts its bolts.
Stars: ✭ 40 (-2.44%)
Mutual labels:  ioc
sophos-central-api-connector
Leverage Sophos Central API
Stars: ✭ 17 (-58.54%)
Mutual labels:  ioc
GMOpenSSL
openssl 1.1.1i 的 framework 版本,发布至 cocoapods,方便集成。
Stars: ✭ 32 (-21.95%)
Mutual labels:  openssl
Zenject-2019
Dependency Injection Framework for Unity3D
Stars: ✭ 2,567 (+6160.98%)
Mutual labels:  ioc
boost beast websocket echo
A collection of Demo applications to try to help you understand how Asio and Beast work
Stars: ✭ 12 (-70.73%)
Mutual labels:  asio

Magic

Magic [v2.0.0] 正式发布.

简介

​ Use Standard C++ 11 && CMake.

​ 基于IoC的快速开发库(C++ Rapid development library based on Inversion of Control),配合CMake构建套件开发,支持跨平台开发,并配备了更多的高性能组件.

特点

快速开发

  • 高内聚,低耦合.
  • 超强的通用性以及高度跨平台.
  • 实现模块化开发方式便于协作开发.
  • 基于 IoC (Inversion of Control)的方式对每个类进行托管以及自动注入构建.

模块配置

  • 功能模块可高度重用,方便扩展以及维护.
  • 使用Json格式配置文件(*.magic)对功能进行模块划分.

非侵入式

  • 高度解耦
  • 代码移植度高.
  • 无任何侵入式代码.

安装


只需支持C++11的编译器以及CMake构建工具编译即可, MySql、OpenSSl 编译可选项.

  • Linux
    1. Gnu构建套件 (跳转在库路径中)
    • mkdir build && cd build && cmake ../. && make && make install
    1. Ninja构建套件 (推荐.跳转在库路径中)
    • mkdir build && cd build && cmake -GNinja ../. && ninja && ninja install
  • Win
    • VS 20XX
      • cmake -G "Visual Studio 15 2017" // or Visual Studio xx 20xx

*.magic 模块每次被修改完成时,请调用一次 cmake ../.

使用方法


  1. 使用本库工具 Magic/Bin/Create

  2. 创建项目文件目录名,跳转项目文件目录中

  3. 使用 Create Test /root/Magic 创建项目模板, (Test 项目名) ("/root/Magic" Magic库路径)

  4. 当前目录会生成 CMakeLists.txt Main.cpp Test.magic三个文件

  5. 查看Test项目文件夹中CMakeLists.txt文件.

#Please Add The Directory Path Of The Magic Library.
set(MAGIC /root/Magic)

if(NOT DEFINED MAGIC)
    message(FATAL_ERROR "Please Add The Directory Path Of The Magic Library!!!")
endif()

include_directories(
    ${MAGIC}
	${MAGIC}/Include
    ${PROJECT_SOURCE_DIR}
    ${PROJECT_SOURCE_DIR}/Include
    ${MAGIC}/ThirdParty/Asio/Include
    ${MAGIC}/ThirdParty/RapidJSON/Include
)
link_directories(
    ${MAGIC}/Lib
)
link_libraries(Magic)
include(${MAGIC}/Magic.cmake)

add_custom_target(Gen ALL)
add_custom_command(
    TARGET Gen
    COMMAND ${MAGIC}/Bin/Gen ${MAGIC}/Magic.magic Test
)
  1. 打开Test.magic配置文件,并添加上自定义的类.
{
    "Configurations":{
        "NameSpace":"Test",                 // 同 C++ 的namespace
        "Registered":[                      // 类信息注册(强制,必须要具有一个).
            {
                "Id":"",                    // 类Id标识(任意名).
                "Class":"",                 // 类名,如果有namespace,则需加上即可(XXX::ClassName).
                "Interface":"",             // 继承的接口类,通常需要抽象的时候才使用.
                "IncludePath": "",          // 类所在的文件路径(如何有相同的可以忽略).
                "Dependencies":[],          // 依赖的其他类的类名.
                "FunctionPropertys":[]      // 需要注册的属性函数.
            }
        ],
        "Initialize":[                      // 初始化(非强制)
            {
                "Id":"",                    // 类Id标识应与上方Registered中一致.
                "Loop":false,               // Loop 循环初始化
                "Callee":"",                // 被调用的接口类类型 若Loop == true则该属性必须具有值.
                "CalleeFunctions":[],       // 被调用的函数.
                "InvokeFunctions":{}        // 函数中对应的 RAW Arguments. “XX”:["XXX"]写法.
            }
        ],
        "Constructor":{                     // 构造函数定义
            "Name":"Initialize",            // 暴露给main函数中调用名.
            "WithParameter": false          // 是否需要自定义注册参数.
        }
    }
}
  1. CMake配置文件进行编辑添加Test模块(Test.magic)
add_custom_command(
        TARGET Gen
        COMMAND ${MAGIC}/Bin/Gen ${MAGIC}/Magic.magic ${PROJECT_SOURCE_DIR}/Test.magic Test
)
  1. 跳转build目录中 调用 cmake ../.cmake ../. -Gxxx 并且进行Build.
  2. 打开Main.cpp源文件
#include "Test.h" //添加头文件

int main(){
    Test::Initialize(); //添加初始化代码. [Configurations.NameSpace]::[Constructor.Name]命名设定
    return EXIT_SUCCESS;
}
  1. 编译即可

本库示例


配置文件:Magic模块 (可使用多个配置文件)

{                                                           // 日志以及配置模块示例
    "Configurations":{
        "NameSpace":"Magic",                                // 同C++的namespace.
        "Registered":[                                      // 类信息注册(强制,必须要具有一个).
            {
                "Id":"config",                              // 类Id标识(任意名).
                "Class":"Magic::Config",                    // 类名,如果有namespace,则需加上即可.
                "IncludePath": "Include/Core/Config.h",     // 类所在的文件路径(如何有相同的可以忽略).
                "Interface":"",                             // 继承的接口类,通常需要抽象的时候才使用.
                "Dependencies":[],                          // 依赖的其他类的类名.
                "FunctionPropertys":["addConfigFile"]       // 需要注册的属性函数.
            },
            {
                "Id":"configFile",                          // 与Magic::Config同文件,则不需要在此定义IncludePath
                "Class":"Magic::ConfigFile",
                "FunctionPropertys":["addFormatter"]
            },
            ......
        ],
        "Initialize":[                                      // 初始化(非强制)
            {
                "Id":"logger",
                "Loop":true,                                // Loop 循环加入接口类对象
                "Callee":"Magic::ILogAppender",             // 接口类类型 若Loop == true则该属性必须具有值.
                "CalleeFunctions":["addILogAppender"],      // 接口类对象添加函数.
            }
        ],
        "Constructor":{                                     // 构造函数定义
            "Name":"Initialize",                            // 暴露给main函数中调用名.
            "WithParameter": false                          // 是否需要自定义注册参数.
        }
    }
}

.....

其他

代码规范/联系方式

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].