指定した構文エレメントから値オブジェクトを取得します。 この値オブジェクトは隠されており、参照することはできません。 これを使用して、タイプが分からなくても、 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); }