OBJECT GETVALUE()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

Return an API_EXPRESSION from a property


SYNONYM

None


SYNOPSIS

#include "dbapi.h"
 
OBJECT_GETVALUE(result)
 
<input parameters>
none
 
<output parameters>
API_EXPRESSION	*result;		/* Pointer to an API_EXPRESSION to return result */


DESCRIPTION

The OBJECT_GETVALUE() macro is used to return the value passed to a set property method to an API_EXPRESSION. Objects are not converted with this macro, see OBJECT_GETOBJECT() for more information.


EXAMPLE

In the following example OBJECT_GETVALUE() is used to return the value passed to the set property method of the NumValue property as an API_EXPRESSION.

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, NumValue) 
{
	struct example_data *objectData = (struct example_data *)OBJECT_GETDATA();
	struct API_EXPRESSION result;
	int	rc = OBJECT_ERROR;
 
	OBJECT_GETVALUE(&result);
	if (result.errno == 0 && result.type == 'N') {
		objectData->prop_numvalue = result.number;
		rc = OBJECT_SUCCESS;
	}
 
	return(rc);
}


SEE ALSO

DEFINE_CLASS(), DEFINE_METHOD(), 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_NEW(), OBJECT_RETERROR(), OBJECT_RETPROPERTY(), OBJECT_RETRESULT(), OBJECT_SETARG(), OBJECT_SETDATA(), OBJECT_SETPROPERTY()