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 마지막 갱신 날짜: 2006/08/21
as08250_