diff options
| author | Stephen Kelly <steveire@gmail.com> | 2017-01-18 23:03:16 +0000 | 
|---|---|---|
| committer | Stephen Kelly <steveire@gmail.com> | 2017-01-18 23:03:16 +0000 | 
| commit | ded67db971a2d185dc999255942141e54b44c478 (patch) | |
| tree | 6fe8f0be7d9ddea57c2acc9585051274222e4ec6 | |
| parent | c7940ff6b0c482b78d7a96db740e21488ce9587f (diff) | |
| download | extra-cmake-modules-ded67db971a2d185dc999255942141e54b44c478.tar.gz extra-cmake-modules-ded67db971a2d185dc999255942141e54b44c478.tar.bz2 | |
Bindings: Handle const-ref of non-record parameter defaults
| -rw-r--r-- | find-modules/sip_generator.py | 6 | ||||
| -rw-r--r-- | tests/GenerateSipBindings/cpplib.cpp | 5 | ||||
| -rw-r--r-- | tests/GenerateSipBindings/cpplib.h | 1 | 
3 files changed, 11 insertions, 1 deletions
| diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py index 35f6667d..7804b3ae 100644 --- a/find-modules/sip_generator.py +++ b/find-modules/sip_generator.py @@ -579,7 +579,9 @@ class SipGenerator(object):              result = parameter.type.get_declaration().type              if parameter.type.kind == TypeKind.LVALUEREFERENCE: -                return parameter.type.get_pointee().get_declaration().type +                if parameter.type.get_pointee().get_declaration().type.kind != TypeKind.INVALID: +                    return parameter.type.get_pointee().get_declaration().type +                return parameter.type.get_pointee()              if parameter.type.get_declaration().type.kind == TypeKind.INVALID:                  return parameter.type @@ -603,6 +605,8 @@ class SipGenerator(object):                      return "0"                  if parameterType.kind == TypeKind.POINTER:                      return "nullptr" +                if parameterType.spelling.startswith("const "): +                    return parameterType.spelling[6:] + "()"                  return parameterType.spelling + "()"              if not "::" in parameterType.spelling:                  return text diff --git a/tests/GenerateSipBindings/cpplib.cpp b/tests/GenerateSipBindings/cpplib.cpp index 863c456e..47370ca0 100644 --- a/tests/GenerateSipBindings/cpplib.cpp +++ b/tests/GenerateSipBindings/cpplib.cpp @@ -125,6 +125,11 @@ void MyObject::intBraces(int i)  } +void MyObject::intRefBraces(int const& s) +{ + +} +  void MyObject::pointerBraces(int* p)  { diff --git a/tests/GenerateSipBindings/cpplib.h b/tests/GenerateSipBindings/cpplib.h index 8333e7f0..a91b5486 100644 --- a/tests/GenerateSipBindings/cpplib.h +++ b/tests/GenerateSipBindings/cpplib.h @@ -57,6 +57,7 @@ public:    void stringBraces(QString s = {});    void stringRefBraces(QString const& s = {});    void intBraces(int i = {}); +  void intRefBraces(int const& i = {});    void pointerBraces(int* p = {});    int const_parameters(const int input, QObject* const obj = 0) const; | 
