add support for 'throw' declarations in director classes and some fixes to compile the primitive_types.i test file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5681 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9d10f61cbd
commit
94405ed6eb
1 changed files with 38 additions and 5 deletions
|
|
@ -1031,7 +1031,8 @@ public:
|
|||
String *name = Getattr(n,"name");
|
||||
String *iname = Getattr(n,"sym:name");
|
||||
SwigType *type = Getattr(n,"type");
|
||||
String *value = Getattr(n,"value");
|
||||
String *rawval = Getattr(n,"rawval");
|
||||
String *value = rawval ? rawval : Getattr(n,"value");
|
||||
String *tm;
|
||||
int have_tm = 0;
|
||||
|
||||
|
|
@ -1165,14 +1166,44 @@ public:
|
|||
String *qualified_name = NewStringf("%s::%s", pclassname, name);
|
||||
target = Swig_method_decl(decl, qualified_name, l, 0, 0);
|
||||
String *rtype = SwigType_str(type, 0);
|
||||
Printf(w->def, "%s %s {", rtype, target);
|
||||
Printf(w->def, "%s %s", rtype, target);
|
||||
Delete(qualified_name);
|
||||
Delete(target);
|
||||
/* header declaration */
|
||||
target = Swig_method_decl(decl, name, l, 0, 1);
|
||||
Printf(declaration, " virtual %s %s;\n", rtype, target);
|
||||
Printf(declaration, " virtual %s %s", rtype, target);
|
||||
Delete(target);
|
||||
|
||||
// Get any exception classes in the throws typemap
|
||||
ParmList *throw_parm_list = 0;
|
||||
|
||||
if ((throw_parm_list = Getattr(n,"throws"))) {
|
||||
Parm *p;
|
||||
int gencomma = 0;
|
||||
|
||||
Append(w->def, " throw(");
|
||||
Append(declaration, " throw(");
|
||||
|
||||
Swig_typemap_attach_parms("throws", throw_parm_list, 0);
|
||||
for (p = throw_parm_list; p; p=nextSibling(p)) {
|
||||
if ((tm = Getattr(p,"tmap:throws"))) {
|
||||
if (gencomma++) {
|
||||
Append(w->def, ", ");
|
||||
Append(declaration, ", ");
|
||||
}
|
||||
|
||||
Printf(w->def, "%s", SwigType_str(Getattr(p, "type"),0));
|
||||
Printf(declaration, "%s", SwigType_str(Getattr(p, "type"),0));
|
||||
}
|
||||
}
|
||||
|
||||
Append(w->def, ")");
|
||||
Append(declaration, ")");
|
||||
}
|
||||
|
||||
Append(w->def, " {");
|
||||
Append(declaration, ";\n");
|
||||
|
||||
/* attach typemaps to arguments (C/C++ -> Python) */
|
||||
String *arglist = NewString("");
|
||||
String* parse_args = NewString("");
|
||||
|
|
@ -1437,11 +1468,13 @@ public:
|
|||
|
||||
/* any existing helper functions to handle this? */
|
||||
if (!is_void) {
|
||||
String* rettype = SwigType_str(return_type, 0);
|
||||
if (!SwigType_isreference(return_type)) {
|
||||
Printf(w->code, "return c_result;\n");
|
||||
Printf(w->code, "return (%s) c_result;\n", rettype);
|
||||
} else {
|
||||
Printf(w->code, "return *c_result;\n");
|
||||
Printf(w->code, "return (%s) *c_result;\n", rettype);
|
||||
}
|
||||
Delete(rettype);
|
||||
}
|
||||
|
||||
Printf(w->code, "}\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue