从指定的语法元素获取值对象。此值对象在无法进行集成的对象中是不透明的。通过使用 cpiSetElementValueValue 函数,它可以用于设置或从一个元素到另一个元素派生,而不需要知道其类型。这可以通过调用实施函数 cpiElementValue 和 cpiSetElementValue 覆盖行为的解析器使用。
const CciElementValue* cpiElementValueValue( int* returnCode, CciElement* targetElement);
返回存储在指定的目标语法元素中的 CciElementValue 对象的地址。如果发生错误,则返回零(CCI_NULL_ADDR),并且 returnCode 表明错误的原因。
此示例取自样本解析器文件 BipSampPluginParser.c(705 行到 725 行):
const CciElementValue* cpiElementValue( CciParser* parser, CciElement* element ){ CciElement* firstChild; const CciElementValue* value; int rc; if ((cpiElementType(&rc, element) == CCI_ELEMENT_TYPE_VALUE) || (cpiElementType(&rc, element) == CCI_ELEMENT_TYPE_NAME_VALUE)) { value = cpiElementValueValue(&rc, element); } else if (cpiElementType(&rc, element) == CCI_ELEMENT_TYPE_NAME) { firstChild = cniFirstChild(&rc, element); value = cpiElementValueValue(&rc, firstChild); } else { } return(value); }