ZFFramework
Loading...
Searching...
No Matches
ZFKeyValueContainer.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFKeyValueContainer_h_
7#define _ZFI_ZFKeyValueContainer_h_
8
9#include "ZFContainer.h"
11
12zfclassFwd _ZFP_ZFKeyValueContainerPrivate;
60zfabstract ZFLIB_ZFCore ZFKeyValueContainer: zfextend ZFContainer {
61 ZFOBJECT_DECLARE_ABSTRACT(ZFKeyValueContainer, ZFContainer)
62
63public:
68 , ZFMP_IN(const zfiter &, it)
69 )
70
71public:
79 , ZFMP_IN(ZFObject *, key)
80 , ZFMP_IN(ZFObject *, value)
81 )
86 , ZFMP_OUT(zfiter &, it)
87 , ZFMP_IN(ZFObject *, key)
88 , ZFMP_IN_OPT(ZFObject *, defValue, ZFNull())
89 )
90
91public:
96 , ZFMP_IN(ZFKeyValueContainer *, another)
97 )
98
99private:
102 , ZFMP_IN(ZFObject *, value)
103 ) {
105 return zfnull;
106 }
108 , ZFMP_IN(ZFObject *, value)
109 , ZFMP_IN_OUT(zfiter &, it)
110 ) {
112 return zfnull;
113 }
114 ZFMETHOD_OVERRIDE_INLINE_1(void, addFrom
115 , ZFMP_IN(ZFContainer *, another)
116 ) {
117 if(another != zfnull) {
118 zfself *tmp = zfcast(zfself *, another);
119 if(tmp == zfnull) {
121 return;
122 }
123 this->addFrom(tmp);
124 }
125 }
127
128public:
132 , ZF_IN_OPT zfindex maxCount = zfindexMax()
134 );
137 ZF_IN_OPT zfindex maxCount = zfindexMax()
139 );
140public:
145 , ZFMP_IN_OUT(zfstring &, ret)
146 , ZFMP_IN(zfindex, maxCount)
147 , ZFMP_IN(const ZFTokenForKeyValueContainer &, token)
151 , ZFMP_IN(zfindex, maxCount)
152 , ZFMP_IN(const ZFTokenForKeyValueContainer &, token)
154
155protected:
160 ZF_IN const ZFSerializableData &serializableData
161 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
162 , ZF_OUT_OPT ZFSerializableData *outErrorPos = zfnull
163 );
177 ZF_IN_OUT ZFSerializableData &serializableData
178 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
179 , ZF_IN_OPT ZFSerializable *refOwner = zfnull
180 );
181protected:
186 ZF_IN_OUT ZFSerializableData &serializableData
187 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
188 , ZF_IN_OPT ZFSerializable *refOwner = zfnull
189 );
190
191protected:
194 ZF_IN const zfchar *src
195 , ZF_IN_OPT zfindex srcLen = zfindexMax()
196 , ZF_OUT_OPT zfstring *errorHint = zfnull
197 );
201 , ZF_OUT_OPT zfstring *errorHint = zfnull
202 );
203
204protected:
206 virtual void objectOnDeallocPrepare(void);
207
208public:
210 virtual void objectInfoImpl(ZF_IN_OUT zfstring &ret) {
211 this->objectInfoOfContentT(ret, 5);
212 }
213
215 virtual ZFCompareResult objectCompareValueImpl(ZF_IN ZFObject *anotherObj);
216};
217
219#endif // #ifndef _ZFI_ZFKeyValueContainer_h_
220
container of ZFObject
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define ZFCoreCriticalNotSupported()
log that likes "[file function (line)] not supported"
Definition ZFCoreLog_CommonLog.h:142
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:210
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:198
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:202
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:214
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_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 ZFMP_IN_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:117
#define ZFMP_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:111
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1024
#define ZFMETHOD_DECLARE_3(ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMethod
Definition ZFMethodDeclare.h:1205
#define ZFMETHOD_INTERFACE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodInterfaceDeclare.h:145
#define ZFMETHOD_INTERFACE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodInterfaceDeclare.h:227
#define ZFMETHOD_OVERRIDE_INLINE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodInterfaceDeclare.h:278
#define ZFMETHOD_INTERFACE_3(ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMethod
Definition ZFMethodInterfaceDeclare.h:314
#define ZFMETHOD_OVERRIDE_INLINE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodInterfaceDeclare.h:193
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZFNull()
a global null object
Definition ZFNull.h:20
#define zfabstract
typename for class showing that its abstract
Definition ZFObjectClassTypeFwd.h:42
#define ZFOBJECT_DECLARE_ABSTRACT(ChildClass, SuperClass,...)
necessary for every abstract class inherit from ZFObject
Definition ZFObjectDeclare.h:148
#define ZFTokenForContainerDefault()
see ZFTokenForContainer, modifyable, ZFTokenForContainerTrim by default
Definition ZFToken.h:107
container of ZFObject
Definition ZFContainer.h:47
virtual zfbool serializableOnSerializeToDataWithRef(ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull)
see ZFKeyValueContainer::serializableOnSerializeToData
virtual zfbool serializableOnCheck(void)
see serializable
virtual zfbool serializableOnSerializeFromString(const zfchar *src, zfindex srcLen=((zfindex) -1), zfstring *errorHint=zft_zfnull)
see serializeFromString
virtual zfbool serializableOnSerializeToData(ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull)
see ZFSerializable::serializableOnSerializeToData
virtual zfstring objectInfoOfContent(zfindex maxCount=((zfindex) -1), const ZFTokenForContainer &token=_ZFP_ZFTokenForContainerDefault)
see objectInfoOfContentT
virtual ZFCompareResult objectCompareValueImpl(ZFObject *anotherObj)
see objectCompareValue
virtual void objectInfoOfContentT(zfstring &ret, zfindex maxCount=((zfindex) -1), const ZFTokenForContainer &token=_ZFP_ZFTokenForContainerDefault)
return a short string describe the content
virtual zfbool serializableOnSerializeToString(zfstring &ret, zfstring *errorHint=zft_zfnull)
see serializeFromString
virtual void addFrom(ZFKeyValueContainer *another)=0
add data from another container
virtual zfiter iterAdd(ZFObject *key, ZFObject *value)=0
add key value to tail, see zfiter
virtual void objectInfoImpl(zfstring &ret)
see objectInfo
Definition ZFKeyValueContainer.h:210
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 s...
virtual zfbool iterAccess(zfiter &it, ZFObject *key, ZFObject *defValue=(_ZFP_ZFNull))=0
return true if already exist, or false and insert <key, defValue> if not exist
virtual void objectOnDeallocPrepare(void)
called before objectOnDealloc, safe to call virtual functions here
virtual zfany iterKey(const zfiter &it)=0
get key value pair with iter, see zfiter
base class of all objects
Definition ZFObjectCore.h:195
ZFSerializable's data container, see ZFSerializable.
Definition ZFSerializableData.h:74
util class to hold string tokens
Definition ZFToken.h:17
util class to hold string tokens
Definition ZFToken.h:113
util method to cast ZFObject types freely
Definition zfany.h:35
iterator for ZFFramework
Definition zfiter.h:40
#define zfcast(T_To, obj)
safely cast ZFObject types, return null if not desired type
Definition zfcast.h:24