指定したエレメントの値を設定するためのオプションの関数。 これは、構文エレメントの値が設定される際に、ブローカーによって呼び出されます。 ここで、ユーザー定義パーサーには、エレメント値の設定の動作を変更する機会が提供されます。
定義されている場所 | タイプ | メンバー |
CPI_VFT | オプション | iFpSetElementValue |
void cpiSetElementValue( CciParser* parser, CciElement* currentElement, CciElementValue* value);
なし。
この例は、サンプル・パーサー・ファイル 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; }