%extend member variable test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7314 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8eb7e528b0
commit
d1af1d070e
1 changed files with 39 additions and 0 deletions
39
Examples/test-suite/extend_variable.i
Normal file
39
Examples/test-suite/extend_variable.i
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
%module extend_variable
|
||||
|
||||
// Tests %extend for variables
|
||||
|
||||
%inline %{
|
||||
class ExtendMe {
|
||||
double var;
|
||||
public:
|
||||
ExtendMe(){}
|
||||
bool get(double &d) {
|
||||
d = var;
|
||||
return true;
|
||||
}
|
||||
bool set(const double &d) {
|
||||
var = d;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
||||
%extend ExtendMe {
|
||||
ExtendVar;
|
||||
};
|
||||
|
||||
%{
|
||||
namespace {
|
||||
static double StaticVar = 0;
|
||||
}
|
||||
|
||||
// If possible, all language modules should use this naming format for consistency
|
||||
void ExtendMe_ExtendVar_set(ExtendMe *thisptr, double value) {
|
||||
thisptr->set(value);
|
||||
}
|
||||
double ExtendMe_ExtendVar_get(ExtendMe *thisptr) {
|
||||
double value = 0;
|
||||
thisptr->get(value);
|
||||
return value;
|
||||
}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue