DEFINE METHOD()

From Recital Documentation Wiki
Revision as of 12:51, 27 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PURPOSE

A macro to define a method


SYNONYM

None


SYNOPSIS

#include "dbapi.h"
 
DEFINE_METHOD(classname, methodname)
 
<input parameters>
constant		classname;	/* Class name that contains the method	*/
constant		methodname;	/* Method name to define			*/
 
<output parameters>
none


DESCRIPTION

The DEFINE_METHOD() macro is used to define a method for class that can be accessed from the Recital 4GL.


EXAMPLE

The following example defines a method called Destructor for the class clsMyClass.

Example Recital program:

test = newobject("myclass")
// The destructor is called when the object is released
release test

Example in 'C' object:

#include "dbapi.h"
 
DEFINE_METHOD(clsMyClass, Destructor) 
{
	struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
 
	if (objectData != NULL) {
		if (objectData->prop_objvalue != NULL) OBJECT_DELETE(objectData->prop_objvalue);
		free(objectData);
		objectData = NULL;
	}
	return(0);
}


SEE ALSO

DEFINE_CLASS(), DEFINE_PROPERTYGET(), DEFINE_PROPERTYSET(), 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()