Latest 0.7.2
Homepage https://github.com/ZFFramework/ZFFramework
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation
Authors

Introduction

welcome to ZFFramework, a cross-platform, lightweight, mid-level application framework in C++

everything here starts with "ZF", which stands for "Zero Framework"

  • it’s not a traditional framework, can be loaded like a dynamic library, plug and play
  • designed to be able to run at any platform that supplies C++03 compatible implementation

Homepage:

Main features

  • minimum requirement
  • powerful reflection, serialzation, styleable logic

    • for how powerful ZFFramework is, you may refer to Feature page
    • automatic lua binding, no extra bind code or config are necessary
    • automatic UI serialization
    • stateful property animation
    • enhanced global event observer
  • fully modularization, "core + protocol + dynamic implementation" design

    support any platform if you are able to supply a native C++ implementation,
    most of implementation can be replaced easily, and implementation is required only if its owner module being used

  • easy to communicate with native code

    even to embed UI elements and native UI elements with each other

  • UI module to write cross-platform UI easily
  • built-in auto scale logic to support multiple screen size

    you have no need to write size-dependent code in both app and implementation

Quick overview

  • this piece of code shows how to show a hello world on UI and log output
    #include "ZFUIWidget.h" // for common UI module
    ZFMAIN_ENTRY(params) // app starts from here
    {
        // show a hello world to log output
        zfLogT() << "hello wolrd";

        // show a window (full screen by default)
        zfblockedAlloc(ZFUIWindow, window);
        window->windowShow();

        // show a hello world as a text view
        zfblockedAlloc(ZFUITextView, textView);
        window->childAdd(textView);
        textView->layoutParam()->layoutAlignSet(ZFUIAlign::e_LeftInner);
        textView->textSet("hello world");

        // button and click (as observer)
        zfblockedAlloc(ZFUIButtonBasic, button);
        window->childAdd(button);
        button->layoutParam()->layoutAlignSet(ZFUIAlign::e_RightInner);
        button->buttonLabelTextSet("click me");
        ZFLISTENER_LOCAL(onClick, {
            ZFUIButtonBasic *button = userData->objectHolded();
            zfLogTrimT() << "button clicked:" << button;
        })
        button->observerAdd(ZFUIButton::EventButtonOnClick(), onClick, button->objectHolder());

        return 0;
    }
  • this piece of code shows equivalent lua code to use ZFFramework,
    all the lua bindings are automatically done by reflection!
    zfLog('hello world')

    local window = ZFUIWindow()
    window:windowShow()

    local textView = zfAlloc('ZFUITextView')
    window:childAdd(textView)
    textView:layoutParam():layoutAlignSet(ZFUIAlign.e_LeftInner())
    textView:textSet('hello wolrd')

    local button = ZFUIButtonBasic.ClassData():newInstance()
    window:childAdd(button)
    button:layoutParam():layoutAlignSet(ZFUIAlign.e_RightInner())
    button:buttonLabelTextSet('click me')
    button:observerAdd(
        ZFUIButton.EventButtonOnClick(),
        function (listenerData, userData)
            zfLog('button clicked: %s', userData:objectHolded())
        end,
        button:objectHolder())
  • and here are screenshot of demo 2048 game built by ZFFramework:

    ZFFramework ZFFramework ZFFramework ZFFramework ZFFramework

Requirement

  • for the core modlue:

    • C++03 compatible compiler (require templates, no boost/RTTI/exceptions required)
    • STL containers (require: map/unordered_map/vector/deque/list), or supply custom wrapper
  • for the implementation module:

    • depends on the actual platform implementation

Current status

  • finished
    • core module (memory management, reflection, serialization)
    • basic UI module (view, window, label, image view, button, layout, scroll view, list view)
    • basic algorithm (xml, json, regexp, md5, base64, crc32, encryption, compression)
    • common platform implementations (iOS, Android, Qt)
    • auto lua binding by reflection
  • working
    • more useful UI modules
    • basic network module
    • basic database module
  • future
    • standalone visual UI editor
    • more IDE / compile env integrations
    • more platform implementations

What we do

  • aiming to be portable and can be ported easily,
    aiming to be lightweighted and able to be embeded easily,
    aiming to use 20% code to do 80% work
  • supply Java-like / ObjectC-like app level APIs to build up small/medium sized app easily

Getting started

  • Download necessary files
  • Setup set up necessary environment for ZFFramework
  • Tutorial quick tutorial to code with ZFFramework
  • FAQ

License

ZFFramework is under MIT license (see here),
feel free to copy or modify or use it

if you like my work, please consider donate:

contact [email protected] (Chinese or English only) before donate, we would really appreciate for your help

Latest podspec

{
    "name": "ZFFramework",
    "version": "0.7.2",
    "summary": "cross-platform C++ app framework",
    "description": "see http://ZFFramework.com for more infonnminimal steps to use in iOS with cocoapods to embed to existing projects:n  1. in your Podfile:n      pod 'ZFFramework'n  2. add cpp files, with this as main entryn      #include "ZFUIKit.h" // ZF module headern      ZFMAIN_ENTRY(params)n      {n          // you cpp coden          return 0;n      }nnrecommended to use https://github.com/ZFFramework/ZFFramework/blob/master/tools/zfproj_creator/zfproj_creator.shnto create project files if you want to deploy to multiple platformsnnpod list:n  pod 'ZFFramework'              // include all modulesn  pod 'ZFFramework/ZF_MODULE_NAME'nfor ZF_MODULE_NAME list, please refer to https://github.com/ZFFramework/ZFFramework/tree/master/ZF",
    "homepage": "https://github.com/ZFFramework/ZFFramework",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ZSaberLv0": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ZFFrameworkDist/ZFFramework.git",
        "tag": "0.7.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "frameworks": "Foundation",
    "libraries": "c++",
    "prepare_command": "sh zfsetup.shnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFAlgorithm.mm ZF/ZFAlgorithm/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFAlgorithm_impl.mm ZF/ZFAlgorithm_impl/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFCore.mm ZF/ZFCore/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFCore_impl.mm ZF/ZFCore_impl/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFLua.mm ZF/ZFLua/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFLua_impl.mm ZF/ZFLua_impl/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFUIKit.mm ZF/ZFUIKit/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFUIKit_impl.mm ZF/ZFUIKit_impl/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFUIWebKit.mm ZF/ZFUIWebKit/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFUIWebKit_impl.mm ZF/ZFUIWebKit_impl/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFUIWidget.mm ZF/ZFUIWidget/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZFUtility.mm ZF/ZFUtility/zfsrcnsh tools/common/unity_build.sh _tmp/cocoapods/zfgensrc_ZF_impl.mm ZF/ZF_impl/zfsrc",
    "xcconfig": {
        "USER_HEADER_SEARCH_PATHS": ""${PODS_ROOT}/Headers/Public/ZFFramework"",
        "OTHER_LDFLAGS": "-ObjC -force_load "${TARGET_BUILD_DIR}/ZFFramework/libZFFramework.a""
    },
    "preserve_paths": "**/*",
    "subspecs": [
        {
            "name": "ZFCore",
            "public_header_files": "ZF/ZFCore/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFCore/zfsrc",
            "source_files": [
                "ZF/ZFCore/zfsrc/**/*.{h,hpp}",
                "ZF/ZFCore/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFCore.mm"
            ],
            "resources": [
                "ZF/ZFCore/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*"
        },
        {
            "name": "ZFAlgorithm",
            "public_header_files": "ZF/ZFAlgorithm/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFAlgorithm/zfsrc",
            "source_files": [
                "ZF/ZFAlgorithm/zfsrc/**/*.{h,hpp}",
                "ZF/ZFAlgorithm/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFAlgorithm.mm"
            ],
            "resources": [
                "ZF/ZFAlgorithm/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": []
            }
        },
        {
            "name": "ZFUtility",
            "public_header_files": "ZF/ZFUtility/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFUtility/zfsrc",
            "source_files": [
                "ZF/ZFUtility/zfsrc/**/*.{h,hpp}",
                "ZF/ZFUtility/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFUtility.mm"
            ],
            "resources": [
                "ZF/ZFUtility/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": []
            }
        },
        {
            "name": "ZFLua",
            "public_header_files": "ZF/ZFLua/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFLua/zfsrc",
            "source_files": [
                "ZF/ZFLua/zfsrc/**/*.{h,hpp}",
                "ZF/ZFLua/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFLua.mm"
            ],
            "resources": [
                "ZF/ZFLua/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": []
            }
        },
        {
            "name": "ZFUIKit",
            "public_header_files": "ZF/ZFUIKit/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFUIKit/zfsrc",
            "source_files": [
                "ZF/ZFUIKit/zfsrc/**/*.{h,hpp}",
                "ZF/ZFUIKit/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFUIKit.mm"
            ],
            "resources": [
                "ZF/ZFUIKit/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZFAlgorithm": [],
                "ZFFramework/ZFUtility": []
            }
        },
        {
            "name": "ZFUIWidget",
            "public_header_files": "ZF/ZFUIWidget/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFUIWidget/zfsrc",
            "source_files": [
                "ZF/ZFUIWidget/zfsrc/**/*.{h,hpp}",
                "ZF/ZFUIWidget/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFUIWidget.mm"
            ],
            "resources": [
                "ZF/ZFUIWidget/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZFAlgorithm": [],
                "ZFFramework/ZFUtility": [],
                "ZFFramework/ZFUIKit": []
            }
        },
        {
            "name": "ZFUIWebKit",
            "public_header_files": "ZF/ZFUIWebKit/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFUIWebKit/zfsrc",
            "source_files": [
                "ZF/ZFUIWebKit/zfsrc/**/*.{h,hpp}",
                "ZF/ZFUIWebKit/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFUIWebKit.mm"
            ],
            "resources": [
                "ZF/ZFUIWebKit/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZFAlgorithm": [],
                "ZFFramework/ZFUtility": [],
                "ZFFramework/ZFUIKit": []
            }
        },
        {
            "name": "ZF_impl",
            "public_header_files": "ZF/ZF_impl/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZF_impl/zfsrc",
            "source_files": [
                "ZF/ZF_impl/zfsrc/**/*.{h,hpp}",
                "ZF/ZF_impl/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZF_impl.mm"
            ],
            "resources": [
                "ZF/ZF_impl/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": []
            }
        },
        {
            "name": "ZFCore_impl",
            "public_header_files": "ZF/ZFCore_impl/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFCore_impl/zfsrc",
            "source_files": [
                "ZF/ZFCore_impl/zfsrc/**/*.{h,hpp}",
                "ZF/ZFCore_impl/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFCore_impl.mm"
            ],
            "resources": [
                "ZF/ZFCore_impl/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZF_impl": []
            }
        },
        {
            "name": "ZFAlgorithm_impl",
            "public_header_files": "ZF/ZFAlgorithm_impl/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFAlgorithm_impl/zfsrc",
            "source_files": [
                "ZF/ZFAlgorithm_impl/zfsrc/**/*.{h,hpp}",
                "ZF/ZFAlgorithm_impl/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFAlgorithm_impl.mm"
            ],
            "resources": [
                "ZF/ZFAlgorithm_impl/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZFAlgorithm": [],
                "ZFFramework/ZF_impl": []
            }
        },
        {
            "name": "ZFLua_impl",
            "public_header_files": "ZF/ZFLua_impl/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFLua_impl/zfsrc",
            "source_files": [
                "ZF/ZFLua_impl/zfsrc/**/*.{h,hpp}",
                "ZF/ZFLua_impl/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFLua_impl.mm"
            ],
            "resources": [
                "ZF/ZFLua_impl/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZFLua": [],
                "ZFFramework/ZF_impl": []
            }
        },
        {
            "name": "ZFUIKit_impl",
            "public_header_files": "ZF/ZFUIKit_impl/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFUIKit_impl/zfsrc",
            "source_files": [
                "ZF/ZFUIKit_impl/zfsrc/**/*.{h,hpp}",
                "ZF/ZFUIKit_impl/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFUIKit_impl.mm"
            ],
            "resources": [
                "ZF/ZFUIKit_impl/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZFAlgorithm": [],
                "ZFFramework/ZFUtility": [],
                "ZFFramework/ZFUIKit": [],
                "ZFFramework/ZF_impl": []
            },
            "frameworks": [
                "Foundation",
                "UIKit",
                "QuartzCore",
                "CoreGraphics"
            ]
        },
        {
            "name": "ZFUIWebKit_impl",
            "public_header_files": "ZF/ZFUIWebKit_impl/zfsrc/**/*.{h,hpp}",
            "header_mappings_dir": "ZF/ZFUIWebKit_impl/zfsrc",
            "source_files": [
                "ZF/ZFUIWebKit_impl/zfsrc/**/*.{h,hpp}",
                "ZF/ZFUIWebKit_impl/zfsrc_ext/**/*.{h,hpp,c,cpp,m,mm}",
                "_tmp/cocoapods/zfgensrc_ZFUIWebKit_impl.mm"
            ],
            "resources": [
                "ZF/ZFUIWebKit_impl/zfres"
            ],
            "exclude_files": "ZF/**/ZF_PUT_RES_FILES_HERE",
            "preserve_paths": "**/*",
            "dependencies": {
                "ZFFramework/ZFCore": [],
                "ZFFramework/ZFAlgorithm": [],
                "ZFFramework/ZFUtility": [],
                "ZFFramework/ZFUIKit": [],
                "ZFFramework/ZFUIWebKit": [],
                "ZFFramework/ZF_impl": []
            },
            "frameworks": [
                "Foundation",
                "UIKit",
                "QuartzCore",
                "CoreGraphics",
                "WebKit"
            ]
        }
    ]
}

Pin It on Pinterest

Share This