cpiWriteBuffer

用途

写一个与解析器相关的消息缓冲区的语法元素树。它使用当前语法元素树作为源,在与解析器对象相关的消息缓冲区中的位流追加数据。在执行此实施函数期间不应该修改元素树。cpiAppendToBuffer 实用程序函数可用于将来自元素树的数据追加到消息缓冲区(位流)。

如果在 CPI_VFT 结构中提供了此实施函数,则既不能指定 cpiWriteBufferEncoded() 也不能指定 cpiWriteBufferFormatted(),因为 cpiDefineParserClass() 函数将失败,返回代码为 CCI_INVALID_IMPL_FUNCTION。

在其中定义 类型 成员
CPI_VFT 有条件的 iFpWriteBuffer

语法

int cpiWriteBuffer(
    CciParser*  parser,
    CciContext*  context);

参数

parser
解析器对象的地址(输入)。
context
解析器对象拥有的上下文的地址(输入)。

返回值

追加在缓冲区中位流后面的数据大小(以字节为单位)。

样本

int cpiWriteBuffer(
    CciParser*  parser,
    CciContext* context
){
    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;
}
相关概念
用户定义的解析器
用户定义的扩展
相关任务
使用 C 创建解析器
相关参考
cpiWriteBufferEncoded
cpiWriteBufferFormatted
C 解析器实施函数
声明 | 商标 | 下载 | 书库 | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后一次更新时间:2006/08/14
as08210_