From 04622f7d2210cbb8036502afadf5bcdcb0394d28 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 21 Feb 2008 13:27:51 +0000 Subject: first steps in implementing object interfaces (stage work for later dynamic class loading) --- var.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'var.c') diff --git a/var.c b/var.c index a7e71405..308bd684 100644 --- a/var.c +++ b/var.c @@ -104,7 +104,7 @@ varUnsetValues(var_t *pThis) /* set a string value */ -rsRetVal +static rsRetVal varSetString(var_t *pThis, cstr_t *pCStr) { DEFiRet; @@ -120,6 +120,31 @@ finalize_it: } +/* queryInterface function + * rgerhards, 2008-02-21 + */ +BEGINobjQueryInterface(var) +CODESTARTobjQueryInterface(var) + if(pIf->ifVersion != varCURR_IF_VERSION) { /* check for current version, increment on each change */ + ABORT_FINALIZE(RS_RET_INTERFACE_NOT_SUPPORTED); + } + + /* ok, we have the right interface, so let's fill it + * Please note that we may also do some backwards-compatibility + * work here (if we can support an older interface version - that, + * of course, also affects the "if" above). + */ + pIf->oID = OBJvar; + + pIf->Construct = varConstruct; + pIf->ConstructFinalize = varConstructFinalize; + pIf->Destruct = varDestruct; + pIf->DebugPrint = varDebugPrint; + pIf->SetString = varSetString; +finalize_it: +ENDobjQueryInterface(var) + + /* Initialize the var class. Must be called as the very first method * before anything else is called inside this class. * rgerhards, 2008-02-19 -- cgit