#include <sml.h>
Inheritance diagram for SMLAUTOCLASS:

Public Member Functions | |
| SMLAUTOCLASS (void(*SetupFunc)(), SMLCONTEXTTYPE ContextTypesToAllow=SMLCONTEXTTYPE_ANY, SMLCONTEXTTYPE ContextTypesToDisallow=SMLCONTEXTTYPE_NONE) | |
| ~SMLAUTOCLASS () | |
| void | AddMethodOld (const char *name, const char *RetClass, void *(*func)(int, SMLARG *, UINT8 *, SMLCONTEXT *), SMLPARM *parms, int CreateDate, int ModDate=0, bool bInWin32Native=true, bool bInX=true) |
| void | AddMethodOld (const char *name, void(*func)(int, SMLARG *, UINT8 *, SMLCONTEXT *), SMLPARM *parms, int CreateDate, int ModDate=0, bool bInWin32Native=true, bool bInX=true) |
| void | AddMethodOldCB (const char *name, void(*func)(int, SMLARG *, UINT8 *, SMLCONTEXT *), SMLPARM *parms, int CreateDate, int ModDate=0, bool bInWin32Native=true, bool bInX=true) |
| void | AddMethodOld (const char *name, SMLSTRING *(*func)(int, SMLARG *, UINT8 *, SMLCONTEXT *), SMLPARM *parms, int CreateDate, int ModDate=0, bool bInWin32Native=true, bool bInX=true) |
| void | AddMethodOld (const char *name, double(*func)(int, SMLARG *, UINT8 *, SMLCONTEXT *), SMLPARM *parms, int CreateDate, int ModDate=0, bool bInWin32Native=true, bool bInX=true) |
| void | AddMember (const SMLCLASSMEMBER &) |
| void | AddMembers (const SMLCLASSMEMBER *) |
| void | ForceLink () |
| void | Init (const char *ClassName, const char *BaseClassName, int CreateDate) |
| void | SetConstructor (void *(*constructor)(void *data, SMLCONTEXT *context, SMLCLASS *smlclass), void(*destructor)(void *data, SMLCONTEXT *context, SMLCLASS *smlclass), int size=0) |
| void | SetCopyConstructor (void *(*copyconstructor)(void *data, SMLCONTEXT *context, SMLCLASS *smlclass, void *)) |
Static Public Member Functions | |
| int | InstallAutoClasses (SMLCONTEXT *context, SMLCONTEXTTYPE contexttype) |
Example usage
// Declare that this class is only to be used in SML, not queries. // Note, an SMLAUTOCLASS must exist for the life of the process. // and is usually created statically. This causes it to be constructed // at the beginning of the program and automatically registers itself. static SMLAUTOCLASS_NEW_T<FOOBAR> s_AutoClass(&FOOBAR::SetupSMLClass, SMLCONTEXTTYPE_SML); // [ static method of FOOBAR ] void FOOBAR::SetupSMLClass ( SMLCONTEXT* context ) { typedef void (FOOBAR::*VOIDMETHOD)(); s_AutoClass.Init("FOOBAR", NULL, 20011212); // Parametes for a method that takes one numeric parameter named "enabled" static SMLPARM PARMS_SetEnabled[] = { { "enabled", STYPE_Num }, { 0 } }; s_AutoClass.AddMethod("IsEnabled", SIG_b, (VOIDMETHOD)&FOOBAR::IsEnabled, NULL, 20011212); s_AutoClass.AddMethod("SetEnabled", SIG_v_b, (VOIDMETHOD)&FOOBAR::SetEnabled, PARMS_SetEnabled, 20011212); s_AutoClass.AddMethod("SetFocus", SIG_v, (VOIDMETHOD)&FOOBAR::SetFocus, NULL, 20011212); }
Note: You cannot use this class directly. Instead, you should use one of the following template methods:
Definition at line 4124 of file sml.h.
|
||||||||||||||||
|
|
|
|
|
|
|
|
|
|
Add an array of SMLCLASSMEMBERs. The last entry must be blank to single the end of the array. |
|
||||||||||||||||||||||||||||||||
|
Add an old-style method (returning a value).
|
|
||||||||||||||||||||||||||||||||
|
Add an old-style method (returning SMLSTRING).
|
|
||||||||||||||||||||||||||||||||
|
Add an old-style method (returning void).
|
|
||||||||||||||||||||||||||||||||||||
|
Add an old-style method (returning void*).
|
|
||||||||||||||||||||||||||||||||
|
Add an old-style method (returning void) Special case for when one parameter is a function with its own parameter list. The callback's parameter list is expected to follow the main functions's parameter list (with a null-parameter between them) |
|
|
|
|
||||||||||||||||
|
Initialize the class.
|
|
||||||||||||
|
Called by context creation to add auto-registered classes.
|
|
||||||||||||||||
|
Call this to set a custom constructor/destructor. By default, the class will be allocated and freed with new/delete. There are a couple other other options, however. Option 1: SML lets you allocate and free the structure To do this, call SetConstructor and pass pointers to constructor and destructor methods. In this case, you can ignore all the parameters in the constructor. Allocate your data and return it. The destructor can free the data. You must not pass a size to SetConstructor() if you want SML to let you allocate the memory. Option 2: SML Allocates and Frees the structure using its own memory pool but lets you initialize and clean up. To do this, pass a non-zero size to SetConstructor(). You can also pass pointers to constructor/destructor functions, but in this case, the data parameter is already allocated for you. Your constructor can set things up and you destructor will be called just before the data is freed. Your destructor must not free the pointer itself. If there is nothing to do to constructo the class (i.e., memseting it to 0 is enough), you can pass NULL for the constructor. |
|
|
|
1.3.4-20031026