[cable] wrapping return Types which are not in classes
Bertram Herzog
bertram at bwh.harvard.edu
Tue Mar 25 16:56:05 EST 2003
Hello fellow cablers, dear Brad King,
I have a problem wrapping classes that have enumerations outside of the
class definition. The generated cable-code looks like the following:
template <>
struct ReturnEnum< OFStatus >
{
static void From(const OFStatus& result,
const WrapperFacility* wrapperFacility)
{
const char* name=0;
switch (result)
{
case ::::OF_error: name = "::::OF_error"; break;
case ::::OF_failure: name = "::::OF_failure"; break;
case ::::OF_ok: name = "::::OF_ok"; break;
}
Tcl_SetObjResult(wrapperFacility->GetInterpreter(),
Tcl_NewStringObj(const_cast<char*>(name), -1));
}
};
Obviously, the Visual C++ compiler of Visual Studio 6 does not like the
empty namespace and throws errors!
Right in the next statement I have the following situation (which
compiles fine!):
template <>
struct ReturnEnum< OFCommandLine::E_ParseStatus >
{
static void From(const OFCommandLine::E_ParseStatus& result,
const WrapperFacility* wrapperFacility)
{
const char* name=0;
switch (result)
{
case OFCommandLine::PS_MissingParameter: name =
"OFCommandLine::PS_MissingParameter"; break;
case OFCommandLine::PS_MissingValue: name =
"OFCommandLine::PS_MissingValue"; break;
case OFCommandLine::PS_NoArguments: name =
"OFCommandLine::PS_NoArguments"; break;
case OFCommandLine::PS_Normal: name = "OFCommandLine::PS_Normal";
break;
case OFCommandLine::PS_TooManyParameters: name =
"OFCommandLine::PS_TooManyParameters"; break;
case OFCommandLine::PS_UnknownOption: name =
"OFCommandLine::PS_UnknownOption"; break;
}
Tcl_SetObjResult(wrapperFacility->GetInterpreter(),
Tcl_NewStringObj(const_cast<char*>(name), -1));
}
};
This compiles fine:.
The only differences in the source code are, that the first snippet is
declared in the header before the start of one ot the two classes to be
wrapped in this file, whereas the latter is defined within the class.
Therefore the classname is taken to build a namespace wherein the actual
enumeration is embedded.
.
Is there a way of dealing with this, without altering the origninal
toolkit code (snippets are from the Oldenburg offis DCMTK-toolkit)?
I will attach the following to this mail:
the two original files ofcond.h (which causes the error) and ofcmdln
(which works out fine)
I will not include the rest of the generated wrapper, but can sure send it.
Thanks for all your help,
Bertram Herzog.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ofcond_and_ofcmdln.zip
Type: application/x-zip-compressed
Size: 11462 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cable/attachments/20030325/0659cbed/attachment.bin>
More information about the cable
mailing list