Difference between revisions of "OBJECT ASSIGN()"
Yvonne.milne (Talk | contribs) m (1 revision) |
Yvonne.milne (Talk | contribs) m (Text replace - "lianjaapi.h" to "lianja_api.h") |
||
| Line 7: | Line 7: | ||
==SYNOPSIS== | ==SYNOPSIS== | ||
<code lang="c"> | <code lang="c"> | ||
| − | #include " | + | #include "lianja_api.h" |
OBJECT_ASSIGN(objptr, objname) | OBJECT_ASSIGN(objptr, objname) | ||
| Line 35: | Line 35: | ||
Example in 'C' object: | Example in 'C' object: | ||
<code lang="c"> | <code lang="c"> | ||
| − | #include " | + | #include "lianja_api.h" |
/* define set property method */ | /* define set property method */ | ||
Latest revision as of 07:11, 11 April 2013
PURPOSE
Assign a name to an instantiated object
SYNONYM
None
SYNOPSIS
#include "lianja_api.h" OBJECT_ASSIGN(objptr, objname) <input parameters> OBJECT objptr; /* Pointer to the object to assign name to */ char *objname; /* Name to assign to the object */ <output parameters> none
DESCRIPTION
The OBJECT_ASSIGN() macro is used to assign a name to an instantiated object. You must assign a name to an object when it is passed as a value to set a property.
EXAMPLE
The following example instantiates an object from a system class EXCEPTION and assigns it to the ObjValue property in a class called clsMyClass.
Example Lianja script:
test = newobject("myclass") // Instantiate an EXCEPTION object and assign it to the property ObjValue test.objvalue=newobject("exception")
Example in 'C' object:
#include "lianja_api.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(), DEFINE_PROPERTYSET(), DISPATCH_FACTORY(), DISPATCH_METHOD(), DISPATCH_PROPGET(), DISPATCH_PROPSET(), 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()