cpiSetCharacterValueFromBuffer

目的

指定した構文エレメントの値を設定します。

構文

void cpiSetCharacterValueFromBuffer(
int*           returnCode,
CciElement*     targetElement,
const CciChar*  value,
CciSize         length);

パラメーター

returnCode
関数からの戻りコードを受け取ります (出力)。考えられる戻りコードは以下のとおりです。
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_DATA_POINTER
  • CCI_INV_DATA_BUFLEN
targetElement
ターゲットの構文エレメント・オブジェクトのアドレスを指定します (入力)。
value
ターゲット・エレメントに設定する値 (入力)。
length
value パラメーターで指定した文字ストリングの長さ。 CciChar 文字の数値で表される (入力)。

戻り値

なし。エラーが発生した場合、returnCode がエラーの理由を示します。

サンプル

/* Convert the attribute value into broker form */
data = CciNString((char *)startMarker, markedSize, pc->iCcsid);
/* Create a new name-value element for the attribute */
newElement = cpiCreateElement(&rc, parser);
cpiSetElementType(&rc, newElement, CCI_ELEMENT_TYPE_NAME_VALUE);
cpiSetCharacterValueFromBuffer(&rc, newElement, data, length);
if (pc->trace) {
const char * mbData = mbString(data, pc->iCcsid);
fprintf(pc->tracefile, "PLUGIN: Created new NAMEVALUE element;
object=0x%x type=0x%x name=",
newElement, CCI_ELEMENT_TYPE_NAME_VALUE);
fprintf(pc->tracefile, "%s¥n", mbData);
fflush(pc->tracefile);
free((void *)mbData);
}
/* Free the memory created in CciNString() */
free((void *)data);
/* Add the element */
cpiAddAsLastChild(&rc, element, newElement);
関連概念
ユーザー定義のパーサー
ユーザー定義拡張機能
関連タスク
C でのパーサーの作成
関連資料
C パーサー・ユーティリティー関数
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック
Copyright IBM Corporation 1999, 2006 Last updated: 5 01, 2006
as08470_