ZFFramework
Loading...
Searching...
No Matches
Using interface

similar to Interface in Java and protocol in Object-C, ZFFramework has ZFInterface for interface types
to declare a ZFInterface:

};
// in cpp files
ZFOBJECT_REGISTER(MyInterface)
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define ZFOBJECT_REGISTER(T_ZFObject)
register ZFObject to ZFClass map
Definition ZFObjectDeclare.h:202
#define zfinterface
shows the type is an interface, see ZFInterface
Definition ZFObjectInterface.h:20
#define ZFINTERFACE_DECLARE(InterfaceName, ParentInterface,...)
see ZFInterface
Definition ZFObjectInterface.h:99
dummy base of interface types
Definition ZFObjectInterface.h:254
  • use zfinterface to show it's an ZFInterface type
  • due to some limitatation, all interface type must be inherited from ZFInterface by "zfextend ZFInterface"
  • use ZFINTERFACE_DECLARE for necessary macro expansion
  • similar to ZFObject, use ZFOBJECT_REGISTER to register your interface if you want it to be reflectable


once declared, an interface can be implemented by other object

zfclass MyObject : zfextend ParentObject
, zfimplement MyInterface,
, zfimplement AnotherInterface
{
ZFOBJECT_DECLARE(MyObject, ParentObject)
ZFIMPLEMENT_DECLARE(MyInterface, AnotherInterface)
};
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_DECLARE(ChildClass, SuperClass)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:124
#define ZFIMPLEMENT_DECLARE(ImplementedInterfaces,...)
see ZFINTERFACE_DECLARE
Definition ZFObjectInterface.h:168
#define zfimplement
shows class implement from interface, see ZFInterface
Definition ZFObjectInterface.h:24
  • use zfimplement to implement an interface
  • use ZFIMPLEMENT_DECLARE for necessary macro expansion, an object can implement more than one interfaces