ZFFramework
 
Loading...
Searching...
No Matches
ZFPropertyUtil.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFPropertyUtil_h_
7#define _ZFI_ZFPropertyUtil_h_
8
9#include "ZFObjectUtil.h"
10
12
13// ============================================================
14// ZFPropertyIsValueAccessed
19 ZF_IN const ZFProperty *propertyInfo
20 , ZF_IN zfany const &ownerObj
21 ) {
22 return propertyInfo->callbackIsValueAccessed(propertyInfo, ownerObj);
23}
24
25// ============================================================
26// ZFPropertyIsInitValue
31 ZF_IN const ZFProperty *propertyInfo
32 , ZF_IN zfany const &ownerObj
33 ) {
34 return propertyInfo->callbackIsInitValue(propertyInfo, ownerObj, zfnull);
35}
36
41 ZF_IN const ZFProperty *propertyInfo
42 , ZF_IN zfany const &ownerObj
43 ) {
44 zfauto v;
45 propertyInfo->callbackIsInitValue(propertyInfo, ownerObj, &v);
46 return v;
47}
48
49// ============================================================
50// ZFPropertyValueReset
55 ZF_IN const ZFProperty *propertyInfo
56 , ZF_IN zfany const &ownerObj
57 ) {
58 propertyInfo->callbackValueReset(propertyInfo, ownerObj);
59}
60
61// ============================================================
62// ZFPropertyCompare
67 ZF_IN const ZFProperty *propertyInfo
68 , ZF_IN ZFObject *obj0
69 , ZF_IN ZFObject *obj1
70 ) {
71 return ZFObjectCompare(
72 propertyInfo->getterMethod()->methodInvoke(obj0),
73 propertyInfo->getterMethod()->methodInvoke(obj1));
74}
75
76// ============================================================
77// ZFPropertyCompareValue
82 ZF_IN const ZFProperty *propertyInfo
83 , ZF_IN ZFObject *obj0
84 , ZF_IN ZFObject *obj1
85 ) {
87 propertyInfo->getterMethod()->methodInvoke(obj0),
88 propertyInfo->getterMethod()->methodInvoke(obj1));
89}
90
91// ============================================================
92// ZFPropertyCopy
96inline void ZFPropertyCopy(
97 ZF_IN const ZFProperty *propertyInfo
98 , ZF_IN ZFObject *dstObj
99 , ZF_IN ZFObject *srcObj
100 ) {
101 propertyInfo->setterMethod()->methodInvoke(dstObj, propertyInfo->getterMethod()->methodInvoke(srcObj));
102}
103
104// ============================================================
123 ZF_IN ZFObject *dstObj
124 , ZF_IN ZFObject *srcObj
125 );
126
127// ============================================================
137 ZF_IN ZFObject *obj0
138 , ZF_IN ZFObject *obj1
139 );
140
151 , ZF_IN ZFObject *obj
152 , ZF_IN_OPT zfindex maxCount = zfindexMax()
154 );
157 ZF_IN ZFObject *obj
158 , ZF_IN_OPT zfindex maxCount = zfindexMax()
160 ) {
161 zfstring ret;
162 ZFObjectPropertyInfoT(ret, obj, maxCount, token);
163 return ret;
164}
165
176 , ZF_IN ZFObject *obj
177 , ZF_IN_OPT zfindex maxCount = zfindexMax()
179 );
182 ZF_IN ZFObject *obj
183 , ZF_IN_OPT zfindex maxCount = zfindexMax()
185 ) {
186 zfstring ret;
187 ZFObjectVerboseInfoT(ret, obj, maxCount, token);
188 return ret;
189}
190
201 , ZF_IN ZFObject *obj
202 , ZF_IN_OPT zfindex maxCount = zfindexMax()
203 );
206 ZF_IN ZFObject *obj
207 , ZF_IN_OPT zfindex maxCount = zfindexMax()
208 ) {
209 zfstring ret;
210 ZFObjectPrettyInfoT(ret, obj, maxCount);
211 return ret;
212}
213
224 , ZF_IN ZFObject *obj
225 , ZF_IN_OPT zfindex maxCount = zfindexMax()
226 );
229 ZF_IN ZFObject *obj
230 , ZF_IN_OPT zfindex maxCount = zfindexMax()
231 ) {
232 zfstring ret;
233 ZFObjectShortInfoT(ret, obj, maxCount);
234 return ret;
235}
236
238#endif // #ifndef _ZFI_ZFPropertyUtil_h_
239
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
_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
#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
ZFCompareResult
compare result of two ZFObjects
Definition ZFCoreTypeDef_OtherType.h:28
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
utilities for ZFObject
ZFCompareResult ZFObjectCompareValue(ZFObject *const &e0, ZFObject *const &e1)
util method to ZFObject::objectCompareValue
Definition ZFObjectUtil.h:45
ZFCompareResult ZFObjectCompare(ZFObject *const &e0, ZFObject *const &e1)
util method to compare two ZFObject, return ZFCompareEqual if both null, return ZFCompareUncomparable...
Definition ZFObjectUtil.h:21
void ZFPropertyValueReset(const ZFProperty *propertyInfo, zfany const &ownerObj)
util for ZFPropertyCallbackValueReset
Definition ZFPropertyUtil.h:54
void ZFPropertyCopyAll(ZFObject *dstObj, ZFObject *srcObj)
copy all properties from srcObj to dstObj
ZFCompareResult ZFPropertyCompareValue(const ZFProperty *propertyInfo, ZFObject *obj0, ZFObject *obj1)
util to compare property value
Definition ZFPropertyUtil.h:81
void ZFObjectShortInfoT(zfstring &ret, ZFObject *obj, zfindex maxCount=((zfindex) -1))
print short info about the object, using ZFObjectPropertyInfoT
void ZFObjectPrettyInfoT(zfstring &ret, ZFObject *obj, zfindex maxCount=((zfindex) -1))
print pretty info about the object, using ZFObjectPropertyInfoT
zfbool ZFPropertyIsInitValue(const ZFProperty *propertyInfo, zfany const &ownerObj)
util for ZFPropertyCallbackIsInitValue
Definition ZFPropertyUtil.h:30
zfbool ZFPropertyIsValueAccessed(const ZFProperty *propertyInfo, zfany const &ownerObj)
util for ZFPropertyCallbackIsValueAccessed
Definition ZFPropertyUtil.h:18
zfbool ZFPropertyAllEqual(ZFObject *obj0, ZFObject *obj1)
compare all properties of obj0 with obj1's property by reflect
void ZFPropertyCopy(const ZFProperty *propertyInfo, ZFObject *dstObj, ZFObject *srcObj)
util to copy property between object
Definition ZFPropertyUtil.h:96
zfstring ZFObjectShortInfo(ZFObject *obj, zfindex maxCount=((zfindex) -1))
see ZFObjectShortInfoT
Definition ZFPropertyUtil.h:228
zfauto ZFPropertyGetInitValue(const ZFProperty *propertyInfo, zfany const &ownerObj)
util for ZFPropertyCallbackIsInitValue
Definition ZFPropertyUtil.h:40
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
void ZFObjectVerboseInfoT(zfstring &ret, ZFObject *obj, zfindex maxCount=((zfindex) -1), const ZFTokenForKeyValueContainer &token=_ZFP_ZFTokenForKeyValueContainerDefault)
print verbose info about the object, using ZFObjectPropertyInfoT
zfstring ZFObjectPrettyInfo(ZFObject *obj, zfindex maxCount=((zfindex) -1))
see ZFObjectPrettyInfoT
Definition ZFPropertyUtil.h:205
ZFCompareResult ZFPropertyCompare(const ZFProperty *propertyInfo, ZFObject *obj0, ZFObject *obj1)
util to compare property value
Definition ZFPropertyUtil.h:66
zfstring ZFObjectPropertyInfo(ZFObject *obj, zfindex maxCount=((zfindex) -1), const ZFTokenForKeyValueContainer &token=_ZFP_ZFTokenForKeyValueContainerDefault)
see ZFObjectPropertyInfoT
Definition ZFPropertyUtil.h:156
zfstring ZFObjectVerboseInfo(ZFObject *obj, zfindex maxCount=((zfindex) -1), const ZFTokenForKeyValueContainer &token=_ZFP_ZFTokenForKeyValueContainerDefault)
see ZFObjectVerboseInfoT
Definition ZFPropertyUtil.h:181
#define ZFTokenForKeyValueContainerDefault()
see ZFTokenForKeyValueContainer, modifyable, ZFTokenForKeyValueContainerTrim by default
Definition ZFToken.h:214
base class of all objects
Definition ZFObjectCore.h:209
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:28
util class to hold string tokens
Definition ZFToken.h:113
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