Set<type>ArrayItem
Description
Assigns a value to an array item of a specific type.
Syntax
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
SetBlobArrayItem ( pbarray array, pblong dim[ ], pbblob value ) SetBoolArrayItem ( pbarray array, pblong dim[ ], pbboolean value ) SetByteArrayItem ( pbarray array, pblong dim[ ], pbbyte value ) SetCharArrayItem ( pbarray array, pblong dim[ ], pbchar value ) SetDateArrayItem ( pbarray array, pblong dim[ ], pbdate value ) SetDateTimeArrayItem ( pbarray array, pblong dim[ ], pbdatetime value ) SetDecArrayItem ( pbarray array, pblong dim[ ], pbdec value ) SetDoubleArrayItem ( pbarray array, pblong dim[ ], pbdouble value ) SetIntArrayItem ( pbarray array, pblong dim[ ], pbint value ) SetLongArrayItem ( pbarray array, pblong dim[ ], pblong value ) SetLongLongArrayItem ( pbarray array, pblonglong dim[ ], pblong value ) SetObjectArrayItem ( pbarray array, pblong dim[ ], pbobject obj ) SetPBStringArrayItem ( pbarray array, pblong dim[ ], pbstring value ) SetRealArrayItem ( pbarray array, pblong dim[ ], pbreal value ) SetStringArrayItem ( pbarray array, pblong dim[ ], LPCTSTR value ) SetTimeArrayItem ( pbarray array, pblong dim[ ], pbtime value ) SetUintArrayItem ( pbarray array, pblong dim[ ], pbuint value ) SetUlongArrayItem ( pbarray array, pblong dim[ ], pbulong value ) |
|
Argument |
Description |
|---|---|
|
array |
A valid pbarray handle. |
|
dim |
A pblong array to hold indexes of each dimension. |
|
value |
The new value of the array item. |
Return value
PBXRESULT. PBX_OK for success.
If the index exceeds the bounds of a bounded array, it returns
PBX_E_ARRAY_INDEX_OUTOF_BOUNDS.
If the data passed in does not match the datatype of the array, it
returns PBX_E_MISMATCHED_DATA_TYPE.
Examples
This example creates a new unbounded simple array. In the FOR
loop, application-specific code (not shown here) gets array values,
which are then added to the array using SetPBStringArrayItem:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
pblong dim[1]; char * cstr; pbuint numDimensions = 1; PBArrayInfo::ArrayBound bound; bound.lowerBound = 1; bound.upperBound = size; d_pbarray = d_session->NewBoundedSimpleArray (pbvalue_string, numDimensions, &bound); for (int i = 1; i <= size; i++ ) { dim[0] = i; // add application-specific code here to // get array value pbstring pValue = d_session->NewString(cstr); d_session->SetPBStringArrayItem(d_pbarray, dim, pValue); delete [] cstr; } pbv.SetArray(d_pbarray); |
Usage
This method assigns the IPB_Value pointed to by the value argument
to the array item in the same way that the IPB_Value Set<type> method sets a
value.
See also