この関数は、既存の cpiParseBuffer() インプリメンテーション関数によって提供される機能の拡張で、入力メッセージを表すために使用されるエンコードおよびコード化文字セットを提供します。 このインプリメンテーション関数が CPI_VFT 構造で提供されている場合、cpiParseBuffer() または cpiParseBufferFormatted() のどちらも指定できません。 指定した場合、cpiDefineParserClass() 関数は失敗し、戻りコード CCI_INVALID_IMPL_FUNCTION が出されます。
定義されている場所 | タイプ | メンバー |
CPI_VFT | 条件付き | iFpParseBufferEncoded |
int cpiParseBufferEncoded( CciParser* parser, CciContext* context, int encoding, int ccsid);
パーサーが所有権を持っているメッセージ・バッファーの残りの部分のサイズ (バイト数)。
この例は、サンプル・パーサー・ファイル BipSampPluginParser.c から取られています (428 行から 466 行)。
int cpiParseBufferEncoded( CciParser* parser, CciContext* context, int encoding, int ccsid ){ PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ; int rc; /* Get a pointer to the message buffer and set the offset */ pc->iBuffer = (void *)cpiBufferPointer(&rc, parser); pc->iIndex = 0; /* Save the format of the buffer */ pc->iEncoding = encoding; pc->iCcsid = ccsid; /* Save size of the buffer */ pc->iSize = cpiBufferSize(&rc, parser); /* Prime the first byte in the stream */ pc->iCurrentCharacter = cpiBufferByte(&rc, parser, pc->iIndex); /* Set the current element to the root element */ pc->iCurrentElement = cpiRootElement(&rc, parser); /* Reset flag to ensure parsing is reset correctly */ pc->iInTag = 0; if (pc->trace) { fprintf(pc->tracefile, "PLUGIN: <- cpiParseBufferEncoded() retvalue=%d¥n", pc->iSize); fflush(pc->tracefile); }