[Go] #2245 Handle NULL pointers for string* conversions.
Rearrange generation of director methods and rename receiver argument from p to swig_p. Fixes #2245
This commit is contained in:
parent
e1173cac26
commit
87cbf8c341
5 changed files with 194 additions and 162 deletions
|
|
@ -67,6 +67,9 @@ func main() {
|
|||
|
||||
a.CallS4([]string{ "T1", "T2" })
|
||||
|
||||
a.S5(&str)
|
||||
a.S5(nil)
|
||||
|
||||
a = wrap.NewDirectorMyClass(nil)
|
||||
s = a.Adjust(m)
|
||||
if s.Str != `{"first":"second"}` {
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ class MyClass {
|
|||
virtual void S2(std::string& s) = 0;
|
||||
virtual void S3(std::string* s) = 0;
|
||||
virtual void S4(const char * const *strarray);
|
||||
virtual int S5(const std::string* s);
|
||||
};
|
||||
|
||||
void MyClass::S1(std::string s) {
|
||||
|
|
@ -239,4 +240,12 @@ void MyClass::CallS4(const char * const *strarray) {
|
|||
this->S4(strarray);
|
||||
}
|
||||
|
||||
int MyClass::S5(const std::string* s) {
|
||||
if (s) {
|
||||
return (*s)[0];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue