Function _conSetMember() Foundation
Assigns a new value to a member variable of an Xbase++ object.
XPPAPIRET _conSetMember(ContainerHandle chObject,
char *mName,
ContainerHandle chValue);
This function returns NULL if no error occured, otherwise it returns an error code which can be checked by _conLastError().
The function _conSetMember() is used to assign the value of a container to a member variable of an Xbase++ object.
#include <windows.h>
#include "xppdef.h"
#include "xpppar.h"
#include "xppcon.h"
XPPRET XPPENTRY MyCAPIFunction(XppParamList paramList)
{ /* Declare and initialize variables */
ContainerHandle chAnimal1, chAnimal2;
ContainerHandle chName, chNewName;
ContainerHandle chParams[2];
/* Two objects are expected as parameters. */
chAnimal1 = _conParam( paramList, 1, NULL );
chAnimal2 = _conParam( paramList, 2, NULL );
/* Create new container containing new name for object */
/* and empty container for other object. */
chNewName = _conPutC( NULLCONTAINER, "Sheep in wolf clothing" );
chName = _conNew( NULLCONTAINER );
/* Retrieve name of object one and set new name for object two. */
_conGetMember( chAnimal1, "NAME", chName );
_conSetMember( chAnimal2, "NAME", chNewName );
/* Prepare method call */
chParams[0]=chAnimal2;
chParams[1]=chName;
/* Call object's method. */
_conCallMethodPa( chAnimal2, "EAT", 2, chParams );
/* Return */
_conReturn( paramList, chName );
/* Release containers */
_conRelease( chAnimal1 );
_conRelease( chAnimal2 );
_conRelease( chName );
_conRelease( chNewName );
_conRelease( chParams );
}
/* Xbase++ code */
CLASS Animal
EXPORTED:
VAR Name
INLINE METHOD Init( cName )
::Name := cName
RETURN self
INLINE METHOD Eat( cFood )
? ::Name, "eats", cFood
RETURN self
ENDCLASS
PROCEDURE Main
LOCAL oWolf := Animal():New( "Wolf" )
LOCAL oSheep := Animal():New( "Sheep" )
CLS
? MyCAPIFunction( oWolf, oSheep )
? oWolf:Name
? oSheep:Name
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.