Función opcional para establecer el valor de un elemento especificado. La invoca el intermediario cuando se debe establecer el valor de un elemento de sintaxis. Proporciona una oportunidad para que un analizador definido por el usuario altere temporalmente el comportamiento para establecer valores de elemento.
Definida en | Tipo | Miembro |
CPI_VFT | Opcional | iFpSetElementValue |
void cpiSetElementValue( CciParser* parser, CciElement* currentElement, CciElementValue* value);
Ninguno.
Este ejemplo se ha tomado del archivo de analizador de ejemplo BipSampPluginParser.c (líneas 675 a 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) { /* Crear un elemento de valor nuevo, añadirlo como primer hijo y establecer el valor */ newElement = cpiCreateElement(&rc, parser); cpiSetElementType(&rc, newElement, CCI_ELEMENT_TYPE_VALUE); cpiSetElementValueValue(&rc, newElement, value); cpiAddAsFirstChild(&rc, element, newElement); } else { } return; }