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 inline zfstring paramNameFixedAt(ZF_IN zfindex index) const {
400 zfstring ret = this->paramNameAt(index);
401 if(!ret) {
402 ret = zfstr("p%s", index);
403 }
404 return ret;
405 }
417 inline zfindex paramDefaultBeginIndex(void) const {
418 return (_paramDefaultBeginIndex == (zfbyte)-1 ? zfindexMax() : (zfindex)_paramDefaultBeginIndex);
419 }
420
427 void paramInfoT(ZF_IN_OUT zfstring &ret) const;
429 zfstring paramInfo(void) const {
430 zfstring ret;
431 this->paramInfoT(ret);
432 return ret;
433 }
434
453 inline ZFFuncAddrType methodInvoker(void) const {
454 return _methodInvoker;
455 }
456
493 return _methodGenericInvoker;
494 }
495 /* ZFMETHOD_MAX_PARAM */
503 ZF_IN_OPT ZFObject *ownerObjOrNull = zfnull
504 ) const;
507 ZF_IN ZFObject *ownerObjOrNull
508 , ZF_IN ZFObject *param0
509 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
510 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
511 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
512 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
513 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
514 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
515 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
516 ) const;
519 ZF_OUT zfauto &ret
520 , ZF_OUT_OPT zfstring *errorHint
521 , ZF_IN ZFObject *ownerObjOrNull
522 , ZF_IN_OPT ZFObject *param0 = ZFMP_DEF()
523 , ZF_IN_OPT ZFObject *param1 = ZFMP_DEF()
524 , ZF_IN_OPT ZFObject *param2 = ZFMP_DEF()
525 , ZF_IN_OPT ZFObject *param3 = ZFMP_DEF()
526 , ZF_IN_OPT ZFObject *param4 = ZFMP_DEF()
527 , ZF_IN_OPT ZFObject *param5 = ZFMP_DEF()
528 , ZF_IN_OPT ZFObject *param6 = ZFMP_DEF()
529 , ZF_IN_OPT ZFObject *param7 = ZFMP_DEF()
530 ) const;
533 ZF_IN ZFObject *ownerObjOrNull
534 , ZF_IN const ZFCoreArray<zfauto> &params
535 , ZF_OUT_OPT zfbool *success = zfnull
536 , ZF_OUT_OPT zfstring *errorHint = zfnull
537 ) const;
538
541 ZF_IN ZFObject *ownerObjOrNull
542 , ZF_OUT_OPT zfstring *errorHint = zfnull
543 ) const;
544
549
557 inline zfbool preferGenericInvoker(void) const {
558 return ZFBitTest(_stateFlags, _stateFlags_preferGenericInvoker);
559 }
560
561 // ============================================================
562 // class member type
563public:
567 inline const ZFClass *ownerClass(void) const {
568 return _ownerClass;
569 }
570
573 inline const ZFProperty *ownerProperty(void) const {
574 return _ownerProperty;
575 }
576
581 return (ZFMethodAccessType)_methodAccessType;
582 }
583
584 inline zfbool isPublic(void) const {return (ZFMethodAccessType)_methodAccessType == ZFMethodAccessTypePublic;}
586 inline zfbool isProtected(void) const {return (ZFMethodAccessType)_methodAccessType == ZFMethodAccessTypeProtected;}
588 inline zfbool isPrivate(void) const {return (ZFMethodAccessType)_methodAccessType == ZFMethodAccessTypePrivate;}
589
593 inline ZFMethodType methodType(void) const {
594 return (ZFMethodType)_methodType;
595 }
596
597 inline zfbool isNormal(void) const {return (ZFMethodType)_methodType == ZFMethodTypeNormal;}
599 inline zfbool isStatic(void) const {return (ZFMethodType)_methodType == ZFMethodTypeStatic;}
601 inline zfbool isVirtual(void) const {return (ZFMethodType)_methodType == ZFMethodTypeVirtual;}
602
603 // ============================================================
604 // func type
605public:
609 inline zfbool isFuncType(void) const {
610 return (_ownerClass == zfnull);
611 }
612
616 inline const zfstring &methodNamespace(void) const {
617 return _methodNamespace;
618 }
619
620 // ============================================================
621 // other
622public:
631 inline zfbool isInternal(void) const {
632 return ZFBitTest(_stateFlags, _stateFlags_isInternal);
633 }
634
643 inline zfbool isInternalPrivate(void) const {
644 return ZFBitTest(_stateFlags, _stateFlags_isInternalPrivate);
645 }
646
647public:
648 static ZFMethod *_ZFP_ZFMethodRegister(
649 ZF_IN zfbool isUserRegister
650 , ZF_IN zfbool isDynamicRegister
651 , ZF_IN ZFObject *dynamicRegisterUserData
652 , ZF_IN ZFFuncAddrType methodInvoker
653 , ZF_IN ZFMethodGenericInvoker methodGenericInvoker
654 , ZF_IN ZFMethodType methodType
655 , ZF_IN const ZFClass *ownerClass
656 , ZF_IN ZFMethodAccessType methodAccessType
657 , ZF_IN const zfstring &methodNamespace
658 , ZF_IN const zfstring &methodName
659 , ZF_IN const zfstring &returnTypeId
660 , ZF_IN const _ZFP_ZFMethodMP &mp
661 );
662 static void _ZFP_ZFMethodUnregister(ZF_IN const ZFMethod *method);
663
664 ZFMethod *_ZFP_ZFMethod_removeConst(void) const {
665 return const_cast<ZFMethod *>(this);
666 }
667 _ZFP_ZFMethodPrivate *_ZFP_ZFMethod_extInit(void);
668 inline _ZFP_ZFMethodPrivate *_ZFP_ZFMethod_ext(void) const {
669 return _ext;
670 }
671 inline ZFSigName *_ZFP_ZFMethod_paramTypeIdList(void) const {
672 return _paramBuf;
673 }
674 inline ZFSigName *_ZFP_ZFMethod_paramNameList(void) const {
675 return _paramBuf + ZFMETHOD_MAX_PARAM;
676 }
677 void _ZFP_ZFMethod_ownerProperty(ZF_IN const ZFProperty *ownerProperty) const {
678 this->_ZFP_ZFMethod_removeConst()->_ownerProperty = ownerProperty;
679 }
680
681 void _ZFP_ZFMethodImplReplace_invoke(ZF_IN const ZFArgs &zfargs);
682 void _ZFP_ZFMethodImplReplace_attach(ZF_IN const ZFListener &impl);
683 void _ZFP_ZFMethodImplReplace_detach(ZF_IN const ZFListener &impl);
684
685private:
686 enum {
687 _stateFlags_isInternal = 1 << 0,
688 _stateFlags_isInternalPrivate = 1 << 1,
689 _stateFlags_isUserRegister = 1 << 2,
690 _stateFlags_isDynamicRegister = 1 << 3,
691 _stateFlags_preferGenericInvoker = 1 << 4,
692 };
693private:
694 zfuint _refCount;
695 zfuint _stateFlags;
696 ZFObject *_methodUserData;
697 ZFSigName _methodId;
698 _ZFP_ZFMethodPrivate *_ext;
699 ZFFuncAddrType _methodInvoker;
700 ZFMethodGenericInvoker _methodGenericInvoker;
701 ZFSigName _methodName;
702 ZFSigName _returnTypeId;
703 ZFSigName *_paramBuf;
704 ZFListener *_paramDefaultValueCallbackList;
705 zfbyte _paramCount;
706 zfbyte _paramCountMin;
707 zfbyte _paramDefaultBeginIndex;
708
709 // for class member type
710 zfbyte _methodAccessType; // ZFMethodAccessType
711 zfbyte _methodType; // ZFMethodType
712 const ZFClass *_ownerClass;
713 const ZFProperty *_ownerProperty;
714
715 // for func type
716 ZFSigName _methodNamespace;
717};
718
719// ============================================================
720extern ZFLIB_ZFCore void _ZFP_ZFMethodDataHolderInit(void);
721
722zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFMethodRegisterHolder {
723public:
724 _ZFP_ZFMethodRegisterHolder(
725 ZF_IN zfbool isUserRegister
726 , ZF_IN zfbool isDynamicRegister
727 , ZF_IN ZFObject *dynamicRegisterUserData
728 , ZF_IN ZFFuncAddrType methodInvoker
729 , ZF_IN ZFMethodGenericInvoker methodGenericInvoker
730 , ZF_IN ZFMethodType methodType
731 , ZF_IN const ZFClass *ownerClass
732 , ZF_IN ZFMethodAccessType methodAccessType
733 , ZF_IN const zfstring &methodNamespace
734 , ZF_IN const zfstring &methodName
735 , ZF_IN const zfstring &returnTypeId
736 , ZF_IN const _ZFP_ZFMethodMP &mp
737 );
738 ~_ZFP_ZFMethodRegisterHolder(void);
739public:
740 ZFMethod *method;
741};
742
743// ============================================================
759
760// ============================================================
761/* ZFMETHOD_MAX_PARAM */
771 ZF_IN const zfstring &classNameOrNamespace
772 , ZF_IN const zfstring &methodName
773 );
776 ZF_IN const zfstring &classNameOrNamespace
777 , ZF_IN const zfstring &methodName
778 , ZF_IN_OPT const zfchar *paramTypeId0
779 , ZF_IN_OPT const zfchar *paramTypeId1 = zfnull
780 , ZF_IN_OPT const zfchar *paramTypeId2 = zfnull
781 , ZF_IN_OPT const zfchar *paramTypeId3 = zfnull
782 , ZF_IN_OPT const zfchar *paramTypeId4 = zfnull
783 , ZF_IN_OPT const zfchar *paramTypeId5 = zfnull
784 , ZF_IN_OPT const zfchar *paramTypeId6 = zfnull
785 , ZF_IN_OPT const zfchar *paramTypeId7 = zfnull
786 );
787
793 , ZF_IN const zfstring &classNameOrNamespace
794 , ZF_IN const zfstring &methodName
795 );
798 ZF_IN const zfstring &classNameOrNamespace
799 , ZF_IN const zfstring &methodName
800 ) {
802 ZFMethodForNameGetAllT(ret, classNameOrNamespace, methodName);
803 return ret;
804}
805
806// ============================================================
831 ZF_IN const ZFMethod *method
832 , ZF_IN const zfstring &aliasName
833 );
837extern ZFLIB_ZFCore void ZFMethodAliasRemove(ZF_IN const ZFMethod *aliasMethod);
838
839// ============================================================
850 ZF_IN const ZFMethod *method
851 , ZF_IN const ZFListener &impl
852 );
857 ZF_IN const ZFMethod *method
858 , ZF_IN const ZFListener &impl
859 );
860
862#endif // #ifndef _ZFI_ZFMethod_h_
863
#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:208
#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:196
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:200
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:204
#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:212
#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:797
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:754
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:63
light weight array
Definition ZFCoreArray.h:292
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:593
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:453
zfbool isFuncType(void) const
true if this method is function type (declared by ZFMETHOD_FUNC_DECLARE_XXX series)
Definition ZFMethod.h:609
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, may be null if not specified, usually for debug use
Definition ZFMethod.h:395
ZFMethodAccessType methodAccessType(void) const
get the method's access type
Definition ZFMethod.h:580
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:616
zfstring objectInfo(void) const
return object info
Definition ZFMethod.h:293
zfbool preferGenericInvoker(void) const
whether prefer generic invoker when invoke
Definition ZFMethod.h:557
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:631
zfindex paramDefaultBeginIndex(void) const
return the first default param's index, or zfindexMax if no default param
Definition ZFMethod.h:417
zfbool isInternalPrivate(void) const
whether the method is internal private method
Definition ZFMethod.h:643
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:584
zfbool isPrivate(void) const
util to check whether methodAccessType is ZFMethodAccessTypePrivate
Definition ZFMethod.h:588
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:573
zfbool isProtected(void) const
util to check whether methodAccessType is ZFMethodAccessTypeProtected
Definition ZFMethod.h:586
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:567
zfbool paramTypeIdIsMatch(const ZFMethod *method) const
see paramTypeIdIsMatch
zfbool isVirtual(void) const
util to check whether methodType is ZFMethodTypeVirtual
Definition ZFMethod.h:601
zfbool isStatic(void) const
util to check whether methodType is ZFMethodTypeStatic
Definition ZFMethod.h:599
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:492
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:597
zfstring paramInfo(void) const
see paramInfoT
Definition ZFMethod.h:429
zfindex paramCount(void) const
get the method's param num
Definition ZFMethod.h:358
base class of all objects
Definition ZFObjectCore.h:195
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
zfstring zfstr(const zfchar *fmt=zft_zfnull)
string format util
Definition zfstr.h:59