PBObjectArrayAccessor class

Description

The PBObjectArrayAccessor class is used to access the items in an object array.

Methods

PBObjectArrayAccessor has two methods:

GetAt

SetAt

GetAt

Description

Obtains the array item at the specified dimension.

Syntax

GetAt(pblong dim[])

Return value

pbobject.

Argument

Description

dim

The dimension of the array item to be set


Examples

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);
}

See also

SetAt

SetAt

Description

Sets the array item at the specified dimension.

Syntax

SetAt(pblong dim[], pbobject obj)

Argument

Description

dim

The dimension of the array item to be set

obj

A valid object handle


Return value

None.

Examples

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);
}

See also

GetAt