DEFINE PROPERTYSET()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

A macro to define a method to set the value of a property


SYNONYM

None


SYNOPSIS

#include "dbapi.h"
 
DEFINE_PROPERTYSET(classname, propertyname)
 
<input parameters>
constant		classname;	/* Class name that contains the property	*/
constant		propertyname;	/* Property name to define 		*/
 
<output parameters>
none


DESCRIPTION

The DEFINE_PROPERTYSET() macro is used to define a method to set the value of a property from a class that can be accessed from the Recital 4GL.


EXAMPLE

The following example defines a method to set the value of the property called NumValue for the class clsMyClass.

Example Recital program:

test = newobject("myclass")
// Set  the value of the property NumValue
test.numvalue = test.numvalue * 5

Example in 'C' object:

#include "dbapi.h"
 
/* Define set property method */
DEFINE_PROPERTYSET(clsMyClass, ObjValue) 
{
	struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
	OBJECT	objvalue;
	int	rc = OBJECT_ERROR;
 
	if (OBJECT_GETTYPE() == 'O') {
		objvalue = OBJECT_GETOBJECT(); 
		objectData->prop_objvalue = OBJECT_ASSIGN(objvalue, objectData->object_name);
		rc = OBJECT_SUCCESS;
	}
 
	return(rc);
}


SEE ALSO

DEFINE_CLASS(), DEFINE_METHOD(), DEFINE_PROPERTYGET(), DISPATCH_FACTORY(), DISPATCH_METHOD(), DISPATCH_PROPGET(), DISPATCH_PROPSET(), OBJECT_ASSIGN(), OBJECT_DELETE(), OBJECT_GETARG(), OBJECT_GETARGC(), OBJECT_GETDATA(), OBJECT_GETOBJECT(), OBJECT_GETPARAMETER(), OBJECT_GETPROPERTY(), OBJECT_GETTYPE(), OBJECT_GETVALUE(), OBJECT_NEW(), OBJECT_RETERROR(), OBJECT_RETPROPERTY(), OBJECT_RETRESULT(), OBJECT_SETARG(), OBJECT_SETDATA(), OBJECT_SETPROPERTY()