ZFFramework
 
Loading...
Searching...
No Matches
ZFPropertyUtil.h File Reference

utility for ZFProperty More...

#include "ZFObjectUtil.h"

Go to the source code of this file.

Functions

zfbool ZFPropertyIsValueAccessed (const ZFProperty *propertyInfo, zfany const &ownerObj)
 util for ZFPropertyCallbackIsValueAccessed
 
zfbool ZFPropertyIsInitValue (const ZFProperty *propertyInfo, zfany const &ownerObj)
 util for ZFPropertyCallbackIsInitValue
 
zfauto ZFPropertyGetInitValue (const ZFProperty *propertyInfo, zfany const &ownerObj)
 util for ZFPropertyCallbackIsInitValue
 
void ZFPropertyValueReset (const ZFProperty *propertyInfo, zfany const &ownerObj)
 util for ZFPropertyCallbackValueReset
 
ZFCompareResult ZFPropertyCompare (const ZFProperty *propertyInfo, ZFObject *obj0, ZFObject *obj1)
 util to compare property value
 
ZFCompareResult ZFPropertyCompareValue (const ZFProperty *propertyInfo, ZFObject *obj0, ZFObject *obj1)
 util to compare property value
 
void ZFPropertyCopy (const ZFProperty *propertyInfo, ZFObject *dstObj, ZFObject *srcObj)
 util to copy property between object
 
void ZFPropertyCopyAll (ZFObject *dstObj, ZFObject *srcObj)
 copy all properties from srcObj to dstObj
 
zfbool ZFPropertyAllEqual (ZFObject *obj0, ZFObject *obj1)
 compare all properties of obj0 with obj1's property by reflect
 
void ZFObjectPropertyInfoT (zfstring &ret, ZFObject *obj, zfindex maxCount=((zfindex) -1), const ZFTokenForKeyValueContainer &token=_ZFP_ZFTokenForKeyValueContainerDefault)
 use reflect to print all property if the property is not ZFPropertyIsInitValue
 
zfstring ZFObjectPropertyInfo (ZFObject *obj, zfindex maxCount=((zfindex) -1), const ZFTokenForKeyValueContainer &token=_ZFP_ZFTokenForKeyValueContainerDefault)
 see ZFObjectPropertyInfoT
 
void ZFObjectVerboseInfoT (zfstring &ret, ZFObject *obj, zfindex maxCount=((zfindex) -1), const ZFTokenForKeyValueContainer &token=_ZFP_ZFTokenForKeyValueContainerDefault)
 print verbose info about the object, using ZFObjectPropertyInfoT
 
zfstring ZFObjectVerboseInfo (ZFObject *obj, zfindex maxCount=((zfindex) -1), const ZFTokenForKeyValueContainer &token=_ZFP_ZFTokenForKeyValueContainerDefault)
 see ZFObjectVerboseInfoT
 
void ZFObjectPrettyInfoT (zfstring &ret, ZFObject *obj, zfindex maxCount=((zfindex) -1))
 print pretty info about the object, using ZFObjectPropertyInfoT
 
zfstring ZFObjectPrettyInfo (ZFObject *obj, zfindex maxCount=((zfindex) -1))
 see ZFObjectPrettyInfoT
 
void ZFObjectShortInfoT (zfstring &ret, ZFObject *obj, zfindex maxCount=((zfindex) -1))
 print short info about the object, using ZFObjectPropertyInfoT
 
zfstring ZFObjectShortInfo (ZFObject *obj, zfindex maxCount=((zfindex) -1))
 see ZFObjectShortInfoT
 

Detailed Description

utility for ZFProperty

Function Documentation

◆ ZFPropertyCopyAll()

void ZFPropertyCopyAll ( ZFObject * dstObj,
ZFObject * srcObj )
extern

copy all properties from srcObj to dstObj

this function would go through all properties in dstObj, then search whether there are same property in srcObj, if there are, copy them from srcObj to dstObj by the reflectable getter and setter
search is done by property's name compare and type compare, and type is compared by ZFProperty::propertyTypeId
it's your responsibility to make sure the copy is valid

by default, these properties would be ignored:

  • setter or getter is not public
  • property name start with '_'
Note
this function may cost much time if there are many properties in the inherit tree, you may want to use ZFPropertyCopy directly for performance

◆ ZFPropertyAllEqual()

zfbool ZFPropertyAllEqual ( ZFObject * obj0,
ZFObject * obj1 )
extern

compare all properties of obj0 with obj1's property by reflect

if both object is null, return true
two object have no need to be same class, but must be ensured that all property are safe to be compared, i.e. each property's type must match

◆ ZFObjectPropertyInfoT()

void ZFObjectPropertyInfoT ( zfstring & ret,
ZFObject * obj,
zfindex maxCount = ((zfindex) -1),
const ZFTokenForKeyValueContainer & token = _ZFP_ZFTokenForKeyValueContainerDefault )
extern

use reflect to print all property if the property is not ZFPropertyIsInitValue

result looks like:

{prop1=v1,prop2=v2}

◆ ZFObjectVerboseInfoT()

void ZFObjectVerboseInfoT ( zfstring & ret,
ZFObject * obj,
zfindex maxCount = ((zfindex) -1),
const ZFTokenForKeyValueContainer & token = _ZFP_ZFTokenForKeyValueContainerDefault )
extern

print verbose info about the object, using ZFObjectPropertyInfoT

result looks like:

<NS.Obj(0x12345678){prop1=v1,prop2=v2}>

◆ ZFObjectPrettyInfoT()

void ZFObjectPrettyInfoT ( zfstring & ret,
ZFObject * obj,
zfindex maxCount = ((zfindex) -1) )
extern

print pretty info about the object, using ZFObjectPropertyInfoT

result looks like:

<Obj prop1=v1 prop2=v2>

◆ ZFObjectShortInfoT()

void ZFObjectShortInfoT ( zfstring & ret,
ZFObject * obj,
zfindex maxCount = ((zfindex) -1) )
extern

print short info about the object, using ZFObjectPropertyInfoT

result looks like:

(v1, v2)