ZFFramework
 
Loading...
Searching...
No Matches
ZFIOCallback_util.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFIOCallback_util_h_
7#define _ZFI_ZFIOCallback_util_h_
8
10#include "ZFIOCallback_output.h"
12
13// ============================================================
22 ZF_OUT zfchar *buf
23 , ZF_IN_OUT const ZFInput &input
24 );
30 , ZF_IN_OUT const ZFInput &input
31 );
32
40 ZF_OUT zfchar *buf
41 , ZF_IN_OUT const ZFInput &input
42 , ZF_IN_OPT const zfchar *charSet = " \t\r\n"
43 );
44
56 , ZF_IN_OUT const ZFInput &input
57 , ZF_IN_OPT const zfchar *charSet = " \t\r\n"
58 , ZF_IN_OPT zfindex maxCount = zfindexMax()
59 , ZF_OUT_OPT zfchar *firstMatchedChar = zfnull
60 );
61
70 ZF_IN const zfchar **tokens
71 , ZF_IN zfindex tokenCount
72 , ZF_IN_OUT const ZFInput &input
73 );
74
75// ============================================================
82 ZF_IN_OUT const ZFOutput &output
83 , ZF_IN_OUT const ZFInput &input
85 );
93 , ZF_IN_OUT const ZFInput &input
95 );
96
97// ============================================================
105 ZF_IN_OUT const ZFOutput &output
106 , ZF_IN_OUT const ZFInput &input
107 );
116 ZF_IN_OUT zfstring &output
117 , ZF_IN_OUT const ZFInput &input
118 );
119
120// ============================================================
124inline void ZFOutputRepeat(
125 ZF_IN_OUT const ZFOutput &output
126 , ZF_IN const zfchar *token
127 , ZF_IN zfindex count
128 ) {
129 if(count != 0 && !zfstringIsEmpty(token)) {
130 zfindex len = zfslen(token);
131 for(zfindex i = 0; i < count; ++i) {
132 output.execute(token, len);
133 }
134 }
135}
136
137// ============================================================
149 ZF_IN const ZFOutput &o0
150 , ZF_IN const ZFOutput &o1
151 , ZF_IN_OPT const ZFOutput &o2 = zfnull
152 , ZF_IN_OPT const ZFOutput &o3 = zfnull
153 , ZF_IN_OPT const ZFOutput &o4 = zfnull
154 , ZF_IN_OPT const ZFOutput &o5 = zfnull
155 , ZF_IN_OPT const ZFOutput &o6 = zfnull
156 , ZF_IN_OPT const ZFOutput &o7 = zfnull
157 );
163 );
164
166#endif // #ifndef _ZFI_ZFIOCallback_util_h_
167
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
zfbool zfstringIsEmpty(const zfchar *s)
util to check whether string is empty (null or empty string)
Definition ZFCoreStringUtil.h:197
zfindex zfslen(const zfchar *s)
strlen wrapper as zfchar type
Definition ZFCoreTypeDef_CharType.h:144
_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_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#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_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
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
common callback defines
common callback defines
zfindex ZFInputReadLine(const ZFOutput &output, const ZFInput &input)
util method to read one line
ZFOutput ZFOutputChain(const ZFOutput &o0, const ZFOutput &o1, const ZFOutput &o2=zft_zfnull, const ZFOutput &o3=zft_zfnull, const ZFOutput &o4=zft_zfnull, const ZFOutput &o5=zft_zfnull, const ZFOutput &o6=zft_zfnull, const ZFOutput &o7=zft_zfnull)
util to create a chained output
zfindex ZFInputRead(const ZFOutput &output, const ZFInput &input, zfindex size=((zfindex) -1))
util method to read contents of input to output
zfindex ZFInputSkipChars(zfchar *buf, const ZFInput &input, const zfchar *charSet=" \t\r\n")
util method to skip chars in set
zfindex ZFInputCheckMatch(const zfchar **tokens, zfindex tokenCount, const ZFInput &input)
util method to check whether the input match the tokens
zfindex ZFInputReadUntil(zfstring &ret, const ZFInput &input, const zfchar *charSet=" \t\r\n", zfindex maxCount=((zfindex) -1), zfchar *firstMatchedChar=zft_zfnull)
read until any char in charSet shows up, or reached maxCount, return count read so far
void ZFOutputRepeat(const ZFOutput &output, const zfchar *token, zfindex count)
repeat output
Definition ZFIOCallback_util.h:124
zfindex ZFInputReadChar(zfchar *buf, const ZFInput &input)
read single logic char to buf, return count of sizoef(zfchar) if success, or 0 if fail
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
light weight array
Definition ZFCoreArray.h:331
general input callback
Definition ZFIOCallback_input.h:37
general output callback
Definition ZFIOCallback_output.h:37