The PBObjectArrayAccessor class is used to access the items in an object array.
PBObjectArrayAccessor has two methods:
Obtains the array item at the specified dimension.
GetAt(pblong dim[])
pbobject.
Argument |
Description |
---|---|
dim |
The dimension of the array item to be set |
This example shows the use of GetAt in an object array:
PBObjectArrayAccessor aa(session, *array_val); for (i=0;i<itemcount2;i++) { dim[0] = i+1; oarg = aa.GetAt(dim); cls = session->GetClass(oarg); if( cls == NULL ) return; fid = session->GetFieldID(cls, "text"); if ( fid == 0xffff) return; fid_pv = session->GetFieldAddress(oarg,fid); mystr = fid_pv->GetString(); ostr_a[i] = session->GetString(mystr); }
Sets the array item at the specified dimension.
SetAt(pblong dim[], pbobject obj)
Argument |
Description |
---|---|
dim |
The dimension of the array item to be set |
obj |
A valid object handle |
None.
This example shows the use of SetAt in an object array:
PBObjectArrayAccessor aa(session,*array_val); for (i=0;i<itemcount1;i++) { cls = session->FindClass(group,sp[i]); if( cls == NULL ) return; iarg = session->NewObject(cls); session->ReferenceObject(iarg); dim[0] = i+1; aa.SetAt(dim, iarg); fid = session->GetFieldID(cls, "text"); if ( fid == 0xffff ) return; fid_pv = session->GetFieldAddress(iarg, fid); mystr = fid_pv->GetString(); istr_a[i] = session->GetString(mystr); }