This was suggested by wsfulton on the mailing list in order to bring the D module in line with the C# one, the naming scheme of which is intended to be language-independent. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12319 626c5289-ae23-0410-ae9c-e8d60b6d4f22
172 lines
4.3 KiB
Text
172 lines
4.3 KiB
Text
/* -----------------------------------------------------------------------------
|
|
* dclassgen.swg
|
|
*
|
|
* Typemaps containing D code used when generating D proxy classes.
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
%typemap(dbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
|
%typemap(dclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "class"
|
|
%typemap(dcode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
|
%typemap(dimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
|
%typemap(dinterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
|
%typemap(dinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
|
|
|
// See <denums.swg>.
|
|
%typemap(dclassmodifiers) enum SWIGTYPE "enum"
|
|
%typemap(dcode) enum SWIGTYPE ""
|
|
|
|
|
|
/*
|
|
* Proxy classes.
|
|
*/
|
|
|
|
%typemap(dconstructor, excode=SWIGEXCODE,directorconnect="\n swigDirectorConnect();") SWIGTYPE {
|
|
this($imcall, true);$excode$directorconnect
|
|
}
|
|
|
|
%typemap(ddestructor) SWIGTYPE %{
|
|
~this() {
|
|
dispose();
|
|
}
|
|
%}
|
|
|
|
// We do not use »override« attribute for generated dispose() methods to stay
|
|
// somewhat compatible to Phobos and older Tango versions where Object.dispose()
|
|
// does not exist.
|
|
%typemap(ddispose, methodname="dispose", methodmodifiers="public") SWIGTYPE {
|
|
synchronized(this) {
|
|
if (swigCPtr !is null) {
|
|
if (swigCMemOwn) {
|
|
swigCMemOwn = false;
|
|
$imcall;
|
|
}
|
|
swigCPtr = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
%typemap(ddispose_derived, methodname="dispose", methodmodifiers="public") SWIGTYPE {
|
|
synchronized(this) {
|
|
if (swigCPtr !is null) {
|
|
if (swigCMemOwn) {
|
|
swigCMemOwn = false;
|
|
$imcall;
|
|
}
|
|
swigCPtr = null;
|
|
super.dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
%define SWIGD_CLASS_BODIES(OP_EQUALS_RETURN)
|
|
// Unfortunately, the »package« visibility attribute does not work in D when the
|
|
// module in question is in the root package (happens if no -package is specified
|
|
// at the SWIG command line), so we are stuck with public visibility for
|
|
// swigGetCPtr().
|
|
%typemap(dbody) SWIGTYPE %{
|
|
private void* swigCPtr;
|
|
protected bool swigCMemOwn;
|
|
|
|
public this(void* cObject, bool ownCObject) {
|
|
swigCPtr = cObject;
|
|
swigCMemOwn = ownCObject;
|
|
}
|
|
|
|
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
|
if (auto other = cast($dclassname)rhs) {
|
|
return (swigCPtr == other.swigCPtr);
|
|
}
|
|
return super.opEquals(rhs);
|
|
}
|
|
|
|
public static void* swigGetCPtr($dclassname obj) {
|
|
return (obj is null) ? null : obj.swigCPtr;
|
|
}
|
|
%}
|
|
|
|
%typemap(dbody_derived) SWIGTYPE %{
|
|
private void* swigCPtr;
|
|
|
|
public this(void* cObject, bool ownCObject) {
|
|
super($imdmodule.$dclassnameUpcast(cObject), ownCObject);
|
|
swigCPtr = cObject;
|
|
}
|
|
|
|
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
|
if (auto other = cast($dclassname)rhs) {
|
|
return (swigCPtr == other.swigCPtr);
|
|
}
|
|
return super.opEquals(rhs);
|
|
}
|
|
|
|
public static void* swigGetCPtr($dclassname obj) {
|
|
return (obj is null) ? null : obj.swigCPtr;
|
|
}
|
|
%}
|
|
|
|
|
|
/*
|
|
* Type wrapper classes.
|
|
*/
|
|
|
|
%typemap(dbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
|
|
private void* swigCPtr;
|
|
|
|
public this(void* cObject, bool futureUse) {
|
|
swigCPtr = cObject;
|
|
}
|
|
|
|
protected this() {
|
|
swigCPtr = null;
|
|
}
|
|
|
|
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
|
if (auto other = cast($dclassname)rhs) {
|
|
return (swigCPtr == other.swigCPtr);
|
|
}
|
|
return super.opEquals(rhs);
|
|
}
|
|
|
|
public static void* swigGetCPtr($dclassname obj) {
|
|
return (obj is null) ? null : obj.swigCPtr;
|
|
}
|
|
%}
|
|
|
|
|
|
/*
|
|
* Member function pointer wrapper classes (see <dmemberfunctionpointers.swg>).
|
|
*/
|
|
|
|
%typemap(dbody) SWIGTYPE (CLASS::*) %{
|
|
private char* m_swigCMemberPtr;
|
|
|
|
public this(char* cMemberPtr, bool futureUse) {
|
|
m_swigCMemberPtr = cMemberPtr;
|
|
}
|
|
|
|
protected this() {
|
|
m_swigCMemberPtr = null;
|
|
}
|
|
|
|
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
|
if (auto other = cast($dclassname)rhs) {
|
|
return (m_swigCMemberPtr == other.m_swigCMemberPtr);
|
|
}
|
|
return super.opEquals(rhs);
|
|
}
|
|
|
|
|
|
package static char* swigGetCMemberPtr($dclassname obj) {
|
|
return (obj is null) ? null : obj.m_swigCMemberPtr;
|
|
}
|
|
%}
|
|
%enddef
|
|
|
|
|
|
#if SWIG_D_VERSION == 1
|
|
SWIGD_CLASS_BODIES(int)
|
|
#else
|
|
SWIGD_CLASS_BODIES(bool)
|
|
#endif
|
|
|
|
#undef SWIGD_CLASS_BODIES
|