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->preferGenericInvoker()) { \
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_mGII<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_mM_EMPTY(...) // for ZFMP
90#define _ZFP_mM_EXPAND(...) __VA_ARGS__ // for ZFMP
91#define _ZFP_mP_EXPAND(...) __VA_ARGS__ // for param expand
92#define _ZFP_mD_EXPAND(...) __VA_ARGS__ // for method declare expand
105#define ZFMP_IN(ParamType, paramName) \
106 _ZFP_mM_EXPAND, ParamType, paramName, _ZFP_mM_EMPTY, _ZFP_ZFMethodNoDefaultParam
107
108#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue) \
109 _ZFP_mM_EXPAND, ParamType, paramName, _ZFP_mM_EXPAND, _ZFP_ZFMethodDefaultParam(DefaultValue)
110
111#define ZFMP_OUT(ParamType, paramName) \
112 _ZFP_mM_EXPAND, ParamType, paramName, _ZFP_mM_EMPTY, _ZFP_ZFMethodNoDefaultParam
113
114#define ZFMP_OUT_OPT(ParamType, paramName, DefaultValue) \
115 _ZFP_mM_EXPAND, ParamType, paramName, _ZFP_mM_EXPAND, _ZFP_ZFMethodDefaultParam(DefaultValue)
116
117#define ZFMP_IN_OUT(ParamType, paramName) \
118 _ZFP_mM_EXPAND, ParamType, paramName, _ZFP_mM_EMPTY, _ZFP_ZFMethodNoDefaultParam
119
120#define ZFMP_IN_OUT_OPT(ParamType, paramName, DefaultValue) \
121 _ZFP_mM_EXPAND, ParamType, paramName, _ZFP_mM_EXPAND, _ZFP_ZFMethodDefaultParam(DefaultValue)
122
123#define _ZFP_ZFMP_DUMMY() \
124 _ZFP_mM_EMPTY, ParamType, paramName, _ZFP_mM_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_ZFMethodPrivate;
254
255public:
256 void _ZFP_ZFMethod_init(
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 _methodId.sigId();
312 }
313
316 inline zfbool isUserRegister(void) const {
317 return ZFBitTest(_stateFlags, _stateFlags_isUserRegister);
318 }
319
322 inline zfany userRegisterUserData(void) const {
323 return this->isUserRegister() ? _methodUserData : zfnull;
324 }
325
328 void userRegisterUserData(ZF_IN ZFObject *userData) const;
332 inline zfbool isDynamicRegister(void) const {
333 return ZFBitTest(_stateFlags, _stateFlags_isDynamicRegister);
334 }
335
338 inline zfany dynamicRegisterUserData(void) const {
339 return this->isDynamicRegister() ? _methodUserData : zfnull;
340 }
341
344 inline const zfstring &methodName(void) const {
345 return _methodName;
346 }
347
351 inline const zfstring &returnTypeId(void) const {
352 return _returnTypeId;
353 }
354
358 inline zfindex paramCount(void) const {
359 return (zfindex)_paramCount;
360 }
361
365 inline zfindex paramCountMin(void) const {
366 return (zfindex)_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 (_paramDefaultBeginIndex == (zfbyte)-1 ? zfindexMax() : (zfindex)_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 _methodInvoker;
448 }
449
486 return _methodGenericInvoker;
487 }
488 /* ZFMETHOD_MAX_PARAM */
496 ZF_IN_OPT ZFObject *ownerObjOrNull = zfnull
497 ) const;
500 ZF_IN ZFObject *ownerObjOrNull
501 , ZF_IN ZFObject *param0
502 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
503 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
504 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
505 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
506 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
507 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
508 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
509 ) const;
512 ZF_OUT zfauto &ret
513 , ZF_OUT_OPT zfstring *errorHint
514 , ZF_IN ZFObject *ownerObjOrNull
515 , ZF_IN_OPT ZFObject *param0 = ZFMP_DEF()
516 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
517 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
518 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
519 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
520 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
521 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
522 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
523 ) const;
526 ZF_IN ZFObject *ownerObjOrNull
527 , ZF_IN const ZFCoreArray<zfauto> &params
528 , ZF_OUT_OPT zfbool *success = zfnull
529 , ZF_OUT_OPT zfstring *errorHint = zfnull
530 ) const;
531
534 ZF_IN ZFObject *ownerObjOrNull
535 , ZF_OUT_OPT zfstring *errorHint = zfnull
536 ) const;
537
542
550 inline zfbool preferGenericInvoker(void) const {
551 return ZFBitTest(_stateFlags, _stateFlags_preferGenericInvoker);
552 }
553
554 // ============================================================
555 // class member type
556public:
560 inline const ZFClass *ownerClass(void) const {
561 return _ownerClass;
562 }
563
566 inline const ZFProperty *ownerProperty(void) const {
567 return _ownerProperty;
568 }
569
574 return (ZFMethodAccessType)_methodAccessType;
575 }
576
577 inline zfbool isPublic(void) const {return (ZFMethodAccessType)_methodAccessType == ZFMethodAccessTypePublic;}
579 inline zfbool isProtected(void) const {return (ZFMethodAccessType)_methodAccessType == ZFMethodAccessTypeProtected;}
581 inline zfbool isPrivate(void) const {return (ZFMethodAccessType)_methodAccessType == ZFMethodAccessTypePrivate;}
582
586 inline ZFMethodType methodType(void) const {
587 return (ZFMethodType)_methodType;
588 }
589
590 inline zfbool isNormal(void) const {return (ZFMethodType)_methodType == ZFMethodTypeNormal;}
592 inline zfbool isStatic(void) const {return (ZFMethodType)_methodType == ZFMethodTypeStatic;}
594 inline zfbool isVirtual(void) const {return (ZFMethodType)_methodType == ZFMethodTypeVirtual;}
595
596 // ============================================================
597 // func type
598public:
602 inline zfbool isFuncType(void) const {
603 return (_ownerClass == zfnull);
604 }
605
609 inline const zfstring &methodNamespace(void) const {
610 return _methodNamespace;
611 }
612
613 // ============================================================
614 // other
615public:
624 inline zfbool isInternal(void) const {
625 return ZFBitTest(_stateFlags, _stateFlags_isInternal);
626 }
627
636 inline zfbool isInternalPrivate(void) const {
637 return ZFBitTest(_stateFlags, _stateFlags_isInternalPrivate);
638 }
639
640public:
641 static ZFMethod *_ZFP_ZFMethodRegister(
642 ZF_IN zfbool isUserRegister
643 , ZF_IN zfbool isDynamicRegister
644 , ZF_IN ZFObject *dynamicRegisterUserData
645 , ZF_IN ZFFuncAddrType methodInvoker
646 , ZF_IN ZFMethodGenericInvoker methodGenericInvoker
647 , ZF_IN ZFMethodType methodType
648 , ZF_IN const ZFClass *ownerClass
649 , ZF_IN ZFMethodAccessType methodAccessType
650 , ZF_IN const zfstring &methodNamespace
651 , ZF_IN const zfstring &methodName
652 , ZF_IN const zfstring &returnTypeId
653 , ZF_IN const _ZFP_ZFMethodMP &mp
654 );
655 static void _ZFP_ZFMethodUnregister(ZF_IN const ZFMethod *method);
656
657 ZFMethod *_ZFP_ZFMethod_removeConst(void) const {
658 return const_cast<ZFMethod *>(this);
659 }
660 _ZFP_ZFMethodPrivate *_ZFP_ZFMethod_extInit(void);
661 inline _ZFP_ZFMethodPrivate *_ZFP_ZFMethod_ext(void) const {
662 return _ext;
663 }
664 inline ZFSigName *_ZFP_ZFMethod_paramTypeIdList(void) const {
665 return _paramBuf;
666 }
667 inline ZFSigName *_ZFP_ZFMethod_paramNameList(void) const {
668 return _paramBuf + ZFMETHOD_MAX_PARAM;
669 }
670 void _ZFP_ZFMethod_ownerProperty(ZF_IN const ZFProperty *ownerProperty) const {
671 this->_ZFP_ZFMethod_removeConst()->_ownerProperty = ownerProperty;
672 }
673
674 void _ZFP_ZFMethodImplReplace_invoke(ZF_IN const ZFArgs &zfargs);
675 void _ZFP_ZFMethodImplReplace_attach(ZF_IN const ZFListener &impl);
676 void _ZFP_ZFMethodImplReplace_detach(ZF_IN const ZFListener &impl);
677
678private:
679 enum {
680 _stateFlags_isInternal = 1 << 0,
681 _stateFlags_isInternalPrivate = 1 << 1,
682 _stateFlags_isUserRegister = 1 << 2,
683 _stateFlags_isDynamicRegister = 1 << 3,
684 _stateFlags_preferGenericInvoker = 1 << 4,
685 };
686private:
687 zfuint _refCount;
688 zfuint _stateFlags;
689 ZFObject *_methodUserData;
690 ZFSigName _methodId;
691 _ZFP_ZFMethodPrivate *_ext;
692 ZFFuncAddrType _methodInvoker;
693 ZFMethodGenericInvoker _methodGenericInvoker;
694 ZFSigName _methodName;
695 ZFSigName _returnTypeId;
696 ZFSigName *_paramBuf;
697 ZFListener *_paramDefaultValueCallbackList;
698 zfbyte _paramCount;
699 zfbyte _paramCountMin;
700 zfbyte _paramDefaultBeginIndex;
701
702 // for class member type
703 zfbyte _methodAccessType; // ZFMethodAccessType
704 zfbyte _methodType; // ZFMethodType
705 const ZFClass *_ownerClass;
706 const ZFProperty *_ownerProperty;
707
708 // for func type
709 ZFSigName _methodNamespace;
710};
711
712// ============================================================
713extern ZFLIB_ZFCore void _ZFP_ZFMethodDataHolderInit(void);
714
715zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFMethodRegisterHolder {
716public:
717 _ZFP_ZFMethodRegisterHolder(
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 );
731 ~_ZFP_ZFMethodRegisterHolder(void);
732public:
733 ZFMethod *method;
734};
735
736// ============================================================
752
753// ============================================================
754/* ZFMETHOD_MAX_PARAM */
764 ZF_IN const zfstring &classNameOrNamespace
765 , ZF_IN const zfstring &methodName
766 );
769 ZF_IN const zfstring &classNameOrNamespace
770 , ZF_IN const zfstring &methodName
771 , ZF_IN_OPT const zfchar *paramTypeId0
772 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
773 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
774 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
775 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
776 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
777 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
778 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
779 );
780
786 , ZF_IN const zfstring &classNameOrNamespace
787 , ZF_IN const zfstring &methodName
788 );
791 ZF_IN const zfstring &classNameOrNamespace
792 , ZF_IN const zfstring &methodName
793 ) {
795 ZFMethodForNameGetAllT(ret, classNameOrNamespace, methodName);
796 return ret;
797}
798
799// ============================================================
824 ZF_IN const ZFMethod *method
825 , ZF_IN const zfstring &aliasName
826 );
830extern ZFLIB_ZFCore void ZFMethodAliasRemove(ZF_IN const ZFMethod *aliasMethod);
831
832// ============================================================
843 ZF_IN const ZFMethod *method
844 , ZF_IN const ZFListener &impl
845 );
850 ZF_IN const ZFMethod *method
851 , ZF_IN const ZFListener &impl
852 );
853
855#endif // #ifndef _ZFI_ZFMethod_h_
856
#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:196
#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:184
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:188
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:192
#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:200
#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_zfbyte zfbyte
8-bit unsigned value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:194
_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
#define ZFBitTest(var, bit)
macro to detect whether bit is set, zftrue if any one of test bit has set
Definition ZFCoreUtilMacro.h:16
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
void ZFMethodImplRestore(const ZFMethod *method, const ZFListener &impl)
see ZFMethodImplReplace
ZFCoreArray< const ZFMethod * > ZFMethodForNameGetAll(const zfstring &classNameOrNamespace, const zfstring &methodName)
see ZFMethodForNameGetAllT
Definition ZFMethod.h:790
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:747
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
ZFListener ZFMethodImplReplace(const ZFMethod *method, const ZFListener &impl)
dynamically replace impl for method
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
listener data used by ZFListener
Definition ZFArgs.h:20
ZFObject's class info.
Definition ZFClass.h:66
light weight array
Definition ZFCoreArray.h:344
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:586
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:602
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:573
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:609
zfstring objectInfo(void) const
return object info
Definition ZFMethod.h:293
zfbool preferGenericInvoker(void) const
whether prefer generic invoker when invoke
Definition ZFMethod.h:550
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
zfbool isInternal(void) const
whether the method is internal method
Definition ZFMethod.h:624
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:636
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:577
zfbool isPrivate(void) const
util to check whether methodAccessType is ZFMethodAccessTypePrivate
Definition ZFMethod.h:581
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:566
zfbool isProtected(void) const
util to check whether methodAccessType is ZFMethodAccessTypeProtected
Definition ZFMethod.h:579
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 ZFMethodImplReplace
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
const ZFClass * ownerClass(void) const
method's owner class, null for function type method
Definition ZFMethod.h:560
zfbool paramTypeIdIsMatch(const ZFMethod *method) const
see paramTypeIdIsMatch
zfbool isVirtual(void) const
util to check whether methodType is ZFMethodTypeVirtual
Definition ZFMethod.h:594
zfbool isStatic(void) const
util to check whether methodType is ZFMethodTypeStatic
Definition ZFMethod.h:592
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:485
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:590
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:196
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:27
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