|
From: Steve M. R. <st...@su...> - 2006-12-06 20:05:52
|
On Fri, Dec 01, 2006 at 11:49:56PM +0000, William S Fulton wrote:
> You can of course provide your own modified javabody typemap, don't have
> to edit the one in java.swg.
I had edited java.swg in order to propose this as a patch so that SWIG
will have toString() methods by default.
I hadn't considered using a locally-modified javabody typemap, since
it would be fragile in the face of swig changes.
> Also you put the toString method in the
> javacode typemap and get the same result.
That's a much better idea, thanks! If swig won't produce the
toString() methods out of the box, here's how to do it,
for the record:
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*)
%{
public String toString() {
return "$javaclassname<0x" + Long.toHexString( swigCPtr ) + ">";
}
%}
Cheers,
-Steve
|