cpiDefineParserClass

目的

パーサー・ファクトリーによってサポートされるパーサー・クラスの名前を定義します。 functbl は、C インプリメンテーション関数 (つまり、 パーサー自体の関数を提供する関数) へのポインターを含む、仮想関数表へのポインターです。

構文

void cpiDefineParserClass(
  int*           returnCode,
  CciFactory* factoryObject,
  CciChar*     name,
  CPI_VFT*     functbl);

パラメーター

returnCode
関数からの戻りコードを受け取ります (出力)。
考えられる戻りコードは以下のとおりです。
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_FACTORY_OBJECT
  • CCI_INV_PARSER_NAME
  • CCI_PARSER_NAME_TOO_LONG
  • CCI_INV_OBJECT_NAME
  • CCI_INV_VFTP
  • CCI_MISSING_IMPL_FUNCTION
  • CCI_INV_IMPL_FUNCTION
  • CCI_NAME_EXISTS
factoryObject
名前付きパーサーをサポートするファクトリー・オブジェクトのアドレスを指定します (入力)。 このアドレスは、cpiCreateParserFactory から戻されます。
name
定義されるパーサー・クラスの名前 (入力)。 パーサー・クラス名の最大長は 8 文字です。
functbl
インプリメンテーション関数へのポインターを含む CPI_VFT 構造のアドレス (入力)。

戻り値

なし。エラーが発生した場合、returnCode がエラーの理由を示します。

サンプル

この例は、サンプル・パーサー・ファイル BipSampPluginParser.c から取られています (862 行から 901 行)。

void LilFactoryExportPrefix * LilFactoryExportSuffix bipGetParserFactory()
{
  /* Declare variables */
  CciFactory*     factoryObject;
  int             rc;
  static CPI_VFT  vftable = {CPI_VFT_DEFAULT};

  /* Before we proceed we need to initialise all the static constants */
  /* that may be used by the plug-in.                                 */
  initParserConstants();

  /* Setup function table with pointers to parser implementation functions */
  vftable.iFpCreateContext            = cpiCreateContext;
  vftable.iFpParseBufferEncoded       = cpiParseBufferEncoded;
  vftable.iFpParseFirstChild          = cpiParseFirstChild;
  vftable.iFpParseLastChild           = cpiParseLastChild;
  vftable.iFpParsePreviousSibling     = cpiParsePreviousSibling;
  vftable.iFpParseNextSibling         = cpiParseNextSibling;
  vftable.iFpWriteBufferEncoded       = cpiWriteBufferEncoded;
  vftable.iFpDeleteContext            = cpiDeleteContext;
  vftable.iFpSetElementValue          = cpiSetElementValue;
  vftable.iFpElementValue             = cpiElementValue;
  vftable.iFpNextParserClassName      = cpiNextParserClassName;
  vftable.iFpSetNextParserClassName   = cpiSetNextParserClassName;
  vftable.iFpNextParserEncoding       = cpiNextParserEncoding;
  vftable.iFpNextParserCodedCharSetId = cpiNextParserCodedCharSetId;

  /* Create the parser factory for this plugin */
  factoryObject = cpiCreateParserFactory(&rc, constParserFactory);
  if (factoryObject) {
    /* Define the classes of message supported by the factory */
    cpiDefineParserClass(&rc, factoryObject, constPXML, &vftable);
  }
  else {
    /* Error: Unable to create parser factory */
  }

  /* Return address of this factory object to the broker */
  return(factoryObject);
}
関連概念
ユーザー定義のパーサー
ユーザー定義拡張機能
関連タスク
C でのパーサーの作成
関連資料
cpiCreateParserFactory
C パーサー・ユーティリティー関数
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック
Copyright IBM Corporation 1999, 2006 最終更新: 08/21/2006
as08250_