cpiElementValueValue

用途

从指定的语法元素获取值对象。此值对象在无法进行集成的对象中是不透明的。通过使用 cpiSetElementValueValue 函数,它可以用于设置或从一个元素到另一个元素派生,而不需要知道其类型。这可以通过调用实施函数 cpiElementValuecpiSetElementValue 覆盖行为的解析器使用。

语法

const CciElementValue* cpiElementValueValue(
    int*                returnCode,
    CciElement*    targetElement);

参数

returnCode
接收来自函数(输出)的返回码。
可能的返回码是:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
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);
}
相关概念
用户定义的解析器
用户定义的扩展
相关任务
使用 C 创建解析器
相关参考
cpiElementName
cpiElementType
cpiElementValue group
C 解析器实用程序函数
声明 | 商标 | 下载 | 书库 | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后一次更新时间:2006/08/14
as08460_