この関数は、新しい (現在接続されていない) 構文エレメントを、 指定したターゲット・エレメントの前の構文エレメント・ツリーに追加します。 新しく追加されるエレメントは、ターゲット・エレメントの直前の兄弟になります。
void cpiAddBefore(
int* returnCode,
CciElement* targetElement,
CciElement* newElement);
なし。 エラーが発生した場合、returnCode がエラーの理由を示します。
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 before the current value element,
and set the value */
newElement = cpiCreateElement(&rc, parser);
cpiSetElementType(&rc, newElement, CCI_ELEMENT_TYPE_VALUE);
cpiSetElementValueValue(&rc, newElement, value);
cpiAddBefore(&rc, element, newElement);
}
else {
}
return;
}