base class of call serializable object More...
#include <ZFSerializable.h>
Public Member Functions | |
zfbool | serializable (void) |
true if object is currently serializable, see ZFSerializable | |
zfbool | serializeFromData (const ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull) |
serialize from data, see ZFSerializable | |
zfbool | serializeToData (ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull) |
serialize to data, see ZFSerializable | |
zfbool | serializeFromString (const zfchar *src, zfindex srcLen=((zfindex) -1), zfstring *errorHint=zft_zfnull) |
serialize from string, return false by default | |
zfbool | serializeToString (zfstring &ret, zfstring *errorHint=zft_zfnull) |
see serializeFromString | |
void | serializablePropertyTypeGetAll (ZFCoreArray< const ZFProperty * > ¬SerializableProperty, ZFCoreArray< const ZFProperty * > &serializableProperty, ZFCoreArray< const ZFProperty * > &embededProperty) |
return a list of each type of property, for debug use only | |
zfstring | serializablePropertyTypeInfo (void) |
return info of serializablePropertyTypeGetAll, for debug use only | |
void | serializableGetAllSerializablePropertyT (ZFCoreArray< const ZFProperty * > &ret) |
see serializableGetAllSerializableProperty | |
ZFCoreArray< const ZFProperty * > | serializableGetAllSerializableProperty (void) |
get all serializable property, usually for debug only, see serializableOnCheckPropertyType | |
void | serializableGetAllSerializableEmbededPropertyT (ZFCoreArray< const ZFProperty * > &ret) |
see serializableGetAllSerializableEmbededProperty | |
ZFCoreArray< const ZFProperty * > | serializableGetAllSerializableEmbededProperty (void) |
get all serializable embeded property, usually for debug only, see serializableOnCheckPropertyType | |
virtual void | serializableInfoT (zfstring &ret) |
get info as a serializable | |
virtual zfstring | serializableInfo (void) |
see serializableInfoT | |
![]() | |
virtual const ZFClass * | classData (void)=0 |
get instance's class info | |
virtual ZFObject * | toObject (void)=0 |
convert to ZFObject type | |
Static Public Member Functions | |
static const ZFClass * | ClassData (void) |
get class info | |
![]() | |
static const ZFClass * | ClassData (void) |
get class info | |
Protected Types | |
typedef ZFInterface | zfsuper |
typedef for super (always ZFInterface for an interface type) | |
typedef ZFSerializable | zfself |
typedef for self | |
![]() | |
typedef _ZFP_ObjI_Base | zfsuper |
typedef for super (always ZFInterface for an interface type) | |
typedef ZFInterface | zfself |
typedef for self | |
Protected Member Functions | |
virtual ZFSerializablePropertyType | serializableOnCheckPropertyType (const ZFProperty *property) |
check the property type that serializable should do what while serializing | |
virtual zfbool | serializableOnCheck (void) |
see serializable | |
virtual zfbool | serializableOnSerializeFromData (const ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull) |
for serializable data that has "category" attribute, ZFSerializable would ignore it and leave it to subclass to resolve, see ZFSerializable | |
virtual zfbool | serializableOnSerializeToData (ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull) |
corresponding to serializableOnSerializeFromData, return whether the task is success, see ZFSerializable | |
virtual zfbool | serializableOnSerializePropertyFromData (const ZFSerializableData &propertyData, const ZFProperty *property, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull) |
see serializableOnCheckPropertyType, usually you have no need to override this method, see ZFSerializable | |
virtual zfbool | serializableOnSerializePropertyToData (ZFSerializableData &ownerData, const ZFProperty *property, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull) |
see serializableOnCheckPropertyType, usually you have no need to override this method, see ZFSerializable | |
virtual zfbool | serializableOnSerializeEmbededPropertyFromData (const ZFSerializableData &propertyData, const ZFProperty *property, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull) |
see serializableOnCheckPropertyType, usually you have no need to override this method, see ZFSerializable | |
virtual zfbool | serializableOnSerializeEmbededPropertyToData (ZFSerializableData &ownerData, const ZFProperty *property, ZFSerializable *refOwner, zfstring *outErrorHint=zft_zfnull) |
see serializableOnCheckPropertyType, usually you have no need to override this method, see ZFSerializable | |
virtual zfbool | serializableOnSerializeFromString (const zfchar *src, zfindex srcLen=((zfindex) -1), zfstring *errorHint=zft_zfnull) |
see serializeFromString | |
virtual zfbool | serializableOnSerializeToString (zfstring &ret, zfstring *errorHint=zft_zfnull) |
see serializeFromString | |
base class of call serializable object
a serializable object can be encoded to and decoded from a string data, use ZFSerializableData to store necessary data
a ZFSerializableData can hold these datas:
ZFSerializableData can be converted from and to xml elements, to make it easier to understand, here's a typical serializable data in xml format that shows the types:
in this example:
we have these builtin keywords for serializable data, you should not use them as attribute name:
a simplest way to implement ZFSerializable is:
if your object has extra serialize step to do, you may want to:
typically you should override serializableOnSerializeFromData and serializableOnSerializeToData to supply custom serialize step
serializable logic can also be used with style logic, see ZFStyleSet for more info
ADVANCED:
serializable would be created by ZFClass::newInstance while serializing from data, you may supply your custom constructor, see ZFSerializableKeyword_serializableNewInstance
zfbool ZFSerializable::serializable | ( | void | ) |
true if object is currently serializable, see ZFSerializable
subclass should override serializableOnCheck to check whether serializable
some object may be serializable or not depends on content
zfbool ZFSerializable::serializeFromData | ( | const ZFSerializableData & | serializableData, |
zfstring * | outErrorHint = zft_zfnull, | ||
ZFSerializableData * | outErrorPos = zft_zfnull ) |
serialize from data, see ZFSerializable
note that for performance, this method won't check whether serializable before execute
zfbool ZFSerializable::serializeToData | ( | ZFSerializableData & | serializableData, |
zfstring * | outErrorHint = zft_zfnull, | ||
ZFSerializable * | refOwner = zft_zfnull ) |
serialize to data, see ZFSerializable
note that for performance, this method won't check whether serializable before execute
zfbool ZFSerializable::serializeFromString | ( | const zfchar * | src, |
zfindex | srcLen = ((zfindex) -1), | ||
zfstring * | errorHint = zft_zfnull ) |
serialize from string, return false by default
for most case, serializeFromData would supply serialization logic automatically, however, the serialization result may be quite verbose for the data structure, subclass may override serializableOnSerializeFromString to supply custom serialization logic as short data structure
|
protectedvirtual |
check the property type that serializable should do what while serializing
properties declared in ZFSerializable have these types:
subclass may override this method to make ZFSerializable ignore or force serialize some property, but you must make sure it's logical valid
ignored property (i.e. ZFSerializablePropertyTypeNotSerializable) can be manually serialized during serializableOnSerializeFromData and serializableOnSerializeToData
by default, properties would be treated as not serializable if ZFProperty::isInternal
Reimplemented in ZFUIAutoLayoutParam, ZFUIListView, and ZFUIOnScreenKeyboardAutoFitLayout.
|
inlineprotectedvirtual |
see serializable
Reimplemented in ZFContainer, and ZFKeyValueContainer.
|
inlineprotectedvirtual |
for serializable data that has "category" attribute, ZFSerializable would ignore it and leave it to subclass to resolve, see ZFSerializable
while overriding this method, you should call super first, and then check whether super has resolved the data
if subclass should resolve the category, you should mark data as resolved and return whether resolve success
if not, subclass should leave the data unresoved and return true
Reimplemented in v_ZFCoreArray, ZFAniForFrame, ZFAniGroup, ZFContainer, ZFEnum, ZFKeyValueContainer, ZFRegExp, ZFStyleList, ZFTime, ZFTypeIdWrapper, ZFUIAutoLayout, ZFUIAutoLayoutParam, ZFUICellArray, ZFUIImage, ZFUIListView, and ZFUIView.
|
inlineprotectedvirtual |
corresponding to serializableOnSerializeFromData, return whether the task is success, see ZFSerializable
Reimplemented in v_ZFCoreArray, ZFAniForFrame, ZFAniGroup, ZFContainer, ZFEnum, ZFKeyValueContainer, ZFRegExp, ZFStyleList, ZFTime, ZFTypeIdWrapper, ZFUIAutoLayoutParam, ZFUICellArray, ZFUIImage, ZFUIListView, and ZFUIView.
|
protectedvirtual |
see serializableOnCheckPropertyType, usually you have no need to override this method, see ZFSerializable
if subclass override this method, you should check whether it's resolved by parent, and then mark data as resolved and return whether resolve success
|
protectedvirtual |
see serializableOnCheckPropertyType, usually you have no need to override this method, see ZFSerializable
set serializable class to null to show the property is in init value state and have no need to be serialized
|
protectedvirtual |
see serializableOnCheckPropertyType, usually you have no need to override this method, see ZFSerializable
set serializable class to null to show the property is in init value state and have no need to be serialized
|
inlineprotectedvirtual |
Reimplemented in ZFRegExp, and ZFTypeIdWrapper.
|
inlineprotectedvirtual |
Reimplemented in ZFRegExp, and ZFTypeIdWrapper.