ZFFramework
 
Loading...
Searching...
No Matches
zfweak Class Reference

weak reference to ZFObject More...

#include <zfweak.h>

Inheritance diagram for zfweak:
zfweakT< T_ZFObjectBase >

Public Member Functions

zfbool valid (void) const
 true if the holded object is not null
 
zfany get (void) const
 get the holded object
 
template<typename T_ZFObject>
void set (T_ZFObject const &obj)
 set the holded object
 
void set (const zfweak &obj)
 set the holded object
 
void set (zft_zfnullT const &)
 set the holded object
 
ZFObjecttoObject (void) const
 get the holded object
 
template<typename T_ZFObject>
T_ZFObject to (void) const
 cast by zfcast
 
const zfanyasAny (void) const
 access as zfany
 

Detailed Description

weak reference to ZFObject

usage:

ZFArray *obj = xxx;
zfweak p1 = obj;
ZFArray *access1 = p1.get();
if(p2) {
p2.get()->add(xxx);
}
p2.set(xxx);
if(p2.valid()) {
p2.get()->add(xxx);
}
container of ZFObject, see ZFContainer
Definition ZFArray.h:17
weak reference to ZFObject
Definition zfweak.h:51
zfany get(void) const
get the holded object
Definition zfweak.h:116
void set(T_ZFObject const &obj)
set the holded object
Definition zfweak.h:123
zfbool valid(void) const
true if the holded object is not null
Definition zfweak.h:109
see zfweak
Definition zfweak.h:189

can be used in script with similar rule, lua for example:

local a = ZFArray();
local p1 = zfweak(a);
local access1 = p1:get();
local p2 = zfweak(a);
if(p2:get() ~= zfnull) {
p2:get():add(xxx);
}
p2:set(xxx);
if(p2:valid()) {
p2:get():add(xxx);
}
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88

The documentation for this class was generated from the following file: