ZFFramework
 
Loading...
Searching...
No Matches
ZFMethod.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFMethod_h_
7#define _ZFI_ZFMethod_h_
8
12
13// ============================================================
22
23#define ZFTOKEN_ZFMethodAccessTypePublic "public"
25#define ZFTOKEN_ZFMethodAccessTypeProtected "protected"
27#define ZFTOKEN_ZFMethodAccessTypePrivate "private"
28
29// ============================================================
30#define _ZFP_ZFMethodType_ZFMethodTypeNormal()
31#define _ZFP_ZFMethodType_ZFMethodTypeStatic() static
32#define _ZFP_ZFMethodType_ZFMethodTypeVirtual() virtual
33#define _ZFP_ZFMethodType(ZFMethodType_) _ZFP_ZFMethodType_##ZFMethodType_()
34
35#define _ZFP_ZFMethodTypeChain_ZFMethodTypeNormal(...) __VA_ARGS__
36#define _ZFP_ZFMethodTypeChain_ZFMethodTypeStatic(...)
37#define _ZFP_ZFMethodTypeChain_ZFMethodTypeVirtual(...) __VA_ARGS__
38#define _ZFP_ZFMethodTypeChain(ZFMethodType_, ...) _ZFP_ZFMethodTypeChain_##ZFMethodType_(__VA_ARGS__)
39
48
49#define ZFTOKEN_ZFMethodTypeNormal ""
51#define ZFTOKEN_ZFMethodTypeStatic "static"
53#define ZFTOKEN_ZFMethodTypeVirtual "virtual"
54
55// ============================================================
58#define _ZFP_ZFMETHOD_INVOKER(N) \
59 \
60 template<typename T_ReturnType ZFM_REPEAT(N, ZFM_REPEAT_TEMPLATE, ZFM_COMMA, ZFM_COMMA)> \
61 inline T_ReturnType executeExact(ZFObject *obj ZFM_REPEAT(N, ZFM_REPEAT_PARAM, ZFM_COMMA, ZFM_COMMA)) const { \
62 if(this->methodInvoker()) { \
63 return reinterpret_cast< \
64 T_ReturnType (*)(const ZFMethod *, zfany const & ZFM_REPEAT(N, ZFM_REPEAT_PARAM, ZFM_COMMA, ZFM_COMMA)) \
65 >(this->methodInvoker()) \
66 (this, obj ZFM_REPEAT(N, ZFM_REPEAT_NAME, ZFM_COMMA, ZFM_COMMA)); \
67 } \
68 else { \
69 return _ZFP_MtdGII<T_ReturnType ZFM_REPEAT(N, ZFM_REPEAT_TYPE, ZFM_COMMA, ZFM_COMMA)>(\
70 this, obj ZFM_REPEAT(N, ZFM_REPEAT_NAME, ZFM_COMMA, ZFM_COMMA) \
71 ); \
72 } \
73 } \
74 /* this would save much binary size by removing support of dynamic method forwarding, for internal impl use only, use with caution */ \
75 template<typename T_ReturnType ZFM_REPEAT(N, ZFM_REPEAT_TEMPLATE, ZFM_COMMA, ZFM_COMMA)> \
76 inline T_ReturnType _ZFP_execute(ZFObject *obj ZFM_REPEAT(N, ZFM_REPEAT_PARAM, ZFM_COMMA, ZFM_COMMA)) const { \
77 return reinterpret_cast< \
78 T_ReturnType (*)(const ZFMethod *, zfany const & ZFM_REPEAT(N, ZFM_REPEAT_PARAM, ZFM_COMMA, ZFM_COMMA)) \
79 >(this->methodInvoker()) \
80 (this, obj ZFM_REPEAT(N, ZFM_REPEAT_NAME, ZFM_COMMA, ZFM_COMMA)); \
81 }
82
83// ============================================================
84#define _ZFP_ZFMethodNoDefaultParam ZFM_EMPTY
85#define _ZFP_ZFMethodDefaultParam(DefaultValue) \
86 = (DefaultValue) ZFM_EMPTY
87
88// tricks to solve recursive macro
89#define _ZFP_MtdM_EMPTY(...)
90#define _ZFP_MtdM_EXPAND(...) __VA_ARGS__
91#define _ZFP_MtdP_EXPAND(...) __VA_ARGS__
92#define _ZFP_MtdD_EXPAND(...) __VA_ARGS__
105#define ZFMP_IN(ParamType, paramName) \
106 _ZFP_MtdM_EXPAND, ParamType, paramName, _ZFP_MtdM_EMPTY, _ZFP_ZFMethodNoDefaultParam
107
108#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue) \
109 _ZFP_MtdM_EXPAND, ParamType, paramName, _ZFP_MtdM_EXPAND, _ZFP_ZFMethodDefaultParam(DefaultValue)
110
111#define ZFMP_OUT(ParamType, paramName) \
112 _ZFP_MtdM_EXPAND, ParamType, paramName, _ZFP_MtdM_EMPTY, _ZFP_ZFMethodNoDefaultParam
113
114#define ZFMP_OUT_OPT(ParamType, paramName, DefaultValue) \
115 _ZFP_MtdM_EXPAND, ParamType, paramName, _ZFP_MtdM_EXPAND, _ZFP_ZFMethodDefaultParam(DefaultValue)
116
117#define ZFMP_IN_OUT(ParamType, paramName) \
118 _ZFP_MtdM_EXPAND, ParamType, paramName, _ZFP_MtdM_EMPTY, _ZFP_ZFMethodNoDefaultParam
119
120#define ZFMP_IN_OUT_OPT(ParamType, paramName, DefaultValue) \
121 _ZFP_MtdM_EXPAND, ParamType, paramName, _ZFP_MtdM_EXPAND, _ZFP_ZFMethodDefaultParam(DefaultValue)
122
123#define _ZFP_ZFMP_DUMMY() \
124 _ZFP_MtdM_EMPTY, ParamType, paramName, _ZFP_MtdM_EMPTY, _ZFP_ZFMethodNoDefaultParam
125
126// ============================================================
128extern ZFLIB_ZFCore const ZFListener &_ZFP_ZFMethod_paramDefaultValueCallbackDummy(void);
129zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFMethodMP {
130public:
131 zfuint paramCount;
132 ZFSigName paramTypeId[ZFMETHOD_MAX_PARAM];
133 ZFSigName paramName[ZFMETHOD_MAX_PARAM];
134 ZFListener *paramDefaultValueCallback[ZFMETHOD_MAX_PARAM];
135public:
136 _ZFP_ZFMethodMP &add(
137 ZF_IN const zfstring &paramTypeId
138 , ZF_IN const zfstring &paramName
139 , ZF_IN const ZFListener &paramDefaultValueCallback
140 );
141public:
142 _ZFP_ZFMethodMP(void) : paramCount(0) {
143 }
144 ~_ZFP_ZFMethodMP(void);
145private:
146 _ZFP_ZFMethodMP(ZF_IN const _ZFP_ZFMethodMP &ref);
147};
148
149// ============================================================
150zfclassFwd _ZFP_ZFMethodPrivateExt;
254
255public:
256 void _ZFP_ZFMethod_init(
260 , ZF_IN ZFFuncAddrType invoker
263 , ZF_IN const zfstring &methodName
265 , ZF_IN const _ZFP_ZFMethodMP &mp
266 );
267 void _ZFP_ZFMethod_initClassMemberType(
269 , ZF_IN ZFMethodAccessType accessType
270 );
271 void _ZFP_ZFMethod_initFuncType(ZF_IN const zfstring &methodNamespace);
273 ZFMethod(void);
275 ~ZFMethod(void);
276
277public:
278 _ZFP_ZFMETHOD_INVOKER(0)
279 _ZFP_ZFMETHOD_INVOKER(1)
280 _ZFP_ZFMETHOD_INVOKER(2)
281 _ZFP_ZFMETHOD_INVOKER(3)
282 _ZFP_ZFMETHOD_INVOKER(4)
283 _ZFP_ZFMETHOD_INVOKER(5)
284 _ZFP_ZFMETHOD_INVOKER(6)
285 _ZFP_ZFMETHOD_INVOKER(7)
286 _ZFP_ZFMETHOD_INVOKER(8)
287 /* ZFMETHOD_MAX_PARAM */
288
289public:
293 zfstring objectInfo(void) const {
294 zfstring ret;
295 this->objectInfoT(ret);
296 return ret;
297 }
298
299 // ============================================================
300 // general
301public:
303 const ZFMethod *aliasFrom(void) const;
306
310 inline zfidentity methodId(void) const {
311 return this->_ZFP_ZFMethod_methodId.sigId();
312 }
313
316 inline zfbool isUserRegister(void) const {
317 return this->_ZFP_ZFMethod_isUserRegister;
318 }
319
322 inline zfany userRegisterUserData(void) const {
323 return this->_ZFP_ZFMethod_isUserRegister ? this->_ZFP_ZFMethod_methodUserData : zfnull;
324 }
325
328 void userRegisterUserData(ZF_IN ZFObject *userData) const;
332 inline zfbool isDynamicRegister(void) const {
333 return this->_ZFP_ZFMethod_isDynamicRegister;
334 }
335
338 inline zfany dynamicRegisterUserData(void) const {
339 return this->_ZFP_ZFMethod_isDynamicRegister ? this->_ZFP_ZFMethod_methodUserData : zfnull;
340 }
341
344 inline const zfstring &methodName(void) const {
345 return this->_ZFP_ZFMethod_methodName;
346 }
347
351 inline const zfstring &returnTypeId(void) const {
352 return this->_ZFP_ZFMethod_returnTypeId;
353 }
354
358 inline zfindex paramCount(void) const {
359 return (zfindex)this->_ZFP_ZFMethod_paramCount;
360 }
361
365 inline zfindex paramCountMin(void) const {
366 return (zfindex)this->_ZFP_ZFMethod_paramCountMin;
367 }
368
372 ZF_IN_OPT const zfchar *paramTypeId0 = zfnull
373 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
374 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
375 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
376 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
377 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
378 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
379 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
380 ) const;
384 zfbool paramTypeIdIsMatch(ZF_IN const ZFMethod *method) const;
388 inline const zfstring &paramTypeIdAt(ZF_IN zfindex index) const {
389 ZFCoreAssert(index < this->paramCount());
390 return this->_ZFP_ZFMethod_paramTypeIdList()[index];
391 }
392
395 inline const zfstring &paramNameAt(ZF_IN zfindex index) const {
396 ZFCoreAssert(index < this->paramCount());
397 return this->_ZFP_ZFMethod_paramNameList()[index];
398 }
399
410 inline zfindex paramDefaultBeginIndex(void) const {
411 return (this->_ZFP_ZFMethod_paramDefaultBeginIndex == (zfuint)-1 ? zfindexMax() : (zfindex)this->_ZFP_ZFMethod_paramDefaultBeginIndex);
412 }
413
420 void paramInfoT(ZF_IN_OUT zfstring &ret) const;
422 zfstring paramInfo(void) const {
423 zfstring ret;
424 this->paramInfoT(ret);
425 return ret;
426 }
427
446 inline ZFFuncAddrType methodInvoker(void) const {
447 return this->_ZFP_ZFMethod_invoker;
448 }
449
482
519 return this->_ZFP_ZFMethod_methodGenericInvoker;
520 }
521 /* ZFMETHOD_MAX_PARAM */
529 ZF_IN_OPT ZFObject *ownerObjOrNull = zfnull
530 ) const;
533 ZF_IN ZFObject *ownerObjOrNull
534 , ZF_IN ZFObject *param0
535 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
536 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
537 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
538 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
539 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
540 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
541 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
542 ) const;
545 ZF_OUT zfauto &ret
546 , ZF_OUT_OPT zfstring *errorHint
547 , ZF_IN ZFObject *ownerObjOrNull
548 , ZF_IN_OPT ZFObject *param0 = ZFMP_DEF()
549 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
550 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
551 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
552 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
553 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
554 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
555 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
556 ) const;
559 ZF_IN ZFObject *ownerObjOrNull
560 , ZF_IN const ZFCoreArray<zfauto> &params
561 , ZF_OUT_OPT zfbool *success = zfnull
562 , ZF_OUT_OPT zfstring *errorHint = zfnull
563 ) const;
564
567 ZF_IN ZFObject *ownerObjOrNull
568 , ZF_OUT_OPT zfstring *errorHint = zfnull
569 ) const;
570
575
582
583 // ============================================================
584 // class member type
585public:
589 inline const ZFClass *ownerClass(void) const {
590 return this->_ZFP_ZFMethod_ownerClass;
591 }
592
595 inline const ZFProperty *ownerProperty(void) const {
596 return this->_ZFP_ZFMethod_ownerProperty;
597 }
598
603 return (ZFMethodAccessType)this->_ZFP_ZFMethod_accessType;
604 }
605
606 inline zfbool isPublic(void) const {return (ZFMethodAccessType)this->_ZFP_ZFMethod_accessType == ZFMethodAccessTypePublic;}
608 inline zfbool isProtected(void) const {return (ZFMethodAccessType)this->_ZFP_ZFMethod_accessType == ZFMethodAccessTypeProtected;}
610 inline zfbool isPrivate(void) const {return (ZFMethodAccessType)this->_ZFP_ZFMethod_accessType == ZFMethodAccessTypePrivate;}
611
615 inline ZFMethodType methodType(void) const {
616 return (ZFMethodType)this->_ZFP_ZFMethod_methodType;
617 }
618
619 inline zfbool isNormal(void) const {return (ZFMethodType)this->_ZFP_ZFMethod_methodType == ZFMethodTypeNormal;}
621 inline zfbool isStatic(void) const {return (ZFMethodType)this->_ZFP_ZFMethod_methodType == ZFMethodTypeStatic;}
623 inline zfbool isVirtual(void) const {return (ZFMethodType)this->_ZFP_ZFMethod_methodType == ZFMethodTypeVirtual;}
624
625 // ============================================================
626 // func type
627public:
631 inline zfbool isFuncType(void) const {
632 return (this->_ZFP_ZFMethod_ownerClass == zfnull);
633 }
634
638 inline const zfstring &methodNamespace(void) const {
639 return this->_ZFP_ZFMethod_methodNamespace;
640 }
641
642 // ============================================================
643 // other
644public:
653 inline zfbool isInternal(void) const {
654 return this->_ZFP_ZFMethod_isInternal;
655 }
656
665 inline zfbool isInternalPrivate(void) const {
666 return this->_ZFP_ZFMethod_isInternalPrivate;
667 }
668
669public:
670 ZFMethod *_ZFP_ZFMethod_removeConst(void) const {
671 return const_cast<ZFMethod *>(this);
672 }
673
674public:
675 inline ZFSigName *_ZFP_ZFMethod_paramTypeIdList(void) const {
676 return _ZFP_ZFMethod_paramBuf;
677 }
678 inline ZFSigName *_ZFP_ZFMethod_paramNameList(void) const {
679 return _ZFP_ZFMethod_paramBuf + ZFMETHOD_MAX_PARAM;
680 }
681
682public:
683 // general
684 zfuint _ZFP_ZFMethod_refCount;
685
686 zfbool _ZFP_ZFMethod_isInternal;
687 zfbool _ZFP_ZFMethod_isInternalPrivate;
688 zfbool _ZFP_ZFMethod_isUserRegister;
689 zfbool _ZFP_ZFMethod_isDynamicRegister;
690 zfany _ZFP_ZFMethod_methodUserData;
691
692 ZFSigName _ZFP_ZFMethod_methodId;
693 _ZFP_ZFMethodPrivateExt *_ZFP_ZFMethod_ext;
694
695 ZFFuncAddrType _ZFP_ZFMethod_invoker;
696 ZFMethodGenericInvoker _ZFP_ZFMethod_methodGenericInvoker;
697 ZFSigName _ZFP_ZFMethod_methodName;
698 ZFSigName _ZFP_ZFMethod_returnTypeId;
699 zfuint _ZFP_ZFMethod_paramCount;
700 zfuint _ZFP_ZFMethod_paramCountMin;
701 ZFSigName *_ZFP_ZFMethod_paramBuf;
702 ZFListener *_ZFP_ZFMethod_paramDefaultValueCallbackList;
703 zfuint _ZFP_ZFMethod_paramDefaultBeginIndex;
704
705 // for class member type
706 unsigned short /* ZFMethodAccessType */ _ZFP_ZFMethod_accessType;
707 unsigned short /* ZFMethodType */ _ZFP_ZFMethod_methodType;
708 const ZFClass *_ZFP_ZFMethod_ownerClass;
709 const ZFProperty *_ZFP_ZFMethod_ownerProperty;
710
711 // for func type
712 ZFSigName _ZFP_ZFMethod_methodNamespace;
713};
714
715// ============================================================
716extern ZFLIB_ZFCore void _ZFP_ZFMethodDataHolderInit(void);
717extern ZFLIB_ZFCore ZFMethod *_ZFP_ZFMethodRegister(
718 ZF_IN zfbool isUserRegister
719 , ZF_IN zfbool isDynamicRegister
720 , ZF_IN ZFObject *dynamicRegisterUserData
721 , ZF_IN ZFFuncAddrType methodInvoker
722 , ZF_IN ZFMethodGenericInvoker methodGenericInvoker
723 , ZF_IN ZFMethodType methodType
724 , ZF_IN const ZFClass *ownerClass
725 , ZF_IN ZFMethodAccessType methodAccessType
726 , ZF_IN const zfstring &methodNamespace
727 , ZF_IN const zfstring &methodName
728 , ZF_IN const zfstring &returnTypeId
729 , ZF_IN const _ZFP_ZFMethodMP &mp
730 );
731extern ZFLIB_ZFCore void _ZFP_ZFMethodUnregister(ZF_IN const ZFMethod *method);
732
733zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFMethodRegisterHolder {
734public:
735 _ZFP_ZFMethodRegisterHolder(
736 ZF_IN zfbool isUserRegister
737 , ZF_IN zfbool isDynamicRegister
738 , ZF_IN ZFObject *dynamicRegisterUserData
739 , ZF_IN ZFFuncAddrType methodInvoker
740 , ZF_IN ZFMethodGenericInvoker methodGenericInvoker
741 , ZF_IN ZFMethodType methodType
742 , ZF_IN const ZFClass *ownerClass
743 , ZF_IN ZFMethodAccessType methodAccessType
744 , ZF_IN const zfstring &methodNamespace
745 , ZF_IN const zfstring &methodName
746 , ZF_IN const zfstring &returnTypeId
747 , ZF_IN const _ZFP_ZFMethodMP &mp
748 );
749 ~_ZFP_ZFMethodRegisterHolder(void);
750public:
751 ZFMethod *method;
752};
753
754// ============================================================
770
771// ============================================================
772/* ZFMETHOD_MAX_PARAM */
782 ZF_IN const zfstring &classNameOrNamespace
783 , ZF_IN const zfstring &methodName
784 );
787 ZF_IN const zfstring &classNameOrNamespace
788 , ZF_IN const zfstring &methodName
789 , ZF_IN_OPT const zfchar *paramTypeId0
790 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
791 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
792 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
793 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
794 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
795 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
796 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
797 );
798
804 , ZF_IN const zfstring &classNameOrNamespace
805 , ZF_IN const zfstring &methodName
806 );
809 ZF_IN const zfstring &classNameOrNamespace
810 , ZF_IN const zfstring &methodName
811 ) {
813 ZFMethodForNameGetAllT(ret, classNameOrNamespace, methodName);
814 return ret;
815}
816
817// ============================================================
842 ZF_IN const ZFMethod *method
843 , ZF_IN const zfstring &aliasName
844 );
848extern ZFLIB_ZFCore void ZFMethodAliasRemove(ZF_IN const ZFMethod *aliasMethod);
849
851#endif // #ifndef _ZFI_ZFMethod_h_
852
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define ZFCoreAssert(exp)
assert exp is zftrue
Definition ZFCoreLog_CommonLog.h:47
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:192
#define zffinal
dummy macro shows that a method or class is designed must not to be overrided
Definition ZFCoreTypeDef_ClassType.h:63
#define zfclassLikePOD
shows the class is not a POD type, but you may use it like a POD except memset it to 0
Definition ZFCoreTypeDef_ClassType.h:41
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
#define zfclassNotPOD
shows the class is not a POD type, you should not memset it or declare it in stack or copy value by c...
Definition ZFCoreTypeDef_ClassType.h:48
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define ZFCLASS_DISALLOW_COPY_CONSTRUCTOR(ClassName)
a macro to show that a class doesn't allow copy constructor
Definition ZFCoreTypeDef_ClassType.h:81
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
_ZFT_t_zfuint zfuint
same as unsigned int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:169
void(* ZFFuncAddrType)(void)
dummy function address type
Definition ZFCoreTypeDef_OtherType.h:277
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
void ZFMethodForNameGetAllT(ZFCoreArray< const ZFMethod * > &ret, const zfstring &classNameOrNamespace, const zfstring &methodName)
util method to find method, see ZFMethodForName
ZFMethodType
the method type
Definition ZFMethod.h:43
@ ZFMethodTypeVirtual
virtual method
Definition ZFMethod.h:46
@ ZFMethodTypeStatic
static method
Definition ZFMethod.h:45
@ ZFMethodTypeNormal
normal method
Definition ZFMethod.h:44
ZFCoreArray< const ZFMethod * > ZFMethodForNameGetAll(const zfstring &classNameOrNamespace, const zfstring &methodName)
see ZFMethodForNameGetAllT
Definition ZFMethod.h:808
void ZFMethodAliasRemove(const ZFMethod *aliasMethod)
see ZFMethodAlias
void ZFMethodGetAllT(ZFCoreArray< const ZFMethod * > &ret)
see ZFMethodGetAll
const ZFMethod * ZFMethodForName(const zfstring &classNameOrNamespace, const zfstring &methodName)
util method to find method
ZFCoreArray< const ZFMethod * > ZFMethodGetAll(void)
get all method currently registered
Definition ZFMethod.h:765
const ZFMethod * ZFMethodAlias(const ZFMethod *method, const zfstring &aliasName)
create new ZFMethod and alias to existing method
ZFMethodAccessType
access type for ZFMethod
Definition ZFMethod.h:17
@ ZFMethodAccessTypePublic
public
Definition ZFMethod.h:18
@ ZFMethodAccessTypeProtected
protected
Definition ZFMethod.h:19
@ ZFMethodAccessTypePrivate
private
Definition ZFMethod.h:20
generic invoker declare for ZFMethod::methodGenericInvoker
void(* ZFMethodGenericInvoker)(const ZFArgs &zfargs)
generic invoker for advanced reflection, see ZFMethod::methodGenericInvoker
Definition ZFMethodGenericInvoker.h:24
#define ZFMP_DEF()
mark the object as default param
Definition ZFMethodGenericInvoker.h:30
#define ZFMETHOD_MAX_PARAM
max param supported by ZFMethod
Definition ZFMethodGenericInvoker.h:16
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
types for ZFFramework
ZFObject's class info.
Definition ZFClass.h:67
light weight array
Definition ZFCoreArray.h:331
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
reflectable method for ZFObject
Definition ZFMethod.h:252
ZFMethodType methodType(void) const
method type
Definition ZFMethod.h:615
const ZFListener & paramDefaultValueCallbackAt(zfindex index) const
get the method param's default value access callback
ZFFuncAddrType methodInvoker(void) const
invoker function address for both class member type and function type
Definition ZFMethod.h:446
zfbool isFuncType(void) const
true if this method is function type (declared by ZFMETHOD_FUNC_DECLARE_XXX series)
Definition ZFMethod.h:631
zfauto methodInvoke(ZFObject *ownerObjOrNull=zft_zfnull) const
util method to invoke ZFMethodGenericInvoker
zfbool methodInvokeCheck(ZFObject *ownerObjOrNull, zfstring *errorHint=zft_zfnull) const
check whether this method can be invoke with specified object
const zfstring & paramNameAt(zfindex index) const
get the method's param name at index, usually for debug use
Definition ZFMethod.h:395
ZFMethodAccessType methodAccessType(void) const
get the method's access type
Definition ZFMethod.h:602
void paramInfoT(zfstring &ret) const
util to return param info
zfauto methodInvokeDetail(ZFObject *ownerObjOrNull, const ZFCoreArray< zfauto > &params, zfbool *success=zft_zfnull, zfstring *errorHint=zft_zfnull) const
see methodInvoke
zfany dynamicRegisterUserData(void) const
see ZFMethodDynamicRegister
Definition ZFMethod.h:338
const zfstring & methodName(void) const
get the method's name
Definition ZFMethod.h:344
const zfstring & methodNamespace(void) const
get the method namespace, for func type only, null or empty string for global scope (ZF_NAMESPACE_GLO...
Definition ZFMethod.h:638
zfstring objectInfo(void) const
return object info
Definition ZFMethod.h:293
zfindex paramCountMin(void) const
get the method's minimum param num, same as paramCount if no default param
Definition ZFMethod.h:365
void objectInfoT(zfstring &ret) const
see objectInfo
ZFFuncAddrType methodInvokerOrig(void) const
see methodInvoker
void methodInvoker(ZFFuncAddrType methodInvoker) const
override original methodInvoker
zfbool isInternal(void) const
whether the method is internal method
Definition ZFMethod.h:653
zfindex paramDefaultBeginIndex(void) const
return the first default param's index, or zfindexMax if no default param
Definition ZFMethod.h:410
zfbool isInternalPrivate(void) const
whether the method is internal private method
Definition ZFMethod.h:665
void userRegisterUserData(ZFObject *userData) const
store impl state for ZFMethodUserRegister_0
zfbool isPublic(void) const
util to check whether methodAccessType is ZFMethodAccessTypePublic
Definition ZFMethod.h:606
zfbool isPrivate(void) const
util to check whether methodAccessType is ZFMethodAccessTypePrivate
Definition ZFMethod.h:610
const zfstring & paramTypeIdAt(zfindex index) const
get the method's param type id at index
Definition ZFMethod.h:388
const ZFProperty * ownerProperty(void) const
method's owner proeprty, null if none
Definition ZFMethod.h:595
zfbool isProtected(void) const
util to check whether methodAccessType is ZFMethodAccessTypeProtected
Definition ZFMethod.h:608
zfbool methodInvokeT(zfauto &ret, zfstring *errorHint, ZFObject *ownerObjOrNull, ZFObject *param0=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param1=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param2=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param3=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param4=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param5=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param6=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param7=((ZFObject *const &) _ZFP_ZFMP_DEF)) const
see methodInvoke
const ZFMethod * aliasFrom(void) const
see ZFMethodAlias
ZFMethodGenericInvoker methodGenericInvokerOrig(void) const
see methodGenericInvoker
const ZFCoreArray< const ZFMethod * > & aliasTo(void) const
see ZFMethodAlias
zfany userRegisterUserData(void) const
store impl state for ZFMethodUserRegister_0
Definition ZFMethod.h:322
zfbool isDynamicRegister(void) const
whether the method is registered by ZFMethodDynamicRegister
Definition ZFMethod.h:332
zfauto methodInvoke(ZFObject *ownerObjOrNull, ZFObject *param0, ZFObject *param1=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param2=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param3=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param4=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param5=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param6=((ZFObject *const &) _ZFP_ZFMP_DEF), ZFObject *param7=((ZFObject *const &) _ZFP_ZFMP_DEF)) const
see methodInvoke
zfbool paramTypeIdIsMatch(const zfchar *paramTypeId0=zft_zfnull, const zfchar *paramTypeId1=zft_zfnull, const zfchar *paramTypeId2=zft_zfnull, const zfchar *paramTypeId3=zft_zfnull, const zfchar *paramTypeId4=zft_zfnull, const zfchar *paramTypeId5=zft_zfnull, const zfchar *paramTypeId6=zft_zfnull, const zfchar *paramTypeId7=zft_zfnull) const
check whether method param type id matches
void methodGenericInvoker(ZFMethodGenericInvoker methodGenericInvoker) const
change default impl for methodGenericInvoker
const ZFClass * ownerClass(void) const
method's owner class, null for function type method
Definition ZFMethod.h:589
zfbool paramTypeIdIsMatch(const ZFMethod *method) const
see paramTypeIdIsMatch
zfbool isVirtual(void) const
util to check whether methodType is ZFMethodTypeVirtual
Definition ZFMethod.h:623
zfbool isStatic(void) const
util to check whether methodType is ZFMethodTypeStatic
Definition ZFMethod.h:621
zfbool isUserRegister(void) const
whether the method is registered by ZFMethodUserRegister_0
Definition ZFMethod.h:316
zfauto paramDefaultValueAt(zfindex index) const
get the method's param default value at index, null if no default param
zfidentity methodId(void) const
internal method id, for debug use only
Definition ZFMethod.h:310
ZFMethodGenericInvoker methodGenericInvoker(void) const
generic invoker for advanced reflection
Definition ZFMethod.h:518
const zfstring & returnTypeId(void) const
get the method's return value's type id
Definition ZFMethod.h:351
zfbool isNormal(void) const
util to check whether methodType is ZFMethodTypeNormal
Definition ZFMethod.h:619
zfstring paramInfo(void) const
see paramInfoT
Definition ZFMethod.h:422
zfindex paramCount(void) const
get the method's param num
Definition ZFMethod.h:358
base class of all objects
Definition ZFObjectCore.h:209
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:28
readonly string container for internal use only
Definition ZFSigName.h:17
util method to cast ZFObject types freely
Definition zfany.h:35
a ZFObject holder which would release content object automatically when destroyed
Definition zfautoFwd.h:34