ZFFramework
 
Loading...
Searching...
No Matches
ZFMainEntry.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFMainEntry_h_
7#define _ZFI_ZFMainEntry_h_
8
9#include "ZFObject.h"
11
12// ============================================================
38#define ZFMAIN_ENTRY() \
39 static void _ZFMain(void); \
40 ZF_STATIC_REGISTER_INIT(ZFMainEntryRegister) { \
41 ZFCoreAssertWithMessageTrim(_ZFP_ZFMainFunc() == zfnull, "ZFMAIN_ENTRY already registered"); \
42 _ZFP_ZFMainFunc() = _ZFMain; \
43 } \
44 ZF_STATIC_REGISTER_END(ZFMainEntryRegister) \
45 static void _ZFMain(void)
46
59#define ZFMAIN_PARAM_DISPATCH(regSig) \
60 static void _ZFP_MPD_##regSig(ZF_IN const ZFArgs &zfargs); \
61 ZF_GLOBAL_INITIALIZER_INIT(MPD_##regSig) { \
62 ZFGlobalObserver().observerAdd(ZFApp::E_AppParamDispatch(), ZFCallbackForFunc(_ZFP_MPD_##regSig)); \
63 } \
64 ZF_GLOBAL_INITIALIZER_DESTROY(MPD_##regSig) { \
65 ZFGlobalObserver().observerRemove(ZFApp::E_AppParamDispatch(), ZFCallbackForFunc(_ZFP_MPD_##regSig)); \
66 } \
67 ZF_GLOBAL_INITIALIZER_END(MPD_##regSig) \
68 static void _ZFP_MPD_##regSig(ZF_IN const ZFArgs &zfargs)
69
70// ============================================================
72
73
79ZFEVENT_GLOBAL(ZFLIB_ZFCore, AppParamDispatch)
80
87
94
97 , ZFMP_IN(zfint, exitCode)
98 )
101
103
104// ============================================================
105typedef void (*_ZFP_ZFMainFuncType)(void);
106extern ZFLIB_ZFCore _ZFP_ZFMainFuncType &_ZFP_ZFMainFunc(void);
107extern ZFLIB_ZFCore ZFCoreArray<zfstring> &_ZFP_ZFApp_appParams(void);
108extern ZFLIB_ZFCore zfint &_ZFP_ZFApp_appExitCode(void);
109
111#endif // #ifndef _ZFI_ZFMainEntry_h_
112
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
_ZFT_t_zfint zfint
same as int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:165
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_FUNC_DECLARE_0(ZFLIB_, ReturnType, MethodName)
declare function type of ZFMethod
Definition ZFMethodFuncDeclare.h:493
#define ZFMETHOD_FUNC_DECLARE_1(ZFLIB_, ReturnType, MethodName, ZFMP_0)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:624
#define ZF_NAMESPACE_BEGIN_REGISTER(NameSpace, ParentNameSpace)
begin and register namespace
Definition ZFNamespace.h:48
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_END(NameSpace)
end namespace
Definition ZFNamespace.h:60
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZF_NAMESPACE_GLOBAL
namespace of ZFFramework
Definition ZFNamespace.h:96
ZFObject related include.
#define ZFEVENT_GLOBAL(ZFLIB_, YourEvent)
declare a observer event in global scope, see ZFEVENT
Definition ZFObjectObserver.h:369
light weight array
Definition ZFCoreArray.h:331
Definition ZFApp.h:30
void appExitCode(zfint exitCode)
exit code for app, 0 by default
const ZFCoreArray< zfstring > & appParams()
get the app params