ZFFramework
 
Loading...
Searching...
No Matches
ZFObjectIO.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFObjectIO_h_
7#define _ZFI_ZFObjectIO_h_
8
9#include "ZFFile.h"
11
12// ============================================================
43 ZF_IN const ZFInput &input
44 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
45 );
48 ZF_OUT zfauto &ret
49 , ZF_IN const ZFInput &input
50 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
51 );
54 ZF_IN_OUT const ZFOutput &output
55 , ZF_IN ZFObject *obj
56 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
57 );
58
59// ============================================================
94#define ZFOBJECTIO_DEFINE(registerSig, level, checkerAction, fromInputAction, toOutputAction) \
95 ZF_STATIC_REGISTER_INIT(ObjIOReg_##registerSig) { \
96 _ZFP_ZFObjectIORegister(zftext(#registerSig), zfself::_ZFP_checker, zfself::_ZFP_fromInput, zfself::_ZFP_toOutput, level); \
97 } \
98 ZF_STATIC_REGISTER_DESTROY(ObjIOReg_##registerSig) { \
99 _ZFP_ZFObjectIOUnregister(zftext(#registerSig), zfself::_ZFP_checker, zfself::_ZFP_fromInput, zfself::_ZFP_toOutput); \
100 } \
101 static zfbool _ZFP_checker( \
102 ZF_IN zfbool isOutput \
103 , ZF_IN const ZFPathInfo &pathInfo \
104 , ZF_IN const zfstring &fileName \
105 , ZF_IN const zfstring &fileExt \
106 ) { \
107 checkerAction \
108 } \
109 static zfbool _ZFP_fromInput( \
110 ZF_OUT zfauto &ret \
111 , ZF_IN_OUT const ZFInput &input \
112 , ZF_OUT_OPT zfstring *outErrorHint = zfnull \
113 ) { \
114 fromInputAction \
115 } \
116 static zfbool _ZFP_toOutput( \
117 ZF_IN_OUT const ZFOutput &output \
118 , ZF_IN zfany const &obj \
119 , ZF_OUT_OPT zfstring *outErrorHint = zfnull \
120 ) { \
121 toOutputAction \
122 } \
123 ZF_STATIC_REGISTER_END(ObjIOReg_##registerSig)
124
125typedef zfbool (*_ZFP_ZFObjectIOCallback_checker)(
126 ZF_IN zfbool isOutput
127 , ZF_IN const ZFPathInfo &pathInfo
128 , ZF_IN const zfstring &fileName
129 , ZF_IN const zfstring &fileExt
130 );
131typedef zfbool (*_ZFP_ZFObjectIOCallback_fromInput)(
132 ZF_OUT zfauto &ret
133 , ZF_IN_OUT const ZFInput &input
134 , ZF_OUT_OPT zfstring *outErrorHint /* = zfnull */
135 );
136typedef zfbool (*_ZFP_ZFObjectIOCallback_toOutput)(
137 ZF_IN_OUT const ZFOutput &output
138 , ZF_IN zfany const &obj
139 , ZF_OUT_OPT zfstring *outErrorHint /* = zfnull */
140 );
141extern ZFLIB_ZFCore void _ZFP_ZFObjectIORegister(
142 ZF_IN const zfchar *registerSig
143 , ZF_IN _ZFP_ZFObjectIOCallback_checker checker
144 , ZF_IN _ZFP_ZFObjectIOCallback_fromInput fromInput
145 , ZF_IN _ZFP_ZFObjectIOCallback_toOutput toOutput
146 , ZF_IN ZFLevel level
147 );
148extern ZFLIB_ZFCore void _ZFP_ZFObjectIOUnregister(
149 ZF_IN const zfchar *registerSig
150 , ZF_IN _ZFP_ZFObjectIOCallback_checker checker
151 , ZF_IN _ZFP_ZFObjectIOCallback_fromInput fromInput
152 , ZF_IN _ZFP_ZFObjectIOCallback_toOutput toOutput
153 );
154
155// ============================================================
163#define ZFStyleDecoder_ZFObjectIO ZFObjectIO
164
166#endif // #ifndef _ZFI_ZFObjectIO_h_
167
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
_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:192
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
#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
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
file utility
ZFLevel
level for logic which depends on order
Definition ZFLevel.h:17
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
zfauto ZFObjectIOLoad(const ZFInput &input, zfstring *outErrorHint=zft_zfnull)
high level object IO
zfbool ZFObjectIOSave(const ZFOutput &output, ZFObject *obj, zfstring *outErrorHint=zft_zfnull)
see ZFObjectIOLoad
zfbool ZFObjectIOLoadT(zfauto &ret, const ZFInput &input, zfstring *outErrorHint=zft_zfnull)
see ZFObjectIOLoad
general input callback
Definition ZFIOCallback_input.h:37
base class of all objects
Definition ZFObjectCore.h:209
general output callback
Definition ZFIOCallback_output.h:37
path related info storage for impl, actual meaning of the info depends on impl
Definition ZFPathInfo.h:35
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