如果不需要进行序列化(例如,当输出基于输入位流并且树未经更改时),则代理不会调用此实施函数。
如果在 CPI_VFT 结构中提供了此实施函数,则既不能指定 cpiWriteBuffer() 也不能指定 cpiWriteBufferEncoded(),因为 cpiDefineParserClass() 函数将失败,返回代码为 CCI_INVALID_IMPL_FUNCTION。
在其中定义 | 类型 | 成员 |
CPI_VFT | 有条件的 | iFpWriteBufferFormatted |
int cpiWriteBufferFormatted( CciParser* parser, CciContext* context, int encoding, int ccsid, CciChar* set, CciChar* type, CciChar* format);
追加在缓冲区中位流后面的数据大小(以字节为单位)。
int cpiWriteBufferFormatted( CciParser* parser, CciContext* context, int encoding, int ccsid CciChar* set, CciChar* type, CciChar* format ){ PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ; int initialSize = 0; int rc = 0; const void* a; CciByte b; initialSize = cpiBufferSize(&rc, parser); a = cpiBufferPointer(&rc, parser); b = cpiBufferByte(&rc, parser, 0); cpiAppendToBuffer(&rc, parser, (char *)"Some test data", 14); return cpiBufferSize(0, parser) - initialSize; }