cpiAddAsFirstChild

목적

새(현재 연결되지 않은) 구문 요소를 지정된 대상 요소의 첫 번째 하위 요소로 구문 요소 트리에 추가합니다.

구문

void cpiAddAsFirstChild(
    int*                   returnCode,
    CciElement*            targetElement,
  CciElement*  newElement);

매개변수

returnCode
함수의 리턴 코드를 수신합니다(출력).
가능한 리턴 코드는 다음과 같습니다.
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
targetElement
대상 구문 요소 오브젝트의 주소를 지정합니다(입력).
newElement
트리 구조에 추가할 새 구문 요소 오브젝트의 주소를 지정합니다(입력).

리턴 값

없음. 오류가 발생할 경우, returnCode는 오류의 이유를 표시합니다.

샘플

다음 예는 샘플 구문 분석기 파일 BipSampPluginParser.c에서 발췌한 것입니다(675 - 698행).

void cpiSetElementValue(
    CciParser*      parser,
    CciElement*      element,
    CciElementValue* value
){
    CciElement*        newElement;
    int                rc;

    if ((cpiElementType(&rc, element) == CCI_ELEMENT_TYPE_VALUE) ||
            (cpiElementType(&rc, element) == CCI_ELEMENT_TYPE_NAME_VALUE)) {
        cpiSetElementValueValue(&rc, element, value);
  }
    else if (cpiElementType(&rc, element) == CCI_ELEMENT_TYPE_NAME) {
        /* Create a new value element, add as a first child, and set the value */
            newElement = cpiCreateElement(&rc, parser);
        cpiSetElementType(&rc, newElement, CCI_ELEMENT_TYPE_VALUE);
        cpiSetElementValueValue(&rc, newElement, value);
        cpiAddAsFirstChild(&rc, element, newElement);
  }
  else {
  }

    return;
}
관련 개념
사용자 정의 구문 분석기
사용자 정의 확장 구성요소
관련 태스크
C로 구문 분석기 작성
관련 참조
cpiAddAsLastChild
C 구문 분석기 유틸리티 함수
주의사항 | 등록상표 | 다운로드 | 라이브러리 | 지원 | 피드백
Copyright IBM Corporation 1999, 2006 마지막 갱신 날짜: 2006/08/21
as08370_